name: CI on: push: branches: [main] pull_request: branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] build_type: [Debug, Release] runs-on: ${{ matrix.os }} name: ${{ matrix.os }} (${{ matrix.build_type }}) steps: - name: Checkout uses: actions/checkout@v4 - name: Cache FetchContent dependencies uses: actions/cache@v4 with: path: build/_deps key: deps-${{ runner.os }}-${{ runner.arch }}-x64-${{ hashFiles('CMakeLists.txt') }} restore-keys: | deps-${{ runner.os }}-${{ runner.arch }}-x64- - name: Configure (Unix) if: runner.os != 'Windows' run: > cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DFASTMCPP_BUILD_TESTS=ON -DFASTMCPP_BUILD_EXAMPLES=ON - name: Configure (Windows) if: runner.os == 'Windows' run: | if (Test-Path build) { Remove-Item -Recurse -Force build/CMakeCache.txt, build/CMakeFiles -ErrorAction SilentlyContinue } cmake -B build -S . -G "Visual Studio 17 2022" -A x64 -DFASTMCPP_BUILD_TESTS=ON -DFASTMCPP_BUILD_EXAMPLES=ON - name: Build (Unix) if: runner.os != 'Windows' run: cmake --build build --config ${{ matrix.build_type }} --parallel 2 - name: Build (Windows) if: runner.os == 'Windows' # Single-threaded build to avoid C1060 "compiler out of heap space" on GitHub's 16GB Windows runners # Even /m:4 exhausts heap with deeply nested JSON initializers in test files run: cmake --build build --config ${{ matrix.build_type }} -- /m:1 /p:CL_MPCount=1 - name: Test run: ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure