@@ -137,7 +137,8 @@ jobs:
137137 fi
138138 if [ "$COMPILER_FAMILY" = "LLVM" ]; then
139139 eatmydata apt install clang-${{ inputs.compiler-version }} \
140- libomp-${{ inputs.compiler-version }}-dev
140+ libomp-${{ inputs.compiler-version }}-dev \
141+ python3
141142 fi
142143 if [ "$ENABLE_SAMPLE_BASED_TESTING" = "true" ]; then
143144 eatmydata apt install zstd
@@ -228,6 +229,7 @@ jobs:
228229 uses : github/codeql-action/init@v3
229230 with :
230231 languages : cpp
232+ source-root : ${{ github.workspace }}/rawspeed
231233 - name : Set up JDK 11 (for SonarCloud static analysis)
232234 timeout-minutes : 1
233235 if : inputs.flavor == 'SonarCloudStaticAnalysis' && github.repository == 'darktable-org/rawspeed' && github.event_name != 'pull_request' && github.ref_type == 'branch' && (github.ref_name == 'develop' || github.ref_name == 'stable')
@@ -264,6 +266,7 @@ jobs:
264266 env :
265267 CC : ${{ inputs.compiler-CC }}
266268 CXX : ${{ inputs.compiler-CXX }}
269+ FAMILY : ${{ inputs.compiler-family }}
267270 CLANG_TIDY : ${{ inputs.compiler-CLANG_TIDY }}
268271 GCOV : ${{ inputs.compiler-GCOV }}
269272 SRC_DIR : ${{ github.workspace }}/rawspeed
@@ -279,14 +282,16 @@ jobs:
279282 cmake -E make_directory "${INSTALL_PREFIX}"
280283 export ECO="${ECO} -DRAWSPEED_REFERENCE_SAMPLE_ARCHIVE=${RPUU_DST}"
281284 export ECO="${ECO} -DCMAKE_CXX_CLANG_TIDY_EXPORT_FIXES_DIR=${BUILD_DIR}/clang-tidy/"
282- if [ "$FLAVOR " = "ClangTidy" ] || [ "$FLAVOR" = "ClangStaticAnalysis" ] || [ "$FLAVOR" = "ClangCTUStaticAnalysis" ] || [ "$FLAVOR" = "CodeQLAnalysis " ]; then
285+ if [ "$FAMILY " = "LLVM " ]; then
283286 export ECO="${ECO} -DRAWSPEED_ENABLE_WERROR=OFF"
287+ export ECO="${ECO} -DCMAKE_CXX_COMPILER_LAUNCHER='${SRC_DIR}/.ci/clang-sarif-wrapper.sh;${GITHUB_WORKSPACE}/clang_report/'"
284288 fi
285289 "${SRC_DIR}/.ci/ci-script.sh"
286290 - name : Build
287291 id : build
288292 timeout-minutes : ${{ inputs.flavor != 'ClangTidy' && (inputs.flavor != 'CodeQLAnalysis' && 7 || 12) || 25 }}
289293 env :
294+ FAMILY : ${{ inputs.compiler-family }}
290295 SRC_DIR : ${{ github.workspace }}/rawspeed
291296 BUILD_DIR : ${{ github.workspace }}/rawspeed-build
292297 INSTALL_PREFIX : ${{ github.workspace }}/rawspeed-install
@@ -295,6 +300,28 @@ jobs:
295300 run : |
296301 set -xe
297302 "${SRC_DIR}/.ci/ci-script.sh"
303+ if [ "$FLAVOR" = "ClangTidy" ] || [ "$FLAVOR" = "ClangStaticAnalysis" ] || [ "$FLAVOR" = "ClangCTUStaticAnalysis" ] || [ "$FLAVOR" = "CodeQLAnalysis" ]; then
304+ exit 0
305+ else
306+ MARKER="${GITHUB_WORKSPACE}/clang_report/.warnings"
307+ [ -f "$MARKER" ] && exit 1 || exit 0
308+ fi
309+ - name : Merge clang SARIF reports
310+ if : inputs.compiler-family == 'LLVM' && !cancelled() && steps.build.conclusion != 'skipped'
311+ timeout-minutes : 1
312+ env :
313+ SRC_DIR : ${{ github.workspace }}/rawspeed
314+ run : |
315+ set -xe
316+ "${SRC_DIR}/.ci/clang-sarif-merge.py" --output="${GITHUB_WORKSPACE}/clang_report.json" "${GITHUB_WORKSPACE}/clang_report/"
317+ - name : Upload results of clang compile [SARIF]
318+ timeout-minutes : 1
319+ if : inputs.compiler-family == 'LLVM' && !cancelled() && steps.build.conclusion != 'skipped'
320+ uses : github/codeql-action/upload-sarif@v3
321+ with :
322+ sarif_file : " ${{ github.workspace }}/clang_report.json"
323+ checkout_path : " ${{ github.workspace }}/rawspeed"
324+ category : ${{ job.name }}
298325 - name : Test (unit tests)
299326 timeout-minutes : 1
300327 env :
0 commit comments