From e62b3b8c1c2212e8ffa54f1589347cf95dbe1cbf Mon Sep 17 00:00:00 2001 From: Paulo Matos Date: Mon, 3 Aug 2020 17:46:04 +0200 Subject: [PATCH] Fix tool name in SARIF files depending on racket build mode (#3328) This should replace the toolname in sarif files to workaround the lack of tags when uploading them. See here for a request to add that: https://github.com/github/codeql-action/issues/129 --- .github/scripts/adjust-sarif-tool.sh | 8 +++ .../workflows/scanbuild_static-analysis.yml | 56 ++++--------------- 2 files changed, 18 insertions(+), 46 deletions(-) create mode 100755 .github/scripts/adjust-sarif-tool.sh diff --git a/.github/scripts/adjust-sarif-tool.sh b/.github/scripts/adjust-sarif-tool.sh new file mode 100755 index 0000000000..ce67b5c133 --- /dev/null +++ b/.github/scripts/adjust-sarif-tool.sh @@ -0,0 +1,8 @@ +#!/bin/bash +MODE="$1" +shopt -s globstar + +for file in **/*.sarif; do + echo "Processing $file" + jq "setpath([\"runs\",0,\"tool\",\"driver\",\"name\"]; \"clang-${MODE}\")" $file | sponge $file +done diff --git a/.github/workflows/scanbuild_static-analysis.yml b/.github/workflows/scanbuild_static-analysis.yml index 31296ebbba..cd9c885cc4 100644 --- a/.github/workflows/scanbuild_static-analysis.yml +++ b/.github/workflows/scanbuild_static-analysis.yml @@ -1,6 +1,6 @@ name: LLVM Static Analysis -on: [push] +on: push jobs: @@ -40,26 +40,14 @@ jobs: --disable-docs - name: Scan Build working-directory: ./racket/src - run: | - export cpus=$(grep -c ^processor /proc/cpuinfo) - scan-build -sarif -o ../../racketcgc-report -analyzer-config 'crosscheck-with-z3=true' make -j$((cpus + 1)) cgc + run: scan-build -sarif -o ../../racketcgc-report -analyzer-config 'crosscheck-with-z3=true' make -j$(($(nproc) + 1)) cgc - name: Move sarif results run: | mkdir sarif-files find racketcgc-report -type f -name '*.sarif' -exec cp \{\} sarif-files/ \; - name: Adjust tool name - run: | - cd sarif-files - cat > adjust.sh < adjust.sh < adjust.sh <