Skip to content

C++20 Support

C++20 Support #1609

Workflow file for this run

name: Build library
on:
push:
branches:
- 'develop'
- 'master'
tags:
- '[0-9]*'
pull_request:
branches:
- '*'
# Manual builds in all branches
workflow_dispatch:
branches:
- '*'
env:
build_type: Release
# defaults:
# shell: pwsh on windows, bash all the rest
# working-directory: ${{ github.workspace }}
jobs:
clang_tidy:
name: Clang Tidy
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install clang-tidy
- name: Run
run: ./scripts/run_clang_tidy.sh
test_with_asan:
name: ASAN
runs-on: ubuntu-22.04 # abseil (libabsl) is not available in 20.04 repository
timeout-minutes: 10
env:
install_name: sfizz-${{ github.ref_name }}-linux
strategy:
matrix:
build_type: [Debug, RelWithDebInfo]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install \
ninja-build \
libjack-jackd2-dev \
libabsl-dev \
libabsl20210324
- name: Configure CMake
run: |
options=(
-G Ninja
-B build
-S .
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
-D SFIZZ_TESTS=ON
-D SFIZZ_USE_SYSTEM_ABSEIL=ON
-D SFIZZ_ASAN=ON
)
cmake "${options[@]}"
- name: Build tests
run: |
options=(
--build build
--config ${{ matrix.build_type }}
--parallel 2
--target sfizz_tests
)
cmake "${options[@]}"
- name: Run tests
run: |
options=(
--build-config ${{ matrix.build_type }}
--parallel 2
--output-on-failure
--test-dir build
)
ctest "${options[@]}"
build_for_linux:
name: Linux Ubuntu 22.04
runs-on: ubuntu-22.04 # abseil (libabsl) is not available in 20.04 repository
timeout-minutes: 10
env:
install_name: sfizz-${{ github.ref_name }}-linux
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install \
ninja-build \
libjack-jackd2-dev
- name: Install abseil
if: ${{ github.ref_type == 'branch' }}
run: |
sudo apt-get install \
libabsl-dev \
libabsl20210324
- name: Configure CMake
run: |
options=(
-G Ninja
-B build
-S .
-D CMAKE_BUILD_TYPE=${{ env.build_type }}
-D SFIZZ_JACK=ON
-D SFIZZ_RENDER=ON
-D SFIZZ_SHARED=ON
-D SFIZZ_TESTS=ON
)
if [[ ${{ github.ref_type }} == 'branch' ]]; then
options=(
${options[@]}
-D SFIZZ_USE_SYSTEM_ABSEIL=ON
)
fi
cmake "${options[@]}"
echo "-- github.workspace: ${{ github.workspace }}"
echo "-- runner.workspace: ${{ runner.workspace }}"
- name: Build tests
run: |
options=(
--build build
--config ${{ env.build_type }}
--parallel 2
--target sfizz_tests
--verbose
)
cmake "${options[@]}"
- name: Run tests
run: |
options=(
--build-config ${{ env.build_type }}
--parallel 2
--output-on-failure
--test-dir build
)
ctest "${options[@]}"
- name: Build all
run: |
options=(
--build build
--config ${{ env.build_type }}
--parallel 2
--verbose
)
cmake "${options[@]}"
- name: Create tarball
if: ${{ github.ref_type == 'tag' }}
run: |
DESTDIR="$(pwd)/${{ env.install_name }}" \
cmake --build build --config ${{ env.build_type }} --target install
tar czvf "${{ env.install_name }}".tar.gz "${{ env.install_name }}"
- name: Upload
if: ${{ github.ref_type == 'tag' }}
uses: actions/upload-artifact@v3
with:
name: Linux tarball
path: "${{ github.workspace }}/${{ env.install_name }}.tar.gz"
build_for_macos:
name: macOS 11
runs-on: macos-11
timeout-minutes: 15
env:
install_name: "sfizz-${{ github.ref_name }}-macos"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
if: ${{ github.ref_type == 'branch' }}
run: brew install abseil
- name: Configure CMake
run: |
options=(
-B build
-S .
-D CMAKE_BUILD_TYPE=${{ env.build_type }}
-D SFIZZ_SHARED=ON
-D SFIZZ_TESTS=ON
)
if [[ ${{ github.ref_type }} == 'branch' ]]; then
options=(
${options[@]}
-D SFIZZ_USE_SYSTEM_ABSEIL=ON
)
fi
cmake "${options[@]}"
echo "-- runner.workspace: ${{ runner.workspace }}"
echo "-- github.workspace: ${{ github.workspace }}"
- name: Build tests
run: |
options=(
--build build
--config ${{ env.build_type }}
--parallel 2
--target sfizz_tests
--verbose
)
cmake "${options[@]}"
- name: Run tests
run: |
options=(
--build-config ${{ env.build_type }}
--parallel 2
--output-on-failure
--test-dir build
)
ctest "${options[@]}"
- name: Build all
run: |
options=(
--build build
--config ${{ env.build_type }}
--parallel 2
--verbose
)
cmake "${options[@]}"
- name: Create tarball
if: ${{ github.ref_type == 'tag' }}
run: |
DESTDIR="$(pwd)/${{ env.install_name }}" \
cmake --build build --config ${{ env.build_type }} --target install
tar czvf "${{ env.install_name }}".tar.gz "${{ env.install_name }}"
- name: Upload
if: ${{ github.ref_type == 'tag' }}
uses: actions/upload-artifact@v3
with:
name: macOS tarball
path: "${{ github.workspace }}/${{ env.install_name }}.tar.gz"
build_for_windows:
name: Windows 2019
runs-on: windows-2019
timeout-minutes: 15
strategy:
matrix:
include:
- platform: x86
pkg_platform: Win32
release_arch: Win32
bits: 32
- platform: x64
pkg_platform: Win64
release_arch: x64
bits: 64
env:
install_name: sfizz-${{ github.ref_name }}-win${{ matrix.bits }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Configure CMake
run: |
cmake `
-G "Visual Studio 16 2019" `
-A "${{ matrix.release_arch }}" `
-B build `
-S . `
-D SFIZZ_TESTS=ON
echo "-- runner.workspace: ${{ runner.workspace }}"
echo "-- github.workspace: ${{ github.workspace }}"
- name: Build tests
run: |
cmake `
--build build `
--config ${{ env.build_type }} `
--parallel 2 `
--target sfizz_tests `
--verbose `
- name: Run tests
run: |
ctest `
--build-config ${{ env.build_type }} `
--output-on-failure `
--test-dir build `
- name: Build all
run: |
cmake `
--build build `
--config ${{ env.build_type }} `
--parallel 2 `
--verbose `
- name: Create zip package
if: ${{ github.ref_type == 'tag' }}
run: 7z a "${{ env.install_name }}.zip" ".\build\library\*"
- name: Upload
if: ${{ github.ref_type == 'tag' }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.pkg_platform }} zip package
path: "${{ github.workspace }}/${{ env.install_name }}.zip"
archive_source_code:
if: ${{ github.ref_type == 'tag' }}
name: Source code archive
runs-on: ubuntu-20.04
timeout-minutes: 2
env:
install_name: sfizz-${{ github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install python3-pip
sudo pip install git-archive-all
- name: Archive source code
run: |
git-archive-all \
--prefix="${{ env.install_name }}/" \
-9 "${{ github.workspace }}/${{ env.install_name }}.tar.gz"
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Source code tarball
path: "${{ github.workspace }}/${{ env.install_name }}.tar.gz"
build_with_libsndfile:
name: Linux libsndfile
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install \
ninja-build \
libsndfile1-dev
- name: Configure CMake
run: |
options=(
-G Ninja
-B build
-S .
-D CMAKE_BUILD_TYPE=${{ env.build_type }}
-D SFIZZ_JACK=OFF
-D SFIZZ_RENDER=OFF
-D SFIZZ_SHARED=OFF
-D SFIZZ_TESTS=ON
-D SFIZZ_USE_SNDFILE=ON
)
cmake "${options[@]}"
- name: Build tests
run: |
options=(
--build build
--config ${{ env.build_type }}
--parallel 2
--target sfizz_tests
--verbose
)
cmake "${options[@]}"
- name: Run tests
run: |
options=(
--build-config ${{ env.build_type }}
--parallel 2
--output-on-failure
--test-dir build
)
ctest "${options[@]}"
build_with_makefile:
name: Linux makefile
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build with GNU make
run: make -C "${{ github.workspace }}" -f generic.mk -j2
- name: Compile a simple program
run: |
cat <<EOF > "${{ github.workspace }}"/simple.cpp
#include <sfizz.hpp>
int main() {
sfz::Sfizz synth;
synth.loadSfzString("", "");
return 0;
}
EOF
cat <<EOF > "${{ github.workspace }}"/simple.mk
all: simple
include generic.mk
simple.o: simple.cpp
\$(CXX) \$(CXXFLAGS) \$(SFIZZ_CXX_FLAGS) -c -o \$@ \$<
simple: simple.o \$(SFIZZ_TARGET)
\$(CXX) -o \$@ \$^ \$(SFIZZ_LINK_FLAGS) \$(LDFLAGS)
EOF
make -C "${{ github.workspace }}" -f simple.mk
deploy:
if: ${{ github.ref_type == 'tag' }}
runs-on: ubuntu-20.04
needs:
- build_for_linux
- build_for_macos
# - build_for_mod
- build_for_windows
- archive_source_code
steps:
- name: macOS download
uses: actions/download-artifact@v3
with:
name: macOS tarball
- name: Windows 32 download
uses: actions/download-artifact@v3
with:
name: Win32 zip package
- name: Windows 64 download
uses: actions/download-artifact@v3
with:
name: Win64 zip package
- name: Source code download
uses: actions/download-artifact@v3
with:
name: Source code tarball
- name: Display file information
run: ls -lR
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
files: |
sfizz-${{ github.ref_name }}-*
sfizz-${{ github.ref_name }}.*