Update CI and Catch #143
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| push: | |
| branches: [ "main" ] | |
| env: | |
| BUILD_TYPE: Debug | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| # GCC on Ubuntu 22.04 (older GCC versions) | |
| - os: ubuntu-22.04 | |
| compiler: g++-10 | |
| - os: ubuntu-22.04 | |
| compiler: g++-11 | |
| - os: ubuntu-22.04 | |
| compiler: g++-12 | |
| # GCC on Ubuntu 24.04 (newer GCC versions) | |
| - os: ubuntu-24.04 | |
| compiler: g++-13 | |
| - os: ubuntu-24.04 | |
| compiler: g++-14 | |
| extra_build_flags: -DENABLE_COVERAGE:BOOL=ON # coverage build | |
| # Clang on Ubuntu 22.04 (older Clang versions) | |
| - os: ubuntu-22.04 | |
| compiler: clang++-13 | |
| - os: ubuntu-22.04 | |
| compiler: clang++-14 | |
| - os: ubuntu-22.04 | |
| compiler: clang++-15 | |
| # Clang on Ubuntu 24.04 (newer Clang versions) | |
| - os: ubuntu-24.04 | |
| compiler: clang++-16 | |
| - os: ubuntu-24.04 | |
| compiler: clang++-17 | |
| - os: ubuntu-24.04 | |
| compiler: clang++-18 | |
| - os: ubuntu-24.04 | |
| compiler: clang++-19 | |
| install: clang-19 | |
| # GCC on macOS | |
| - os: macos-15 | |
| compiler: g++-13 | |
| - os: macos-15 | |
| compiler: g++-15 | |
| # AppleClang on macOS | |
| - os: macos-15 | |
| comp: AppleClang # default compiler, unused var to show in GH UI | |
| runs-on: ${{matrix.os}} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 # Codecov requests >1 | |
| - name: Install compiler | |
| if: ${{matrix.install}} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install ${{matrix.install}} | |
| - name: Determine number of cpus on Linux | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: echo "num_cpus=$(nproc)" >> $GITHUB_ENV # TODO use set-output instead | |
| - name: Determine number of cpus on macOS | |
| if: startsWith(matrix.os, 'macos') | |
| run: echo "num_cpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV # TODO use set-output instead | |
| - name: Determine compiler flag | |
| if: ${{matrix.compiler}} | |
| run: echo "CXX=${{matrix.compiler}}" >> $GITHUB_ENV | |
| - name: Configure CMake | |
| run: cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${BUILD_TYPE} | |
| ${{matrix.extra_build_flags}} | |
| - name: Build | |
| working-directory: ${{github.workspace}}/build | |
| run: cmake --build . --config ${BUILD_TYPE} --parallel ${num_cpus} | |
| - name: Test | |
| working-directory: ${{github.workspace}}/build | |
| run: cmake --build . --config ${BUILD_TYPE} --target test | |
| ARGS=-j$((${num_cpus} * 2)) # don't pass --parallel, which would affect compilation tests, | |
| # but do run twice as many compilation tests as the number of | |
| # available threads | |
| - name: Produce coverage reports | |
| if: contains(matrix.extra_build_flags, 'coverage') | |
| working-directory: ${{github.workspace}}/build | |
| run: | | |
| echo "Producing coverage reports..." | |
| find . -name catch_tests.cpp.gcno -exec gcov-14 -p {} + | |
| echo "Finding relevant report..." | |
| cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +) | |
| echo "COV_REPORT=$cov_report" >> $GITHUB_ENV | |
| - name: Codecov | |
| if: contains(matrix.extra_build_flags, 'coverage') | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ${{ env.COV_REPORT }} | |
| disable_search: true | |
| flags: unittests | |
| fail_ci_if_error: 'true' |