@@ -146,12 +146,12 @@ jobs:
146
146
eatmydata apt install clang-format-${{ inputs.compiler-version }} clang-tidy-${{ inputs.compiler-version }}
147
147
148
148
eatmydata apt install curl gpg
149
- echo 'deb https://ftp.gwdg.de//pub/opensuse/repositories/graphics%3A/darktable%3A/master/Debian_Unstable/ /' | tee /etc/apt/sources.list
149
+ echo 'deb https://ftp.gwdg.de//pub/opensuse/repositories/graphics%3A/darktable%3A/master/Debian_Unstable/ /' | tee /etc/apt/sources.list.d/rawspeed.list
150
150
curl -fsSL https://download.opensuse.org/repositories/graphics:darktable:master/Debian_Unstable/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/graphics_darktable_master.gpg > /dev/null
151
151
apt update
152
152
eatmydata apt install rawspeed-clang-tidy-module
153
153
fi
154
- if [ "$FLAVOR" = "ClangStaticAnalysis" ] || [ "$FLAVOR" = "ClangCTUStaticAnalysis" ]; then
154
+ if [ "$FLAVOR" = "ClangTidy" ] || [ "$FLAVOR" = " ClangStaticAnalysis" ] || [ "$FLAVOR" = "ClangCTUStaticAnalysis" ]; then
155
155
eatmydata apt install clang-tools-${{ inputs.compiler-version }} \
156
156
curl \
157
157
libxml2-dev \
@@ -171,7 +171,7 @@ jobs:
171
171
fi
172
172
eatmydata apt clean
173
173
dpkg-divert --add --rename --divert /usr/bin/ld.original /usr/bin/ld
174
- if [ "$FLAVOR" = "ClangStaticAnalysis" ] || [ "$FLAVOR" = "ClangCTUStaticAnalysis" ]; then
174
+ if [ "$FLAVOR" = "ClangTidy" ] || [ "$FLAVOR" = " ClangStaticAnalysis" ] || [ "$FLAVOR" = "ClangCTUStaticAnalysis" ]; then
175
175
ln -s /usr/bin/${{ inputs.compiler-CC }} /usr/local/bin/clang
176
176
ln -s /usr/bin/${{ inputs.compiler-CXX }} /usr/local/bin/clang++
177
177
ln -s /usr/bin/${{ inputs.compiler-CC }} /usr/local/bin/gcc
@@ -201,15 +201,15 @@ jobs:
201
201
fail-on-cache-miss : true
202
202
- name : Fetch/Checkout CodeChecker git repo (for clang static analysis)
203
203
timeout-minutes : 1
204
- if : inputs.flavor == 'ClangStaticAnalysis' || inputs.flavor == 'ClangCTUStaticAnalysis'
204
+ if : inputs.flavor == 'ClangTidy' || inputs.flavor == ' ClangStaticAnalysis' || inputs.flavor == 'ClangCTUStaticAnalysis'
205
205
uses : actions/checkout@v4
206
206
with :
207
207
repository : ' Ericsson/codechecker'
208
208
path : ' codechecker'
209
209
fetch-depth : ' 1'
210
210
- name : Install CodeChecker (for clang static analysis)
211
211
timeout-minutes : 1
212
- if : inputs.flavor == 'ClangStaticAnalysis' || inputs.flavor == 'ClangCTUStaticAnalysis'
212
+ if : inputs.flavor == 'ClangTidy' || inputs.flavor == ' ClangStaticAnalysis' || inputs.flavor == 'ClangCTUStaticAnalysis'
213
213
env :
214
214
CC : ${{ inputs.compiler-CC }}
215
215
CXX : ${{ inputs.compiler-CXX }}
@@ -269,14 +269,18 @@ jobs:
269
269
BUILD_DIR : ${{ github.workspace }}/rawspeed-build
270
270
INSTALL_PREFIX : ${{ github.workspace }}/rawspeed-install
271
271
RPUU_DST : ${{ env.RPUU_DST }}
272
- ECO : ${{ inputs.ECO }} -DALLOW_DOWNLOADING_GOOGLETEST=ON -DALLOW_DOWNLOADING_GOOGLEBENCHMARK=ON -DUSE_CLANG_TIDY=${{ inputs.flavor == 'ClangTidy' }} -DRAWSPEED_ENABLE_SAMPLE_BASED_TESTING=${{ inputs.enable-sample-based-testing }}
272
+ ECO : ${{ inputs.ECO }} -DALLOW_DOWNLOADING_GOOGLETEST=ON -DALLOW_DOWNLOADING_GOOGLEBENCHMARK=ON -DUSE_CLANG_TIDY=${{ inputs.flavor == 'ClangTidy' }} -DRAWSPEED_ENABLE_CLANG_TIDY_WERROR=OFF - DRAWSPEED_ENABLE_SAMPLE_BASED_TESTING=${{ inputs.enable-sample-based-testing }}
273
273
FLAVOR : ${{ inputs.flavor }}
274
274
TARGET : configure
275
275
run : |
276
276
set -xe
277
277
cmake -E make_directory "${BUILD_DIR}"
278
278
cmake -E make_directory "${INSTALL_PREFIX}"
279
279
export ECO="${ECO} -DRAWSPEED_REFERENCE_SAMPLE_ARCHIVE=${RPUU_DST}"
280
+ export ECO="${ECO} -DCMAKE_CXX_CLANG_TIDY_EXPORT_FIXES_DIR=${BUILD_DIR}/clang-tidy/"
281
+ if [ "$FLAVOR" = "ClangTidy" ] || [ "$FLAVOR" = "ClangStaticAnalysis" ] || [ "$FLAVOR" = "ClangCTUStaticAnalysis" ] || [ "$FLAVOR" = "CodeQLAnalysis" ]; then
282
+ export ECO="${ECO} -DRAWSPEED_ENABLE_WERROR=OFF"
283
+ fi
280
284
"${SRC_DIR}/.ci/ci-script.sh"
281
285
- name : Build
282
286
timeout-minutes : ${{ inputs.flavor != 'ClangTidy' && (inputs.flavor != 'CodeQLAnalysis' && 7 || 12) || 25 }}
@@ -388,6 +392,54 @@ jobs:
388
392
run : |
389
393
set -xe
390
394
"${SRC_DIR}/.ci/ci-script.sh"
395
+ - name : Perform clang-tidy static analysis
396
+ timeout-minutes : 1
397
+ if : inputs.flavor == 'ClangTidy' && !cancelled()
398
+ env :
399
+ SRC_DIR : ${{ github.workspace }}/rawspeed
400
+ BUILD_DIR : ${{ github.workspace }}/rawspeed-build
401
+ CC : ${{ inputs.compiler-CC }}
402
+ CXX : ${{ inputs.compiler-CXX }}
403
+ id : CC-CTSA
404
+ run : |
405
+ set -xe
406
+ . "$PWD/codechecker/venv/bin/activate"
407
+ export PATH="$PWD/codechecker/build/CodeChecker/bin:$PATH"
408
+ set +e
409
+ report-converter -t clang-tidy-yaml -o "${BUILD_DIR}/codechecker_clangtidy_results" "${BUILD_DIR}/clang-tidy/"
410
+ CodeChecker parse -e sarif "${BUILD_DIR}/codechecker_clangtidy_results" -o "${GITHUB_WORKSPACE}/codechecker_clangtidy_report.json"
411
+ CodeChecker parse -e html "${BUILD_DIR}/codechecker_clangtidy_results" -o "${GITHUB_WORKSPACE}/codechecker_clangtidy_report"
412
+ bugs=$?
413
+ set -xe
414
+ [ $bugs -eq 0 ] || exit 1
415
+ - name : Upload results of clang-tidy static analysis [YAML]
416
+ timeout-minutes : 1
417
+ if : inputs.flavor == 'ClangTidy' && failure() && steps.CC-CTSA.conclusion == 'failure'
418
+ uses : actions/upload-artifact@v4
419
+ with :
420
+ name : clangtidy_report
421
+ path : ${{ github.workspace }}/rawspeed-build/clang-tidy/
422
+ if-no-files-found : error
423
+ compression-level : 9
424
+ overwrite : true
425
+ - name : Upload results of clang-tidy static analysis [SARIF]
426
+ timeout-minutes : 1
427
+ if : inputs.flavor == 'ClangTidy' && failure() && steps.CC-CTSA.conclusion == 'failure'
428
+ uses : github/codeql-action/upload-sarif@v3
429
+ with :
430
+ sarif_file : " ${{ github.workspace }}/codechecker_clangtidy_report.json"
431
+ checkout_path : " ${{ github.workspace }}/rawspeed"
432
+ category : CodeChecker-CTSA
433
+ - name : Upload results of clang-tidy static analysis [HTML]
434
+ timeout-minutes : 1
435
+ if : inputs.flavor == 'ClangTidy' && failure() && steps.CC-CTSA.conclusion == 'failure'
436
+ uses : actions/upload-artifact@v4
437
+ with :
438
+ name : codechecker_clangtidy_report
439
+ path : ${{ github.workspace }}/codechecker_clangtidy_report/
440
+ if-no-files-found : error
441
+ compression-level : 9
442
+ overwrite : true
391
443
- name : Perform clang static analysis (plain mode)
392
444
timeout-minutes : 25
393
445
if : inputs.flavor == 'ClangStaticAnalysis'
@@ -466,7 +518,7 @@ jobs:
466
518
overwrite : true
467
519
- name : Perform CodeQL static analysis
468
520
timeout-minutes : 11
469
- if : inputs.flavor == 'CodeQLAnalysis'
521
+ if : inputs.flavor == 'CodeQLAnalysis' && !cancelled()
470
522
uses : github/codeql-action/analyze@v3
471
523
- name : Perform SonarCloud static analysis
472
524
timeout-minutes : 6
0 commit comments