Skip to content

Commit 066d52b

Browse files
committed
Add Codecov integration
1 parent e4971b6 commit 066d52b

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

.github/workflows/run_cpp_tests.yml

Lines changed: 30 additions & 6 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,6 +26,18 @@ jobs:
2926
make -j $(nproc)
3027
sudo make install
3128
29+
- name: Install lcov
30+
if: runner.os == 'Linux'
31+
run: |
32+
sudo apt update
33+
sudo apt install lcov
34+
35+
- name: Install gcovr
36+
if: runner.os == 'Linux'
37+
run: |
38+
sudo apt install pipx
39+
pipx install gcovr
40+
3241
- name: Configure
3342
run: |
3443
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_MEX=False -DBUILD_TESTS=True
@@ -38,6 +47,21 @@ jobs:
3847
cmake --build build
3948
4049
- name: Run tests
50+
working-directory: ./build
4151
run: |
42-
cd build
43-
ctest -C Release --output-on-failure --verbose
52+
ctest -C Release --output-on-failure --verbose
53+
54+
- name: Generate coverage report
55+
working-directory: ./build
56+
run: |
57+
make coverage
58+
gcovr -r .. . --txt-metric branch --cobertura > coverage.xml
59+
60+
- uses: codecov/codecov-action@v5
61+
with:
62+
if: runner.os == 'Linux'
63+
working-directory: ./build
64+
files: coverage.xml
65+
verbose: true
66+
env:
67+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)