Skip to content

Commit d7b94b6

Browse files
committed
Add Codecov integration
1 parent e4971b6 commit d7b94b6

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

.github/workflows/run_cpp_tests.yml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
os: [ubuntu-latest , macos-latest]
15-
defaults:
16-
run:
17-
shell: bash -l {0}
14+
os: [ubuntu-latest, macos-latest]
1815

1916
steps:
2017
- uses: actions/checkout@v4
@@ -29,15 +26,46 @@ jobs:
2926
make -j $(nproc)
3027
sudo make install
3128
32-
- name: Configure
29+
- name: Install coverage tools
30+
if: runner.os == 'Linux'
31+
run: |
32+
sudo apt update
33+
sudo apt install lcov
34+
sudo apt install python3-coverage
35+
sudo apt install pipx
36+
pipx install gcovr
37+
38+
- name: Configure for tests
39+
if: runner.os == 'macOS'
3340
run: |
3441
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_MEX=False -DBUILD_TESTS=True
3542
43+
- name: Configure for coverage
44+
if: runner.os == 'Linux'
45+
run: |
46+
cmake -S. -Bbuild -DBUILD_MEX=False -DCHECK_COVERAGE=True
47+
3648
- name: Build
3749
run: |
3850
cmake --build build
3951
4052
- name: Run tests
53+
if: runner.os == 'macOS'
54+
working-directory: ./build
4155
run: |
42-
cd build
43-
ctest -C Release --output-on-failure --verbose
56+
ctest -C Release --output-on-failure --verbose
57+
58+
- name: Generate coverage report
59+
if: runner.os == 'Linux'
60+
working-directory: ./build
61+
run: |
62+
make coverage
63+
gcovr -r .. . --txt-metric branch --cobertura > coverage.xml
64+
65+
- uses: codecov/codecov-action@v5
66+
if: runner.os == 'Linux'
67+
with:
68+
files: ./build/coverage.xml
69+
verbose: true
70+
env:
71+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)