-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (37 loc) · 1.13 KB
/
Copy pathcoverage.yml
File metadata and controls
45 lines (37 loc) · 1.13 KB
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
name: Code Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake lcov
- name: Configure with coverage
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="--coverage -fprofile-arcs -ftest-coverage" \
-DZTASK_BUILD_TESTS=ON
- name: Build
run: cmake --build build -j$(nproc)
- name: Run tests
run: cd build && ctest --output-on-failure
- name: Generate coverage report
run: |
cd build
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/tests/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./build/coverage.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false