on: [push, pull_request] name: Build jobs: build: name: Build (${{ matrix.target }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - target: linux pack_ext: tar.gz - target: windows pack_ext: zip steps: - name: Checkout uses: actions/checkout@v5 with: persist-credentials: true - name: Checkout lfs run: | git lfs install --local AUTH=$(git config --local http.${{ github.server_url }}/.extraheader) git config --local --unset http.${{ github.server_url }}/.extraheader git config --local http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader "$AUTH" git lfs pull - name: Apt update run: sudo apt update - name: Installing build chain (Linux) if: matrix.target == 'linux' run: sudo apt-get install pigz ninja-build g++ clang pkg-config cmake libtbb-dev -y - name: Installing build chain (Windows Cross-Compile) if: matrix.target == 'windows' run: sudo apt-get install pigz ninja-build g++-mingw-w64-x86-64 cmake -y - name: Cache CPM uses: actions/cache@v5 with: path: "~/.cache/CPM/" key: ${{ runner.os }}-${{ matrix.target }}-CPM - name: Configure debug run: | mkdir -p build/debug cd build/debug if [ "${{ matrix.target }}" = "windows" ]; then CPM_SOURCE_CACHE="~/.cache/CPM/" cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc else CPM_SOURCE_CACHE="~/.cache/CPM/" cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=Debug fi - name: Configure Release run: | mkdir -p build/release cd build/release if [ "${{ matrix.target }}" = "windows" ]; then CPM_SOURCE_CACHE="~/.cache/CPM/" cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc fi if [ "${{ matrix.target }}" = "linux" ]; then CPM_SOURCE_CACHE="~/.cache/CPM/" cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=Release fi - name: Configure MinSizeRel run: | mkdir -p build/minsizerel cd build/minsizerel if [ "${{ matrix.target }}" = "windows" ]; then CPM_SOURCE_CACHE="~/.cache/CPM/" cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc else CPM_SOURCE_CACHE="~/.cache/CPM/" cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel fi - name: Configure RelWithDeb run: | mkdir -p build/relwithdeb cd build/relwithdeb if [ "${{ matrix.target }}" = "windows" ]; then CPM_SOURCE_CACHE="~/.cache/CPM/" cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=RelWithDeb -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc else CPM_SOURCE_CACHE="~/.cache/CPM/" cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=RelWithDeb fi - name: Build debug run: cd build/debug && ninja - name: Build Release run: cd build/release && ninja - name: Build RelWithDeb run: cd build/relwithdeb && ninja - name: Build MinSizeRel run: cd build/minsizerel && ninja - name: Packaging Linux if: matrix.target == 'linux' run: | tar -I 'pigz -9' -cf buildscript-debug-amd64.tar.gz --transform 's,^,build-script/,' build/debug/build_script LICENSE tar -I 'pigz -9' -cf buildscript-release-amd64.tar.gz --transform 's,^,build-script/,' build/release/build_script LICENSE tar -I 'pigz -9' -cf buildscript-relwithdeb-amd64.tar.gz --transform 's,^,build-script/,' build/relwithdeb/build_script LICENSE tar -I 'pigz -9' -cf buildscript-minsizerel-amd64.tar.gz --transform 's,^,build-script/,' build/minsizerel/build_script LICENSE - name: Packaging Windows if: matrix.target == 'windows' run: | sudo apt-get install zip -y zip -r9 buildscript-debug-x64.zip build/debug/build_script.exe LICENSE zip -r9 buildscript-release-x64.zip build/release/build_script.exe LICENSE zip -r9 buildscript-relwithdeb-x64.zip build/relwithdeb/build_script.exe LICENSE zip -r9 buildscript-minsizerel-x64.zip build/minsizerel/build_script.exe LICENSE - name: Upload Release Assets uses: akkuman/gitea-release-action@v1 with: files: |- buildscript-debug-*.${{ matrix.pack_ext }} buildscript-release-*.${{ matrix.pack_ext }} buildscript-relwithdeb-*.${{ matrix.pack_ext }} buildscript-minsizerel-*.${{ matrix.pack_ext }}