Skip to content

Commit 0267ea7

Browse files
committed
try with gcov
1 parent 8283fd0 commit 0267ea7

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ jobs:
4444
make -j4
4545
sudo make install
4646
47-
- name: Install lcov
47+
- name: Install lcov and gcovr
4848
run: |
49-
sudo apt-get -y install lcov
49+
sudo apt-get -y install lcov gcovr
5050
5151
- name: Run tests, compute coverage
5252
env:
@@ -59,11 +59,10 @@ jobs:
5959
cmake ..
6060
make -j4
6161
sudo make install
62-
make -j4 examples
62+
make -j4 unit_tests examples
63+
./unit_tests
6364
./examples/open_seek_write
6465
./examples/jbod
65-
make -j4 unit_tests
66-
./unit_tests
6766
lcov --directory . --directory examples/ --capture --output-file coverage.info
6867
lcov --remove coverage.info '*/test/*' '*/examples/*' '*/include/*'
6968
bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_TOKEN}
@@ -86,12 +85,23 @@ jobs:
8685
mkdir build
8786
cmake -S . -B build
8887
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release
88+
- name: Run tests to generate coverage statistics
89+
run: |
90+
cd build
91+
make -j4 unit_tests examples
92+
./unit_tests
93+
./examples/open_seek_write
94+
./examples/jbod
95+
- name: Collect coverage into one XML report
96+
run: |
97+
gcovr --sonarqube > coverage.xml
8998
- name: Run sonar-scanner
9099
env:
91100
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92101
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
93102
run: |
94-
sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
103+
sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" \
104+
--define sonar.coverageReportPaths=coverage.xml
95105
96106
- name: Install Doxygen and Sphinx
97107
run: |

sonar-project.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ sonar.issue.ignore.multicriteria.c2.resourceKey=test/*.cpp
2525
# tests are expected to be somehow repetitive
2626
sonar.cpd.exclusions=test/**
2727

28-
sonar.cfamily.gcov.reportsPath=build/coverage.info
29-
3028
# Encoding of the source files
3129
sonar.sourceEncoding=UTF-8
3230

0 commit comments

Comments
 (0)