Skip to content

Commit 42af752

Browse files
committed
Coverage report for sonarqube
1 parent f751a0d commit 42af752

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/workflows/sonar-build.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,31 @@ jobs:
1818
- uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
21+
- name: Set up Python 3.12 for gcovr
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.12'
25+
- name: install gcovr
26+
run: |
27+
python -m pip install gcovr
2128
- name: Install Build Wrapper
2229
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v5
2330
- name: Run Build Wrapper
2431
run: |
25-
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --workflow --preset release
32+
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --workflow --preset coverage
33+
- name: Run tests to generate coverage statistics
34+
run: |
35+
ctest --test-dir build/coverage/fsb-core/test
36+
ctest --test-dir build/coverage/fsb-posix/test
37+
ctest --test-dir build/coverage/fsb-urdf/test
38+
- name: Collect coverage into one XML report
39+
run: |
40+
gcovr --sonarqube > coverage.xml
2641
- name: SonarQube Scan
2742
uses: SonarSource/sonarqube-scan-action@v5
2843
env:
2944
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3045
with:
3146
args: >
32-
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
47+
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
48+
--define sonar.coverageReportPaths=coverage.xml

0 commit comments

Comments
 (0)