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 jobs: clang_tidy: # if: ${{ false }} name: Clang Tidy runs-on: ubuntu-20.04 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: cd "$GITHUB_WORKSPACE" && scripts/run_clang_tidy.sh build_for_linux: # if: ${{ false }} name: Linux Ubuntu 20.04 runs-on: ubuntu-20.04 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: Configure CMake shell: bash working-directory: ${{ runner.workspace }} run: | options=( -G Ninja -B build -S "$GITHUB_WORKSPACE" -D CMAKE_BUILD_TYPE=${{ env.build_type }} -D CMAKE_CXX_STANDARD=17 -D SFIZZ_JACK=ON -D SFIZZ_RENDER=ON -D SFIZZ_SHARED=ON -D SFIZZ_TESTS=ON ) cmake "${options[@]}" - name: Build tests shell: bash working-directory: ${{ runner.workspace }} run: | cmake \ --build build \ --config ${{ env.build_type }} \ --target sfizz_tests \ --verbose \ -j 2 - name: Run tests shell: bash run: ${{ runner.workspace }}/build/tests/sfizz_tests - name: CTest working-directory: ${{ runner.workspace }}/build run: ctest -j 2 -C ${{ env.build_type }} --output-on-failure - name: Build shell: bash working-directory: ${{ runner.workspace }} run: cmake --build build --config ${{ env.build_type }} --verbose -j 2 - name: Create tarball if: ${{ github.ref_type == 'tag' }} working-directory: ${{ runner.workspace }} shell: bash 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: "${{ runner.workspace }}/${{ env.install_name }}.tar.gz" build_for_macos: # if: ${{ false }} name: macOS 11 runs-on: macos-11 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 shell: bash working-directory: ${{ runner.workspace }} run: | options=( -B build -S "$GITHUB_WORKSPACE" -D CMAKE_BUILD_TYPE=${{ env.build_type }} -D SFIZZ_JACK=OFF -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[@]}" - name: Build tests shell: bash working-directory: ${{ runner.workspace }} run: | cmake \ --build build \ --config ${{ env.build_type }} \ --target sfizz_tests \ --verbose \ -j 2 - name: Run tests shell: bash run: ${{ runner.workspace }}/build/tests/sfizz_tests - name: CTest working-directory: ${{ runner.workspace }}/build run: ctest -j 2 -C ${{ env.build_type }} --output-on-failure - name: Build shell: bash working-directory: ${{ runner.workspace }} run: cmake --build build --config ${{ env.build_type }} --verbose -j 2 - name: Create tarball if: ${{ github.ref_type == 'tag' }} shell: bash working-directory: ${{ runner.workspace }} 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: "${{ runner.workspace }}/${{ env.install_name }}.tar.gz" build_for_windows: # if: ${{ false }} name: Windows 2019 runs-on: windows-2019 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 working-directory: ${{ runner.workspace }} run: | cmake ` -G "Visual Studio 16 2019" ` -A "${{ matrix.release_arch }}" ` -B build ` -S "${Env:GITHUB_WORKSPACE}" ` -D CMAKE_BUILD_TYPE=${{ env.build_type }} ` -D CMAKE_CXX_STANDARD=17 ` -D SFIZZ_TESTS=ON ` - name: Build tests working-directory: ${{ runner.workspace }} run: | cmake ` --build build ` --config ${{ env.build_type }} ` --target sfizz_tests ` --verbose ` -j 2 ` - name: Test run: ${{ runner.workspace }}\build\tests\${{ env.build_type }}\sfizz_tests.exe - name: Build working-directory: ${{ runner.workspace }} run: cmake --build build --config ${{ env.build_type }} --verbose -j 2 - name: Create zip package if: ${{ github.ref_type == 'tag' }} working-directory: ${{ runner.workspace }} run: 7z a "${{ env.install_name }}.zip" ".\build\src\${{ env.build_type }}\sfizz.*" - name: Upload if: ${{ github.ref_type == 'tag' }} uses: actions/upload-artifact@v3 with: name: ${{ matrix.pkg_platform }} zip package path: "${{ runner.workspace }}/${{ env.install_name }}.zip" archive_source_code: # if: startsWith(github.ref, 'refs/tags/') if: ${{ github.ref_type == 'tag' }} name: Source code archive runs-on: ubuntu-20.04 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 shell: bash run: | cd "$GITHUB_WORKSPACE" && git-archive-all \ --prefix="${{ env.install_name }}/" \ -9 "${{ runner.workspace }}/${{ env.install_name }}.tar.gz" - name: Upload uses: actions/upload-artifact@v3 with: name: Source code tarball path: "${{ runner.workspace }}/${{ env.install_name }}.tar.gz" build_for_mingw: if: ${{ false }} # DISABLED TEMPORARILY name: MinGW runs-on: ubuntu-20.04 strategy: matrix: include: - platform: i686 pkg_platform: Win32 bits: 32 - platform: x86_64 pkg_platform: Win64 bits: 64 container: image: archlinux env: install_name: sfizz-${{ github.ref_name }}-mingw${{ matrix.bits }} steps: - name: Configure pacman repositories shell: bash run: | cat >>/etc/pacman.conf < "$GITHUB_WORKSPACE"/simple.cpp #include int main() { sfz::Sfizz synth; synth.loadSfzString("", ""); return 0; } EOF cat < "$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_mingw - 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: MinGW 32 download if: ${{ false }} # DISABLED: MinGW 32 build temporarily disabled uses: actions/download-artifact@v3 with: name: Win32 MinGW tarball - name: MinGW 64 download if: ${{ false }} # DISABLED: MinGW 64 build temporarily disabled uses: actions/download-artifact@v3 with: name: Win64 MinGW 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 shell: bash 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 }}.*