Skip to content

Commit 01d7a7a

Browse files
committed
Add Codecov integration
1 parent e4971b6 commit 01d7a7a

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

.github/workflows/run_cpp_tests.yml

Lines changed: 34 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,45 @@ 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 pipx
35+
pipx install gcovr
36+
37+
- name: Configure for tests
38+
if: runner.os == 'macOS'
3339
run: |
3440
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_MEX=False -DBUILD_TESTS=True
3541
42+
- name: Configure for coverage
43+
if: runner.os == 'Linux'
44+
run: |
45+
cmake -S. -Bbuild -DBUILD_MEX=False -DCHECK_COVERAGE=True
46+
3647
- name: Build
3748
run: |
3849
cmake --build build
3950
4051
- name: Run tests
52+
if: runner.os == 'macOS'
53+
working-directory: ./build
4154
run: |
42-
cd build
43-
ctest -C Release --output-on-failure --verbose
55+
ctest -C Release --output-on-failure --verbose
56+
57+
- name: Generate coverage report
58+
if: runner.os == 'Linux'
59+
working-directory: ./build
60+
run: |
61+
make coverage
62+
gcovr -r .. . --txt-metric branch --cobertura > coverage.xml
63+
64+
- uses: codecov/codecov-action@v5
65+
if: runner.os == 'Linux'
66+
with:
67+
files: coverage.xml
68+
verbose: true
69+
env:
70+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)