-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (58 loc) · 1.83 KB
/
reusable-cpp-coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: 🇨 • Coverage
on:
workflow_call:
inputs:
cmake-args:
description: "Additional arguments to pass to CMake"
default: "-G Ninja"
type: string
setup-z3:
description: "Whether to set up Z3"
default: false
type: boolean
z3-version:
description: "The version of Z3 to set up"
default: "4.13.0"
type: string
jobs:
coverage:
name: 📈 Coverage
runs-on: ubuntu-latest
permissions:
contents: read # Required for the `actions/checkout` action
id-token: write # Required for the `codecov/codecov-action` action
env:
CMAKE_BUILD_PARALLEL_LEVEL: 4
CTEST_PARALLEL_LEVEL: 4
FORCE_COLOR: 3
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- if: ${{ inputs.setup-z3 }}
name: Setup Z3
uses: cda-tum/setup-z3@v1
with:
version: ${{ inputs.z3-version }}
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
prepend_symlinks_to_path: false
override_cache_key: c++-coverage
- name: Set up mold as linker
uses: rui314/setup-mold@v1
- name: Install Ninja
run: pipx install ninja
- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ${{ inputs.cmake-args }}
- name: Build
run: cmake --build build --config Debug
- name: Test
run: ctest -C Debug --output-on-failure --test-dir build --repeat until-pass:3 --timeout 600
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
flags: cpp
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}