@@ -46,13 +46,15 @@ jobs:
4646 linux :
4747 runs-on : ubuntu-latest
4848 env :
49+ JOB_NAME : ${{ runner.os }}.${{ inputs.distro }}.${{ inputs.compiler-family }}${{ inputs.compiler-version }}.${{ inputs.flavor }}
4950 SONAR_SCANNER_VERSION : 5.0.1.3006
50- name : ${{ inputs.distro }}.${{ inputs.compiler-family }}${{ inputs.compiler-version }}.${{ inputs.flavor }}
51+ name : ${{ env.JOB_NAME }}
5152 container :
5253 image : ${{ inputs.distro }}
5354 options : --tmpfs /tmp:exec --tmpfs /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}:exec
5455 steps :
5556 - name : Configure APT
57+ env :
5658 timeout-minutes : 1
5759 run : |
5860 set -xe
@@ -137,7 +139,8 @@ jobs:
137139 fi
138140 if [ "$COMPILER_FAMILY" = "LLVM" ]; then
139141 eatmydata apt install clang-${{ inputs.compiler-version }} \
140- libomp-${{ inputs.compiler-version }}-dev
142+ libomp-${{ inputs.compiler-version }}-dev \
143+ python3
141144 fi
142145 if [ "$ENABLE_SAMPLE_BASED_TESTING" = "true" ]; then
143146 eatmydata apt install zstd
@@ -228,6 +231,7 @@ jobs:
228231 uses : github/codeql-action/init@v3
229232 with :
230233 languages : cpp
234+ source-root : ${{ github.workspace }}/rawspeed
231235 - name : Set up JDK 11 (for SonarCloud static analysis)
232236 timeout-minutes : 1
233237 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 +268,7 @@ jobs:
264268 env :
265269 CC : ${{ inputs.compiler-CC }}
266270 CXX : ${{ inputs.compiler-CXX }}
271+ FAMILY : ${{ inputs.compiler-family }}
267272 CLANG_TIDY : ${{ inputs.compiler-CLANG_TIDY }}
268273 GCOV : ${{ inputs.compiler-GCOV }}
269274 SRC_DIR : ${{ github.workspace }}/rawspeed
@@ -279,14 +284,16 @@ jobs:
279284 cmake -E make_directory "${INSTALL_PREFIX}"
280285 export ECO="${ECO} -DRAWSPEED_REFERENCE_SAMPLE_ARCHIVE=${RPUU_DST}"
281286 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
287+ if [ "$FAMILY " = "LLVM " ]; then
283288 export ECO="${ECO} -DRAWSPEED_ENABLE_WERROR=OFF"
289+ export ECO="${ECO} -DCMAKE_CXX_COMPILER_LAUNCHER='${SRC_DIR}/.ci/clang-sarif-wrapper.sh;${GITHUB_WORKSPACE}/clang_report/'"
284290 fi
285291 "${SRC_DIR}/.ci/ci-script.sh"
286292 - name : Build
287293 id : build
288294 timeout-minutes : ${{ inputs.flavor != 'ClangTidy' && (inputs.flavor != 'CodeQLAnalysis' && 7 || 12) || 25 }}
289295 env :
296+ FAMILY : ${{ inputs.compiler-family }}
290297 SRC_DIR : ${{ github.workspace }}/rawspeed
291298 BUILD_DIR : ${{ github.workspace }}/rawspeed-build
292299 INSTALL_PREFIX : ${{ github.workspace }}/rawspeed-install
@@ -295,6 +302,29 @@ jobs:
295302 run : |
296303 set -xe
297304 "${SRC_DIR}/.ci/ci-script.sh"
305+ if [ "$FLAVOR" = "ClangTidy" ] || [ "$FLAVOR" = "ClangStaticAnalysis" ] || [ "$FLAVOR" = "ClangCTUStaticAnalysis" ] || [ "$FLAVOR" = "CodeQLAnalysis" ]; then
306+ exit 0
307+ else
308+ MARKER="${GITHUB_WORKSPACE}/clang_report/.warnings"
309+ [ -f "$MARKER" ] && exit 1 || exit 0
310+ fi
311+ - name : Merge clang SARIF reports
312+ if : inputs.compiler-family == 'LLVM' && !cancelled() && steps.build.conclusion != 'skipped'
313+ timeout-minutes : 1
314+ env :
315+ SRC_DIR : ${{ github.workspace }}/rawspeed
316+ JOB_NAME : ${{ env.JOB_NAME }}
317+ run : |
318+ set -xe
319+ "${SRC_DIR}/.ci/clang-sarif-merge.py" --output="${GITHUB_WORKSPACE}/clang_report.json" "${GITHUB_WORKSPACE}/clang_report/"
320+ - name : Upload results of clang compile [SARIF]
321+ timeout-minutes : 1
322+ if : inputs.compiler-family == 'LLVM' && !cancelled() && steps.build.conclusion != 'skipped'
323+ uses : github/codeql-action/upload-sarif@v3
324+ with :
325+ sarif_file : " ${{ github.workspace }}/clang_report.json"
326+ checkout_path : " ${{ github.workspace }}/rawspeed"
327+ category : ${{ job.name }}
298328 - name : Test (unit tests)
299329 timeout-minutes : 1
300330 env :
0 commit comments