@@ -18,24 +18,26 @@ concurrency:
1818jobs :
1919 sonarcloud :
2020 name : SonarCloud
21- runs-on : ubuntu-latest
21+ runs-on : ubuntu-24.04
22+ container : silkeh/clang:18
2223 env :
2324 BUILD_WRAPPER_OUT_DIR : build_wrapper_output_directory # Directory where build-wrapper output will be placed
2425 steps :
2526 - uses : actions/checkout@v4
2627 with :
2728 fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
2829
29- - name : Install gcovr
30- run : pip install gcovr==7.2
31-
32- - name : Install sonar-scanner and build-wrapper
33- uses : SonarSource/sonarcloud-github-c-cpp@v3
30+ - name : Install Prerequisites
31+ run : |
32+ apt-get update
33+ apt-get install -y \
34+ ccache \
35+ unzip
3436
3537 - name : Install CMake
36- uses : lukka/get-cmake@latest
38+ uses : lukka/get-cmake@v3.30.5
3739 with :
38- cmakeVersion : 3.27.1
40+ cmakeVersion : 3.30.5
3941 ninjaVersion : 1.11.1
4042
4143 - name : Setup CCache
@@ -45,43 +47,62 @@ jobs:
4547 max-size : 100M
4648
4749 - name : Configure CMake
50+ env :
51+ CXXFLAGS : -DNUCLEAR_TEST_TIME_UNIT_DEN=10
4852 run : |
4953 cmake -E make_directory build
5054 cmake -S . -B build \
5155 -GNinja \
52- -DCMAKE_CXX_FLAGS="--coverage" \
5356 -DCMAKE_C_COMPILER_LAUNCHER=ccache \
5457 -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
58+ -DCMAKE_C_COMPILER=clang \
59+ -DCMAKE_CXX_COMPILER=clang++ \
60+ -DCMAKE_BUILD_TYPE=Release \
5561 -DBUILD_TESTS=ON \
56- -DCMAKE_BUILD_TYPE=Debug \
5762 -DCI_BUILD=ON \
63+ -DENABLE_COVERAGE=ON \
5864 -DENABLE_CLANG_TIDY=OFF
5965
60- - name : Build the code in debug mode
66+ - name : Build the code
6167 timeout-minutes : 30
62- run : cmake --build build/ --config Debug
68+ run : cmake --build build/ --config Release
6369
6470 - name : Run tests to generate coverage statistics
6571 timeout-minutes : 10
66- working-directory : build/tests
67- run : ctest --output-on-failure
72+ working-directory : build
73+ run : ninja coverage -k 0
6874
69- - name : Collect coverage into one XML report
70- if : always()
71- run : gcovr --gcov-ignore-parse-errors=negative_hits.warn_once_per_file --exclude-unreachable-branches --exclude-noncode-lines --sonarqube > coverage.xml
75+ - name : Test Summary
76+ if : ${{ !cancelled() }}
77+ uses : test-summary/action@v2
78+ with :
79+ paths : " build/reports/tests/*.junit.xml"
7280
73- - name : Run sonar-scanner
74- if : always()
81+ - name : Upload coverage report
82+ if : ${{ !cancelled() }}
83+ uses : actions/upload-artifact@v4
84+ with :
85+ name : coverage
86+ path : build/reports/coverage.txt
87+ retention-days : 1 # This sets the artifact TTL to 1 day (minimum is 1 day)
88+ overwrite : true
89+
90+ - name : SonarQube Scan
91+ uses : SonarSource/sonarqube-scan-action@v5
92+ if : ${{ !cancelled() }}
7593 env :
76- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7794 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
78- run : |
79- sonar-scanner \
80- --define sonar.cfamily.compile-commands=build/compile_commands.json \
81- --define sonar.coverageReportPaths=coverage.xml
95+ with :
96+ args : >
97+ --define sonar.projectKey=Fastcode_NUClear
98+ --define sonar.organization=fastcode
99+ --define sonar.sources=src
100+ --define sonar.tests=tests
101+ --define sonar.cfamily.compile-commands=build/compile_commands.json
102+ --define sonar.cfamily.llvm-cov.reportPath=build/reports/coverage.txt
82103
83104 - name : Upload Traces
84- if : always()
105+ if : ${{ !cancelled() }}
85106 uses : actions/upload-artifact@v4
86107 with :
87108 name : traces-sonar
0 commit comments