4646 linux :
4747 runs-on : ubuntu-latest
4848 env :
49+ JOB_NAME : linux.${{ inputs.distro }}.${{ inputs.compiler-family }}${{ inputs.compiler-version }}.${{ inputs.flavor }}
4950 SONAR_SCANNER_VERSION : 5.0.1.3006
5051 name : ${{ inputs.distro }}.${{ inputs.compiler-family }}${{ inputs.compiler-version }}.${{ inputs.flavor }}
5152 container :
@@ -137,7 +138,8 @@ jobs:
137138 fi
138139 if [ "$COMPILER_FAMILY" = "LLVM" ]; then
139140 eatmydata apt install clang-${{ inputs.compiler-version }} \
140- libomp-${{ inputs.compiler-version }}-dev
141+ libomp-${{ inputs.compiler-version }}-dev \
142+ python3
141143 fi
142144 if [ "$ENABLE_SAMPLE_BASED_TESTING" = "true" ]; then
143145 eatmydata apt install zstd
@@ -228,6 +230,7 @@ jobs:
228230 uses : github/codeql-action/init@v3
229231 with :
230232 languages : cpp
233+ source-root : ${{ github.workspace }}/rawspeed
231234 - name : Set up JDK 11 (for SonarCloud static analysis)
232235 timeout-minutes : 1
233236 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 +267,7 @@ jobs:
264267 env :
265268 CC : ${{ inputs.compiler-CC }}
266269 CXX : ${{ inputs.compiler-CXX }}
270+ FAMILY : ${{ inputs.compiler-family }}
267271 CLANG_TIDY : ${{ inputs.compiler-CLANG_TIDY }}
268272 GCOV : ${{ inputs.compiler-GCOV }}
269273 SRC_DIR : ${{ github.workspace }}/rawspeed
@@ -279,14 +283,16 @@ jobs:
279283 cmake -E make_directory "${INSTALL_PREFIX}"
280284 export ECO="${ECO} -DRAWSPEED_REFERENCE_SAMPLE_ARCHIVE=${RPUU_DST}"
281285 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
286+ if [ "$FAMILY " = "LLVM " ]; then
283287 export ECO="${ECO} -DRAWSPEED_ENABLE_WERROR=OFF"
288+ export ECO="${ECO} -DCMAKE_CXX_COMPILER_LAUNCHER='${SRC_DIR}/.ci/clang-sarif-wrapper.sh;${GITHUB_WORKSPACE}/clang_report/'"
284289 fi
285290 "${SRC_DIR}/.ci/ci-script.sh"
286291 - name : Build
287292 id : build
288293 timeout-minutes : ${{ inputs.flavor != 'ClangTidy' && (inputs.flavor != 'CodeQLAnalysis' && 7 || 12) || 25 }}
289294 env :
295+ FAMILY : ${{ inputs.compiler-family }}
290296 SRC_DIR : ${{ github.workspace }}/rawspeed
291297 BUILD_DIR : ${{ github.workspace }}/rawspeed-build
292298 INSTALL_PREFIX : ${{ github.workspace }}/rawspeed-install
@@ -295,6 +301,29 @@ jobs:
295301 run : |
296302 set -xe
297303 "${SRC_DIR}/.ci/ci-script.sh"
304+ if [ "$FLAVOR" = "ClangTidy" ] || [ "$FLAVOR" = "ClangStaticAnalysis" ] || [ "$FLAVOR" = "ClangCTUStaticAnalysis" ] || [ "$FLAVOR" = "CodeQLAnalysis" ]; then
305+ exit 0
306+ else
307+ MARKER="${GITHUB_WORKSPACE}/clang_report/.warnings"
308+ [ -f "$MARKER" ] && exit 1 || exit 0
309+ fi
310+ - name : Merge clang SARIF reports
311+ if : inputs.compiler-family == 'LLVM' && !cancelled() && steps.build.conclusion != 'skipped'
312+ timeout-minutes : 1
313+ env :
314+ SRC_DIR : ${{ github.workspace }}/rawspeed
315+ JOB_NAME : ${{ env.JOB_NAME }}
316+ run : |
317+ set -xe
318+ "${SRC_DIR}/.ci/clang-sarif-merge.py" --output="${GITHUB_WORKSPACE}/clang_report.json" "${GITHUB_WORKSPACE}/clang_report/"
319+ - name : Upload results of clang compile [SARIF]
320+ timeout-minutes : 1
321+ if : inputs.compiler-family == 'LLVM' && !cancelled() && steps.build.conclusion != 'skipped'
322+ uses : github/codeql-action/upload-sarif@v3
323+ with :
324+ sarif_file : " ${{ github.workspace }}/clang_report.json"
325+ checkout_path : " ${{ github.workspace }}/rawspeed"
326+ category : ${{ env.JOB_NAME }}
298327 - name : Test (unit tests)
299328 timeout-minutes : 1
300329 env :
0 commit comments