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,50 @@ jobs:
2926 make -j $(nproc)
3027 sudo make install
3128
32- - name : Configure
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+
41+ - name : Configure for build
42+ if : runner.os == 'macOS'
3343 run : |
3444 cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_MEX=False -DBUILD_TESTS=True
3545
46+ - name : Configure for coverage
47+ if : runner.os == 'Linux'
48+ run : |
49+ cmake -S. -Bbuild -DBUILD_MEX=False -DCHECK_COVERAGE=True
50+
3651 - name : Build
3752 run : |
3853 cmake --build build
3954
4055 - name : Run tests
56+ if : runner.os == 'macOS'
57+ working-directory : ./build
58+ run : |
59+ ctest -C Release --output-on-failure --verbose
60+
61+ - name : Generate coverage report
62+ if : runner.os == 'Linux'
63+ working-directory : ./build
4164 run : |
42- cd build
43- ctest -C Release --output-on-failure --verbose
65+ make coverage
66+ gcovr -r .. . --txt-metric branch --cobertura > coverage.xml
67+
68+ - uses : codecov/codecov-action@v5
69+ if : runner.os == 'Linux'
70+ with :
71+ working-directory : ./build
72+ files : coverage.xml
73+ verbose : true
74+ env :
75+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
0 commit comments