From b08f672daf1efadd9c77a775332dc0b64ac22e4a Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 24 Oct 2025 17:24:55 +0700 Subject: add pvs-studio analyze to ci --- .github/workflows/static_analysis.yml | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/static_analysis.yml (limited to '.github/workflows/static_analysis.yml') diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml new file mode 100644 index 000000000..3ace5cf99 --- /dev/null +++ b/.github/workflows/static_analysis.yml @@ -0,0 +1,43 @@ +name: Static Analysis +on: + workflow_dispatch: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: +# SonarQube: +# name: Build and analyze +# runs-on: ubuntu-latest +# env: +# BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed +# steps: +# - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis +# - name: Install Build Wrapper +# uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6 +# - name: Run Build Wrapper +# run: | +# build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset ${{ env.BOARD }} -t ${{ env.EXAMPLE }} +# - name: SonarQube Scan +# uses: SonarSource/sonarqube-scan-action@v6 +# env: +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# with: +# args: > +# --define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" + PVS-Studio: + uses: ./.github/workflows/build_util.yml + strategy: + fail-fast: false + matrix: + board: + - 'stm32h743eval' + with: + build-system: 'cmake' + toolchain: 'arm-gcc' + build-args: '-b${{ matrix.board }}' + one-per-family: true + analyze-pvs: true -- cgit v1.3.1 From 948ba203ca8d31de3f0947bc01b5852174bc8404 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 25 Oct 2025 00:15:41 +0700 Subject: add pvs-studio analyze to ci --- .github/workflows/build_util.yml | 26 ----------------------- .github/workflows/static_analysis.yml | 39 ++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 33 deletions(-) (limited to '.github/workflows/static_analysis.yml') diff --git a/.github/workflows/build_util.yml b/.github/workflows/build_util.yml index d52924efd..a2c96f3c0 100644 --- a/.github/workflows/build_util.yml +++ b/.github/workflows/build_util.yml @@ -20,10 +20,6 @@ on: required: false default: false type: boolean - analyze-pvs: - required: false - default: false - type: boolean os: required: false type: string @@ -72,28 +68,6 @@ jobs: fi shell: bash - - name: PVS-Studio analyze - if: ${{ inputs.analyze-pvs }} - run: | - wget -q -O - https://files.pvs-studio.com/etc/pubkey.txt | sudo apt-key add - - sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.pvs-studio.com/etc/viva64.list - sudo apt update - sudo apt install pvs-studio - pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }} - mkdir -p sarif-reports - for build_dir in cmake-build/cmake-build-*; do - BOARD=${build_dir#cmake-build/cmake-build-} - pvs-studio-analyzer analyze -f ${build_dir}/compile_commands.json -j -o ${build_dir}/pvs-report.log --exclude-path hw/mcu/ --exclude-path lib/ - plog-converter -t sarif -o sarif-reports/${BOARD}.sarif ${build_dir}/pvs-report.log - done - - - name: PVS-Studio upload SARIF - if: ${{ inputs.analyze-pvs }} - uses: github/codeql-action/upload-sarif@v4 - with: - sarif_file: sarif-reports/ - category: PVS-Studio - - name: Upload Artifacts for Hardware Testing if: ${{ inputs.upload-artifacts }} uses: actions/upload-artifact@v4 diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 3ace5cf99..6541be129 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -29,15 +29,40 @@ jobs: # args: > # --define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" PVS-Studio: - uses: ./.github/workflows/build_util.yml + runs-on: ubuntu-latest strategy: fail-fast: false matrix: board: - 'stm32h743eval' - with: - build-system: 'cmake' - toolchain: 'arm-gcc' - build-args: '-b${{ matrix.board }}' - one-per-family: true - analyze-pvs: true + steps: + - name: Checkout TinyUSB + uses: actions/checkout@v4 + + - name: Get Dependencies + uses: ./.github/actions/get_deps + with: + arg: -b${{ matrix.board }} + + - name: Setup Toolchain + uses: ./.github/actions/setup_toolchain + with: + toolchain: 'arm-gcc' + + - name: Analyze + run: | + wget -q -O - https://files.pvs-studio.com/etc/pubkey.txt | sudo apt-key add - + sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.pvs-studio.com/etc/viva64.list + sudo apt update + sudo apt install pvs-studio + pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }} + cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_BUILD_TYPE=MinSizeRel + cmake --build build + pvs-studio-analyzer analyze -f build/compile_commands.json -j --exclude-path hw/mcu/ --exclude-path lib/ + plog-converter -t sarif -o pvs.sarif PVS-Studio.log + + - name: Upload SARIF + uses: github/codeql-action/upload-sarif@v4 + with: + sarif_file: pvs.sarif + category: PVS-Studio -- cgit v1.3.1 From 5e3e24337f82582103ce7e9d8498c49547cab42b Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 25 Oct 2025 12:28:20 +0700 Subject: merge codeql and pvs-studio to static_analysis.yml --- .github/workflows/codeql.yml | 1 + .github/workflows/static_analysis.yml | 119 ++++++++++++++++++++++++++++------ 2 files changed, 99 insertions(+), 21 deletions(-) (limited to '.github/workflows/static_analysis.yml') diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index dfcca6315..21ed9c223 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -41,6 +41,7 @@ jobs: # Consider using larger runners for possible analysis time improvements. runs-on: ubuntu-latest timeout-minutes: 360 + if: false permissions: actions: read contents: read diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 6541be129..f391855f5 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -6,28 +6,80 @@ on: - master pull_request: types: [opened, synchronize, reopened] + +permissions: + actions: read + contents: read + security-events: write + jobs: -# SonarQube: -# name: Build and analyze -# runs-on: ubuntu-latest -# env: -# BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed -# steps: -# - uses: actions/checkout@v4 + CodeQL: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + board: + - 'raspberry_pi_pico' + steps: + - name: Checkout TinyUSB + uses: actions/checkout@v4 + + - name: Get Dependencies + uses: ./.github/actions/get_deps + with: + arg: -b${{ matrix.board }} + + - name: Setup Toolchain + uses: ./.github/actions/setup_toolchain + with: + toolchain: 'arm-gcc' + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: 'c-cpp' + queries: security-and-quality + + - name: Build + run: | + cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel + cmake --build build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: CodeQL + upload: always + id: step1 + +# - name: Filter out unwanted errors and warnings +# uses: advanced-security/filter-sarif@v1 # with: -# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis -# - name: Install Build Wrapper -# uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6 -# - name: Run Build Wrapper -# run: | -# build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset ${{ env.BOARD }} -t ${{ env.EXAMPLE }} -# - name: SonarQube Scan -# uses: SonarSource/sonarqube-scan-action@v6 -# env: -# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# patterns: | +# -**:cpp/path-injection +# -**:cpp/world-writable-file-creation +# -**:cpp/poorly-documented-function +# -**:cpp/potentially-dangerous-function +# -**:cpp/use-of-goto +# -**:cpp/integer-multiplication-cast-to-long +# -**:cpp/comparison-with-wider-type +# -**:cpp/leap-year/* +# -**:cpp/ambiguously-signed-bit-field +# -**:cpp/suspicious-pointer-scaling +# -**:cpp/suspicious-pointer-scaling-void +# -**:cpp/unsigned-comparison-zero +# -**/third*party/** +# -**/3rd*party/** +# -**/external/** +# input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif +# output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif +# +# - name: Upload SARIF +# uses: github/codeql-action/upload-sarif@v4 # with: -# args: > -# --define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" +# sarif_file: ${{ steps.step1.outputs.sarif-output }} +# category: CodeQL + PVS-Studio: runs-on: ubuntu-latest strategy: @@ -49,14 +101,17 @@ jobs: with: toolchain: 'arm-gcc' - - name: Analyze + - name: Install Tools run: | wget -q -O - https://files.pvs-studio.com/etc/pubkey.txt | sudo apt-key add - sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.pvs-studio.com/etc/viva64.list sudo apt update sudo apt install pvs-studio pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }} - cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_BUILD_TYPE=MinSizeRel + + - name: Analyze + run: | + cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build pvs-studio-analyzer analyze -f build/compile_commands.json -j --exclude-path hw/mcu/ --exclude-path lib/ plog-converter -t sarif -o pvs.sarif PVS-Studio.log @@ -66,3 +121,25 @@ jobs: with: sarif_file: pvs.sarif category: PVS-Studio + +# SonarQube: +# name: Build and analyze +# runs-on: ubuntu-latest +# env: +# BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed +# steps: +# - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis +# - name: Install Build Wrapper +# uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6 +# - name: Run Build Wrapper +# run: | +# build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset ${{ env.BOARD }} -t ${{ env.EXAMPLE }} +# - name: SonarQube Scan +# uses: SonarSource/sonarqube-scan-action@v6 +# env: +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# with: +# args: > +# --define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" -- cgit v1.3.1 From 6cc445ef0f3e7b29cfe2e3d90bb3364afbc424af Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 25 Oct 2025 12:54:40 +0700 Subject: download ninja binary, apt seems take too long ~ 1 min also upload sarif as artifacts --- .github/actions/get_deps/action.yml | 5 ++++- .github/workflows/static_analysis.yml | 25 +++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) (limited to '.github/workflows/static_analysis.yml') diff --git a/.github/actions/get_deps/action.yml b/.github/actions/get_deps/action.yml index ae9e7bbef..b0d6d1066 100644 --- a/.github/actions/get_deps/action.yml +++ b/.github/actions/get_deps/action.yml @@ -19,7 +19,10 @@ runs: - name: Linux dependencies if: runner.os == 'Linux' run: | - sudo apt install -y ninja-build + NINJA_URL=https://github.com/ninja-build/ninja/releases/download/v1.13.1/ninja-linux.zip + wget $NINJA_URL -O ninja-linux.zip + unzip ninja-linux.zip -d ninja-bin + echo >> $GITHUB_PATH "${{ github.workspace }}/ninja-bin" shell: bash - name: Get Dependencies diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index f391855f5..bbb7229df 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -50,7 +50,7 @@ jobs: with: category: CodeQL upload: always - id: step1 + id: analyze # - name: Filter out unwanted errors and warnings # uses: advanced-security/filter-sarif@v1 @@ -71,15 +71,21 @@ jobs: # -**/third*party/** # -**/3rd*party/** # -**/external/** -# input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif -# output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif +# input: ${{ steps.analyze.outputs.sarif-output }}/cpp.sarif +# output: ${{ steps.analyze.outputs.sarif-output }}/cpp.sarif # # - name: Upload SARIF # uses: github/codeql-action/upload-sarif@v4 # with: -# sarif_file: ${{ steps.step1.outputs.sarif-output }} +# sarif_file: ${{ steps.analyze.outputs.sarif-output }} # category: CodeQL + - name: Upload artifact + uses: actions/upload-artifact@v5 + with: + name: codeql-${{ matrix.board }} + path: ${{ steps.analyze.outputs.sarif-output }} + PVS-Studio: runs-on: ubuntu-latest strategy: @@ -114,14 +120,21 @@ jobs: cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build pvs-studio-analyzer analyze -f build/compile_commands.json -j --exclude-path hw/mcu/ --exclude-path lib/ - plog-converter -t sarif -o pvs.sarif PVS-Studio.log + plog-converter -t sarif -o pvs-${{ matrix.board }}.sarif PVS-Studio.log - name: Upload SARIF uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: pvs.sarif + sarif_file: pvs-${{ matrix.board }}.sarif category: PVS-Studio + - name: Upload artifact + uses: actions/upload-artifact@v5 + with: + name: pvs-${{ matrix.board }} + path: pvs-${{ matrix.board }}.sarif + + # SonarQube: # name: Build and analyze # runs-on: ubuntu-latest -- cgit v1.3.1 From 531009c9a02d719d3222c89dc9d31f5967e23af3 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 25 Oct 2025 13:36:26 +0700 Subject: add SonarQube scan --- .github/workflows/static_analysis.yml | 70 +++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 24 deletions(-) (limited to '.github/workflows/static_analysis.yml') diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index bbb7229df..e5254344b 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -42,6 +42,7 @@ jobs: - name: Build run: | + mkdir -p build cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build @@ -117,10 +118,11 @@ jobs: - name: Analyze run: | + mkdir -p build cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build pvs-studio-analyzer analyze -f build/compile_commands.json -j --exclude-path hw/mcu/ --exclude-path lib/ - plog-converter -t sarif -o pvs-${{ matrix.board }}.sarif PVS-Studio.log + plog-converter -t sarif -o pvs-studio-${{ matrix.board }}.sarif PVS-Studio.log - name: Upload SARIF uses: github/codeql-action/upload-sarif@v4 @@ -131,28 +133,48 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v5 with: - name: pvs-${{ matrix.board }} - path: pvs-${{ matrix.board }}.sarif + name: pvs-studio-${{ matrix.board }} + path: pvs-studio-${{ matrix.board }}.sarif + SonarQube: + runs-on: ubuntu-latest + env: + BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory + strategy: + fail-fast: false + matrix: + board: + - 'metro_m4_express' + steps: + - name: Checkout TinyUSB + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis -# SonarQube: -# name: Build and analyze -# runs-on: ubuntu-latest -# env: -# BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed -# steps: -# - uses: actions/checkout@v4 -# with: -# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis -# - name: Install Build Wrapper -# uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6 -# - name: Run Build Wrapper -# run: | -# build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset ${{ env.BOARD }} -t ${{ env.EXAMPLE }} -# - name: SonarQube Scan -# uses: SonarSource/sonarqube-scan-action@v6 -# env: -# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -# with: -# args: > -# --define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" + - name: Get Dependencies + uses: ./.github/actions/get_deps + with: + arg: -b${{ matrix.board }} + + - name: Setup Toolchain + uses: ./.github/actions/setup_toolchain + with: + toolchain: 'arm-gcc' + + - name: Install Build Wrapper + uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6 + + - name: Run Build Wrapper + run: | + cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel + build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ + + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v6 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_ROOT_CERT: ${{ secrets.SONAR_ROOT_CERT }} + with: + # Consult https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/scanners/sonarscanner/ for more information and options + args: > + --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" -- cgit v1.3.1 From 5818db49b2de8689a07007a5e4d329b94d67ef42 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 25 Oct 2025 13:54:10 +0700 Subject: add SonarQube scan --- .github/workflows/static_analysis.yml | 5 ++--- sonar-project.properties | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 sonar-project.properties (limited to '.github/workflows/static_analysis.yml') diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index e5254344b..45c5c959b 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -127,7 +127,7 @@ jobs: - name: Upload SARIF uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: pvs-${{ matrix.board }}.sarif + sarif_file: pvs-studio-${{ matrix.board }}.sarif category: PVS-Studio - name: Upload artifact @@ -173,8 +173,7 @@ jobs: uses: SonarSource/sonarqube-scan-action@v6 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_ROOT_CERT: ${{ secrets.SONAR_ROOT_CERT }} with: # Consult https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/scanners/sonarscanner/ for more information and options args: > - --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" + --define sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..d797bfe6f --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=hathach_tinyusb +sonar.organization=hathach + + +# This is the name and version displayed in the SonarCloud UI. +sonar.projectName=tinyusb +sonar.projectVersion=0.19.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 -- cgit v1.3.1 From d7c4bf14b464a509120ff18f94e9b02cd1c6f9fa Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 25 Oct 2025 16:30:42 +0700 Subject: add IAR CStat to static_analysis.yml --- .circleci/config2.yml | 2 + .../actions/setup_toolchain/download/action.yml | 4 +- .github/actions/setup_toolchain/toolchain.json | 2 +- .github/workflows/codeql-buildscript.sh | 6 - .github/workflows/codeql.yml | 138 --------------------- .github/workflows/fail_on_error.py | 34 ----- .github/workflows/static_analysis.yml | 55 +++++++- tools/make_release.py | 11 ++ 8 files changed, 67 insertions(+), 185 deletions(-) delete mode 100644 .github/workflows/codeql-buildscript.sh delete mode 100644 .github/workflows/codeql.yml delete mode 100755 .github/workflows/fail_on_error.py (limited to '.github/workflows/static_analysis.yml') diff --git a/.circleci/config2.yml b/.circleci/config2.yml index d86a3f662..bd2a7d02a 100644 --- a/.circleci/config2.yml +++ b/.circleci/config2.yml @@ -34,6 +34,7 @@ commands: chmod +x toolchain.run ./toolchain.run -p ~/cache/<< parameters.toolchain >>/gnurx -y elif [[ << parameters.toolchain >> == arm-iar ]]; then + wget --progress=dot:giga https://netstorage.iar.com/FileStore/STANDARD/001/003/926/iar-lmsc-tools_1.8_amd64.deb -O ~/cache/<< parameters.toolchain >>/iar-lmsc-tools.deb wget --progress=dot:giga $toolchain_url -O ~/cache/<< parameters.toolchain >>/toolchain.deb else wget --progress=dot:giga $toolchain_url -O toolchain.tar.gz @@ -44,6 +45,7 @@ commands: # Add toolchain to PATH if [[ << parameters.toolchain >> == arm-iar ]]; then # Install IAR since we only cache deb file + sudo dpkg -i ~/cache/<< parameters.toolchain >>/iar-lmsc-tools.deb sudo dpkg --ignore-depends=libusb-1.0-0 -i ~/cache/<< parameters.toolchain >>/toolchain.deb echo "export PATH=$PATH:/opt/iar/cxarm/arm/bin" >> $BASH_ENV else diff --git a/.github/actions/setup_toolchain/download/action.yml b/.github/actions/setup_toolchain/download/action.yml index ce9643010..514b38f19 100644 --- a/.github/actions/setup_toolchain/download/action.yml +++ b/.github/actions/setup_toolchain/download/action.yml @@ -29,6 +29,7 @@ runs: chmod +x toolchain.run ./toolchain.run -p ~/cache/${{ inputs.toolchain }}/gnurx -y elif [[ ${{ inputs.toolchain }} == arm-iar ]]; then + wget --progress=dot:giga https://netstorage.iar.com/FileStore/STANDARD/001/003/926/iar-lmsc-tools_1.8_amd64.deb -O ~/cache/${{ inputs.toolchain }}/iar-lmsc-tools.deb wget --progress=dot:giga ${{ inputs.toolchain_url }} -O ~/cache/${{ inputs.toolchain }}/cxarm.deb else wget --progress=dot:giga ${{ inputs.toolchain_url }} -O toolchain.tar.gz @@ -39,7 +40,8 @@ runs: - name: Setup Toolchain run: | if [[ ${{ inputs.toolchain }} == arm-iar ]]; then - sudo apt-get install -y ~/cache/${{ inputs.toolchain }}/cxarm.deb + sudo dpkg -i ~/cache/${{ inputs.toolchain }}/iar-lmsc-tools.deb + sudo apt install -y ~/cache/${{ inputs.toolchain }}/cxarm.deb echo >> $GITHUB_PATH "/opt/iar/cxarm/arm/bin" else echo >> $GITHUB_PATH `echo ~/cache/${{ inputs.toolchain }}/*/bin` diff --git a/.github/actions/setup_toolchain/toolchain.json b/.github/actions/setup_toolchain/toolchain.json index f7123ef11..8496dcad3 100644 --- a/.github/actions/setup_toolchain/toolchain.json +++ b/.github/actions/setup_toolchain/toolchain.json @@ -5,5 +5,5 @@ "msp430-gcc": "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2", "riscv-gcc": "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz", "rx-gcc": "https://github.com/hathach/rx_device/releases/download/0.0.1/gcc-8.3.0.202411-GNURX-ELF.run", - "arm-iar": "https://netstorage.iar.com/FileStore/STANDARD/001/003/583/cxarm-9.60.4.deb" + "arm-iar": "https://netstorage.iar.com/FileStore/STANDARD/001/003/723/cxarm-9.70.1.deb" } diff --git a/.github/workflows/codeql-buildscript.sh b/.github/workflows/codeql-buildscript.sh deleted file mode 100644 index 272b55d22..000000000 --- a/.github/workflows/codeql-buildscript.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -FAMILY=stm32l4 -pip install click -python3 tools/get_deps.py $FAMILY -python3 tools/build.py -s make $FAMILY diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 21ed9c223..000000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,138 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ 'master' ] - paths: - - 'src/**' - - 'examples/**' - - 'lib/**' - - 'hw/**' - - '.github/workflows/codeql.yml' - pull_request: - branches: [ 'master' ] - paths: - - 'src/**' - - 'examples/**' - - 'lib/**' - - 'hw/**' - - '.github/workflows/codeql.yml' - schedule: - - cron: '0 0 * * *' - -jobs: - analyze: - name: Analyze - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners - # Consider using larger runners for possible analysis time improvements. - runs-on: ubuntu-latest - timeout-minutes: 360 - if: false - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'c-cpp' ] - # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] - # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Toolchain - uses: ./.github/actions/setup_toolchain - with: - toolchain: 'arm-gcc' - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - queries: security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - #- name: Autobuild - # uses: github/codeql-action/autobuild@v2 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - - run: | - ./.github/workflows/codeql-buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" - upload: false - id: step1 - - # Filter out rules with low severity or high false positive rate - # Also filter out warnings in third-party code - - name: Filter out unwanted errors and warnings - uses: advanced-security/filter-sarif@v1 - with: - patterns: | - -**:cpp/path-injection - -**:cpp/world-writable-file-creation - -**:cpp/poorly-documented-function - -**:cpp/potentially-dangerous-function - -**:cpp/use-of-goto - -**:cpp/integer-multiplication-cast-to-long - -**:cpp/comparison-with-wider-type - -**:cpp/leap-year/* - -**:cpp/ambiguously-signed-bit-field - -**:cpp/suspicious-pointer-scaling - -**:cpp/suspicious-pointer-scaling-void - -**:cpp/unsigned-comparison-zero - -**/third*party/** - -**/3rd*party/** - -**/external/** - input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif - output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif - - - name: Upload SARIF - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: ${{ steps.step1.outputs.sarif-output }} - category: "/language:${{matrix.language}}" - - - name: Upload CodeQL results as an artifact - uses: actions/upload-artifact@v4 - with: - name: codeql-results - path: ${{ steps.step1.outputs.sarif-output }} - retention-days: 5 diff --git a/.github/workflows/fail_on_error.py b/.github/workflows/fail_on_error.py deleted file mode 100755 index 29791742b..000000000 --- a/.github/workflows/fail_on_error.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 - -import json -import sys - -# Return whether SARIF file contains error-level results -def codeql_sarif_contain_error(filename): - with open(filename, 'r') as f: - s = json.load(f) - - for run in s.get('runs', []): - rules_metadata = run['tool']['driver']['rules'] - if not rules_metadata: - rules_metadata = run['tool']['extensions'][0]['rules'] - - for res in run.get('results', []): - if 'ruleIndex' in res: - rule_index = res['ruleIndex'] - elif 'rule' in res and 'index' in res['rule']: - rule_index = res['rule']['index'] - else: - continue - try: - rule_level = rules_metadata[rule_index]['defaultConfiguration']['level'] - except IndexError as e: - print(e, rule_index, len(rules_metadata)) - else: - if rule_level == 'error': - return True - return False - -if __name__ == "__main__": - if codeql_sarif_contain_error(sys.argv[1]): - sys.exit(1) diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 45c5c959b..e060dfbc9 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: board: - - 'raspberry_pi_pico' + - 'metro_m4_express' steps: - name: Checkout TinyUSB uses: actions/checkout@v4 @@ -88,12 +88,13 @@ jobs: path: ${{ steps.analyze.outputs.sarif-output }} PVS-Studio: + if: github.repository_owner == 'hathach' runs-on: ubuntu-latest strategy: fail-fast: false matrix: board: - - 'stm32h743eval' + - 'raspberry_pi_pico' steps: - name: Checkout TinyUSB uses: actions/checkout@v4 @@ -119,7 +120,7 @@ jobs: - name: Analyze run: | mkdir -p build - cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel + cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build pvs-studio-analyzer analyze -f build/compile_commands.json -j --exclude-path hw/mcu/ --exclude-path lib/ plog-converter -t sarif -o pvs-studio-${{ matrix.board }}.sarif PVS-Studio.log @@ -137,6 +138,7 @@ jobs: path: pvs-studio-${{ matrix.board }}.sarif SonarQube: + if: github.repository_owner == 'hathach' runs-on: ubuntu-latest env: BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory @@ -144,7 +146,7 @@ jobs: fail-fast: false matrix: board: - - 'metro_m4_express' + - 'stm32h743eval' steps: - name: Checkout TinyUSB uses: actions/checkout@v4 @@ -166,7 +168,7 @@ jobs: - name: Run Build Wrapper run: | - cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel + cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_BUILD_TYPE=MinSizeRel build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ - name: SonarQube Scan @@ -177,3 +179,46 @@ jobs: # Consult https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/scanners/sonarscanner/ for more information and options args: > --define sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json + + IAR-CStat: + if: github.repository_owner == 'hathach' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + board: + - 'b_g474e_dpow1' + steps: + - name: Checkout TinyUSB + uses: actions/checkout@v4 + + - name: Get Dependencies + uses: ./.github/actions/get_deps + with: + arg: -b${{ matrix.board }} + + - name: Setup Toolchain + uses: ./.github/actions/setup_toolchain + with: + toolchain: 'arm-iar' + + - name: Run IAR C-STAT Analysis + env: + IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }} + run: | + # CMake run post build to generate C-STAT SARIF report + mkdir -p build + cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DTOOLCHAIN=iar -DIAR_CSTAT=1 -DCMAKE_BUILD_TYPE=MinSizeRel + cmake --build build + + - name: Upload SARIF + uses: github/codeql-action/upload-sarif@v4 + with: + sarif_file: build/cstat_sarif + category: IAR-CStat + + - name: Upload artifact + uses: actions/upload-artifact@v5 + with: + name: iar-cstat-${{ matrix.board }} + path: build/cstat_sarif diff --git a/tools/make_release.py b/tools/make_release.py index 488ad4901..0e7919f46 100755 --- a/tools/make_release.py +++ b/tools/make_release.py @@ -44,6 +44,17 @@ with open(f_library_json) as f: with open(f_library_json, 'w') as f: f.write(fdata) +################### +# sonar-project.properties +################### +f_sonar_properties = 'sonar-project.properties' +with open(f_sonar_properties) as f: + fdata = f.read() + fdata = re.sub(r'(sonar\.projectVersion=)\d+\.\d+\.\d+', rf'\1{version}', fdata) + +with open(f_sonar_properties, 'w') as f: + f.write(fdata) + ################### # docs/info/changelog.rst ################### -- cgit v1.3.1 From 42f000df8e52cfe0a46867a5e1fa5817cd58bc8a Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 25 Oct 2025 17:36:01 +0700 Subject: iar cstat require cmake at least 4.1 --- .github/workflows/static_analysis.yml | 19 +++++++++++++++---- examples/build_system/cmake/toolchain/arm_iar.cmake | 1 + hw/bsp/family_support.cmake | 8 ++++---- 3 files changed, 20 insertions(+), 8 deletions(-) (limited to '.github/workflows/static_analysis.yml') diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index e060dfbc9..0af8ac42c 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -202,23 +202,34 @@ jobs: with: toolchain: 'arm-iar' - - name: Run IAR C-STAT Analysis + - name: Install CMake 4.2 + run: | + # IAR CSTAT requires CMake >= 4.1 + wget -q https://github.com/Kitware/CMake/releases/download/v4.2.0-rc1/cmake-4.2.0-rc1-linux-x86_64.tar.gz + tar -xzf cmake-4.2.0-rc1-linux-x86_64.tar.gz + echo "${{ github.workspace }}/cmake-4.2.0-rc1-linux-x86_64/bin" >> $GITHUB_PATH + + - name: Build and run IAR C-STAT Analysis env: IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }} run: | # CMake run post build to generate C-STAT SARIF report + cmake --version mkdir -p build - cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DTOOLCHAIN=iar -DIAR_CSTAT=1 -DCMAKE_BUILD_TYPE=MinSizeRel + cmake examples/device/cdc_msc -B build -G Ninja -DBOARD=${{ matrix.board }} -DTOOLCHAIN=iar -DIAR_CSTAT=1 -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build + # Merge sarif files for codeql upload + npm i -g @microsoft/sarif-multitool + npx @microsoft/sarif-multitool merge --merge-runs --output-file iar-cstat-${{ matrix.board }}.sarif build/cstat_sarif/*.sarif - name: Upload SARIF uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: build/cstat_sarif + sarif_file: iar-cstat-${{ matrix.board }}.sarif category: IAR-CStat - name: Upload artifact uses: actions/upload-artifact@v5 with: name: iar-cstat-${{ matrix.board }} - path: build/cstat_sarif + path: iar-cstat-${{ matrix.board }}.sarif diff --git a/examples/build_system/cmake/toolchain/arm_iar.cmake b/examples/build_system/cmake/toolchain/arm_iar.cmake index 42b057020..f4c0a500e 100644 --- a/examples/build_system/cmake/toolchain/arm_iar.cmake +++ b/examples/build_system/cmake/toolchain/arm_iar.cmake @@ -19,6 +19,7 @@ find_program(CMAKE_IAR_CHECKS ichecks) find_program(CMAKE_IAR_REPORT ireport) if (IAR_CSTAT) +cmake_minimum_required(VERSION 4.1) set(CMAKE_C_ICSTAT ${CMAKE_IAR_CSTAT} --checks=${CMAKE_CURRENT_LIST_DIR}/cstat_sel_checks.txt --db=${CMAKE_BINARY_DIR}/cstat.db --sarif_dir=${CMAKE_BINARY_DIR}/cstat_sarif) endif () diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index 79a9f459b..912e0f4d7 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -300,10 +300,10 @@ function(family_configure_common TARGET RTOS) COMMAND_EXPAND_LISTS ) # generate C-STAT report - add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/cstat_report - COMMAND ireport --db=${CMAKE_BINARY_DIR}/cstat.db --full --project ${TARGET} --output ${CMAKE_CURRENT_BINARY_DIR}/cstat_report/index.html - ) +# add_custom_command(TARGET ${TARGET} POST_BUILD +# COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/cstat_report +# COMMAND ireport --db=${CMAKE_BINARY_DIR}/cstat.db --full --project ${TARGET} --output ${CMAKE_CURRENT_BINARY_DIR}/cstat_report/index.html +# ) endif () endif () -- cgit v1.3.1 From 8865ec47814628ba1c50e52f09b7ef2fe10d463d Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 27 Oct 2025 12:09:33 +0700 Subject: update static_analysis.yml workflow --- .github/workflows/static_analysis.yml | 21 ++++++++++++++++++--- sonar-project.properties | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) (limited to '.github/workflows/static_analysis.yml') diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 0af8ac42c..83eea5283 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -2,15 +2,30 @@ name: Static Analysis on: workflow_dispatch: push: - branches: - - master + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'hw/bsp/**' + - '.github/workflows/static_analysis.yml' pull_request: - types: [opened, synchronize, reopened] + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'hw/bsp/**' + - '.github/workflows/static_analysis.yml' permissions: actions: read contents: read security-events: write +# pull-requests: write +# checks: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: CodeQL: diff --git a/sonar-project.properties b/sonar-project.properties index d797bfe6f..5a19a234d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -9,6 +9,7 @@ sonar.projectVersion=0.19.0 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. #sonar.sources=. +sonar.exclusions=lib/**,hw/mcu/**,test/** # Encoding of the source code. Default is default system encoding #sonar.sourceEncoding=UTF-8 -- cgit v1.3.1 From 621123b9b3709bfd1768778f5d526498549eadae Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 28 Oct 2025 00:16:40 +0700 Subject: added .pvsconfig to exclude some rules --- .PVS-Studio/.pvsconfig | 1 + .github/workflows/static_analysis.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .PVS-Studio/.pvsconfig (limited to '.github/workflows/static_analysis.yml') diff --git a/.PVS-Studio/.pvsconfig b/.PVS-Studio/.pvsconfig new file mode 100644 index 000000000..b722c6d10 --- /dev/null +++ b/.PVS-Studio/.pvsconfig @@ -0,0 +1 @@ +//-V::2506,2514 diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 83eea5283..5d2a6c962 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -137,7 +137,7 @@ jobs: mkdir -p build cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build - pvs-studio-analyzer analyze -f build/compile_commands.json -j --exclude-path hw/mcu/ --exclude-path lib/ + pvs-studio-analyzer analyze -R .PVS-Studio/.pvsconfig -f build/compile_commands.json --exclude-path hw/mcu/ --exclude-path lib/ -j plog-converter -t sarif -o pvs-studio-${{ matrix.board }}.sarif PVS-Studio.log - name: Upload SARIF -- cgit v1.3.1 From 78bd6230649aee3f7731ffbce603742f31c2295e Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 28 Oct 2025 17:56:07 +0700 Subject: filter out sarif for codeql hw/mcu and lib/ --- .github/workflows/static_analysis.yml | 43 ++++++++++++----------------------- 1 file changed, 15 insertions(+), 28 deletions(-) (limited to '.github/workflows/static_analysis.yml') diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 5d2a6c962..7e74f77ce 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -65,36 +65,23 @@ jobs: uses: github/codeql-action/analyze@v4 with: category: CodeQL - upload: always + upload: false id: analyze -# - name: Filter out unwanted errors and warnings -# uses: advanced-security/filter-sarif@v1 -# with: -# patterns: | -# -**:cpp/path-injection -# -**:cpp/world-writable-file-creation -# -**:cpp/poorly-documented-function -# -**:cpp/potentially-dangerous-function -# -**:cpp/use-of-goto -# -**:cpp/integer-multiplication-cast-to-long -# -**:cpp/comparison-with-wider-type -# -**:cpp/leap-year/* -# -**:cpp/ambiguously-signed-bit-field -# -**:cpp/suspicious-pointer-scaling -# -**:cpp/suspicious-pointer-scaling-void -# -**:cpp/unsigned-comparison-zero -# -**/third*party/** -# -**/3rd*party/** -# -**/external/** -# input: ${{ steps.analyze.outputs.sarif-output }}/cpp.sarif -# output: ${{ steps.analyze.outputs.sarif-output }}/cpp.sarif -# -# - name: Upload SARIF -# uses: github/codeql-action/upload-sarif@v4 -# with: -# sarif_file: ${{ steps.analyze.outputs.sarif-output }} -# category: CodeQL + - name: Filter SARIF report + uses: advanced-security/filter-sarif@v1 + with: + patterns: | + -hw/mcu/** + -lib/** + input: ${{ steps.analyze.outputs.sarif-output }}/cpp.sarif + output: ${{ steps.analyze.outputs.sarif-output }}/cpp.sarif + + - name: Upload SARIF + uses: github/codeql-action/upload-sarif@v4 + with: + sarif_file: ${{ steps.analyze.outputs.sarif-output }} + category: CodeQL - name: Upload artifact uses: actions/upload-artifact@v5 -- cgit v1.3.1