@@ -223,11 +223,13 @@ jobs:
223223 BUILD_LOGGER_64_BIT_ONLY=YES BUILD_UI_DIST=NO make package
224224 export PATH="$PWD/build/CodeChecker/bin:$PATH"
225225 - name : Initialize CodeQL (for CodeQL static analysis)
226+ id : codeql-init
226227 timeout-minutes : 1
227228 if : inputs.flavor == 'CodeQLAnalysis'
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,38 @@ 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 : Initialize CodeQL (to merge SARIF reports)
310+ id : codeql-init-dummy
311+ timeout-minutes : 1
312+ if : inputs.compiler-family == 'LLVM' && inputs.flavor != 'CodeQLAnalysis' && !cancelled() && steps.build.conclusion != 'skipped'
313+ uses : github/codeql-action/init@v3
314+ with :
315+ languages : cpp
316+ source-root : ${{ github.workspace }}/rawspeed
317+ - name : Merge clang SARIF reports
318+ if : inputs.compiler-family == 'LLVM' && !cancelled() && steps.build.conclusion != 'skipped'
319+ timeout-minutes : 1
320+ env :
321+ CODEQL_PATH : ${{ steps.codeql-init-dummy.conclusion != 'skipped' && steps.codeql-init-dummy.outputs.codeql-path || steps.codeql-init.outputs.codeql-path }}
322+ run : |
323+ set -xe
324+ INPUTS=$(for f in "${GITHUB_WORKSPACE}/clang_report/*.json"; do echo -n " --sarif $f"; done)
325+ echo ${INPUTS}
326+ "${CODEQL_PATH}" github merge-results ${INPUTS} --output="${GITHUB_WORKSPACE}/clang_report.json" --sarif-merge-runs-from-equal-category
327+ - name : Upload results of clang compile [SARIF]
328+ timeout-minutes : 1
329+ if : inputs.compiler-family == 'LLVM' && !cancelled() && steps.build.conclusion != 'skipped'
330+ uses : github/codeql-action/upload-sarif@v3
331+ with :
332+ sarif_file : " ${{ github.workspace }}/clang_report.json"
333+ checkout_path : " ${{ github.workspace }}/rawspeed"
334+ category : ${{ job.name }}
298335 - name : Test (unit tests)
299336 timeout-minutes : 1
300337 env :
0 commit comments