Skip to content

Coverage

Coverage #455

Workflow file for this run

name: Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
name: Coverage C++${{ matrix.cxx }}
runs-on: ubuntu-22.04
strategy:
matrix:
cxx: [20, 23]
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update -y
sudo apt install -y ninja-build gcovr
- name: CMake configure
run: >
cmake -S .
-B build
-G Ninja
-D CMAKE_CXX_STANDARD="${{ matrix.cxx }}"
-D CMAKE_BUILD_TYPE=Debug
-D TETL_BUILD_CONTRACT_CHECKS=OFF
-D TETL_BUILD_COVERAGE=ON
- name: CMake build
run: cmake --build build
- name: CTest
run: ctest --test-dir build -C Debug --output-on-failure
- name: Coverage Report
run: >
gcovr --xml-pretty
--exclude-unreachable-branches
-s build
-o build/coverage.xml
-r include
-j 2
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage.xml
fail_ci_if_error: true