Skip to content

Commit 948ba20

Browse files
committed
add pvs-studio analyze to ci
1 parent b08f672 commit 948ba20

File tree

2 files changed

+32
-33
lines changed

2 files changed

+32
-33
lines changed

.github/workflows/build_util.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ on:
2020
required: false
2121
default: false
2222
type: boolean
23-
analyze-pvs:
24-
required: false
25-
default: false
26-
type: boolean
2723
os:
2824
required: false
2925
type: string
@@ -72,28 +68,6 @@ jobs:
7268
fi
7369
shell: bash
7470

75-
- name: PVS-Studio analyze
76-
if: ${{ inputs.analyze-pvs }}
77-
run: |
78-
wget -q -O - https://files.pvs-studio.com/etc/pubkey.txt | sudo apt-key add -
79-
sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.pvs-studio.com/etc/viva64.list
80-
sudo apt update
81-
sudo apt install pvs-studio
82-
pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }}
83-
mkdir -p sarif-reports
84-
for build_dir in cmake-build/cmake-build-*; do
85-
BOARD=${build_dir#cmake-build/cmake-build-}
86-
pvs-studio-analyzer analyze -f ${build_dir}/compile_commands.json -j -o ${build_dir}/pvs-report.log --exclude-path hw/mcu/ --exclude-path lib/
87-
plog-converter -t sarif -o sarif-reports/${BOARD}.sarif ${build_dir}/pvs-report.log
88-
done
89-
90-
- name: PVS-Studio upload SARIF
91-
if: ${{ inputs.analyze-pvs }}
92-
uses: github/codeql-action/upload-sarif@v4
93-
with:
94-
sarif_file: sarif-reports/
95-
category: PVS-Studio
96-
9771
- name: Upload Artifacts for Hardware Testing
9872
if: ${{ inputs.upload-artifacts }}
9973
uses: actions/upload-artifact@v4

.github/workflows/static_analysis.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,40 @@ jobs:
2929
# args: >
3030
# --define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
3131
PVS-Studio:
32-
uses: ./.github/workflows/build_util.yml
32+
runs-on: ubuntu-latest
3333
strategy:
3434
fail-fast: false
3535
matrix:
3636
board:
3737
- 'stm32h743eval'
38-
with:
39-
build-system: 'cmake'
40-
toolchain: 'arm-gcc'
41-
build-args: '-b${{ matrix.board }}'
42-
one-per-family: true
43-
analyze-pvs: true
38+
steps:
39+
- name: Checkout TinyUSB
40+
uses: actions/checkout@v4
41+
42+
- name: Get Dependencies
43+
uses: ./.github/actions/get_deps
44+
with:
45+
arg: -b${{ matrix.board }}
46+
47+
- name: Setup Toolchain
48+
uses: ./.github/actions/setup_toolchain
49+
with:
50+
toolchain: 'arm-gcc'
51+
52+
- name: Analyze
53+
run: |
54+
wget -q -O - https://files.pvs-studio.com/etc/pubkey.txt | sudo apt-key add -
55+
sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.pvs-studio.com/etc/viva64.list
56+
sudo apt update
57+
sudo apt install pvs-studio
58+
pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }}
59+
cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_BUILD_TYPE=MinSizeRel
60+
cmake --build build
61+
pvs-studio-analyzer analyze -f build/compile_commands.json -j --exclude-path hw/mcu/ --exclude-path lib/
62+
plog-converter -t sarif -o pvs.sarif PVS-Studio.log
63+
64+
- name: Upload SARIF
65+
uses: github/codeql-action/upload-sarif@v4
66+
with:
67+
sarif_file: pvs.sarif
68+
category: PVS-Studio

0 commit comments

Comments
 (0)