Add sanitizer coverage and perf workflows #2
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| env: | |
| CTEST_OUTPUT_ON_FAILURE: "1" | |
| jobs: | |
| sanitizers: | |
| name: ${{ matrix.compiler }}-${{ matrix.sanitizer }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: [gcc, clang] | |
| sanitizer: [address, undefined, thread] | |
| include: | |
| - compiler: gcc | |
| c: gcc | |
| cxx: g++ | |
| - compiler: clang | |
| c: clang | |
| cxx: clang++ | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Configure CMake | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_COMPILER=${{ matrix.c }} \ | |
| -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ | |
| -DCMAKE_C_FLAGS="-O1 -g -fno-omit-frame-pointer -fno-common -fsanitize=${{ matrix.sanitizer }}" \ | |
| -DCMAKE_CXX_FLAGS="-O1 -g -fno-omit-frame-pointer -fno-common -fsanitize=${{ matrix.sanitizer }}" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=${{ matrix.sanitizer }}" | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Test | |
| run: ctest --test-dir build --output-on-failure | |
| env: | |
| ASAN_OPTIONS: detect_leaks=0 | |
| UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 | |
| TSAN_OPTIONS: halt_on_error=1 | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install gcovr | |
| run: python3 -m pip install --user gcovr | |
| - name: Configure CMake (coverage) | |
| env: | |
| CC: gcc | |
| CXX: g++ | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_COMPILER=gcc \ | |
| -DCMAKE_CXX_COMPILER=g++ \ | |
| -DCMAKE_C_FLAGS="--coverage -O0" \ | |
| -DCMAKE_CXX_FLAGS="--coverage -O0" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="--coverage" | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Run tests with coverage | |
| run: ctest --test-dir build --output-on-failure | |
| - name: Generate coverage report | |
| run: | | |
| ~/.local/bin/gcovr --root . --object-directory build --txt --output coverage-summary.txt | |
| ~/.local/bin/gcovr --root . --object-directory build --xml-pretty --output coverage.xml | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-reports | |
| path: | | |
| coverage-summary.txt | |
| coverage.xml | |
| perf: | |
| uses: ./.github/workflows/perf-smoke.yml | |
| with: | |
| threshold_ns: 300 |