66 - master
77 pull_request :
88 types : [opened, synchronize, reopened]
9+
10+ permissions :
11+ actions : read
12+ contents : read
13+ security-events : write
14+
915jobs :
10- # SonarQube:
11- # name: Build and analyze
12- # runs-on: ubuntu-latest
13- # env:
14- # BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
15- # steps:
16- # - uses: actions/checkout@v4
16+ CodeQL :
17+ runs-on : ubuntu-latest
18+ strategy :
19+ fail-fast : false
20+ matrix :
21+ board :
22+ - ' raspberry_pi_pico'
23+ steps :
24+ - name : Checkout TinyUSB
25+ uses : actions/checkout@v4
26+
27+ - name : Get Dependencies
28+ uses : ./.github/actions/get_deps
29+ with :
30+ arg : -b${{ matrix.board }}
31+
32+ - name : Setup Toolchain
33+ uses : ./.github/actions/setup_toolchain
34+ with :
35+ toolchain : ' arm-gcc'
36+
37+ - name : Initialize CodeQL
38+ uses : github/codeql-action/init@v4
39+ with :
40+ languages : ' c-cpp'
41+ queries : security-and-quality
42+
43+ - name : Build
44+ run : |
45+ cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel
46+ cmake --build build
47+
48+ - name : Perform CodeQL Analysis
49+ uses : github/codeql-action/analyze@v4
50+ with :
51+ category : CodeQL
52+ upload : always
53+ id : step1
54+
55+ # - name: Filter out unwanted errors and warnings
56+ # uses: advanced-security/filter-sarif@v1
1757# with:
18- # fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
19- # - name: Install Build Wrapper
20- # uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6
21- # - name: Run Build Wrapper
22- # run: |
23- # build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset ${{ env.BOARD }} -t ${{ env.EXAMPLE }}
24- # - name: SonarQube Scan
25- # uses: SonarSource/sonarqube-scan-action@v6
26- # env:
27- # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
58+ # patterns: |
59+ # -**:cpp/path-injection
60+ # -**:cpp/world-writable-file-creation
61+ # -**:cpp/poorly-documented-function
62+ # -**:cpp/potentially-dangerous-function
63+ # -**:cpp/use-of-goto
64+ # -**:cpp/integer-multiplication-cast-to-long
65+ # -**:cpp/comparison-with-wider-type
66+ # -**:cpp/leap-year/*
67+ # -**:cpp/ambiguously-signed-bit-field
68+ # -**:cpp/suspicious-pointer-scaling
69+ # -**:cpp/suspicious-pointer-scaling-void
70+ # -**:cpp/unsigned-comparison-zero
71+ # -**/third*party/**
72+ # -**/3rd*party/**
73+ # -**/external/**
74+ # input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
75+ # output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
76+ #
77+ # - name: Upload SARIF
78+ # uses: github/codeql-action/upload-sarif@v4
2879# with:
29- # args: >
30- # --define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
80+ # sarif_file: ${{ steps.step1.outputs.sarif-output }}
81+ # category: CodeQL
82+
3183 PVS-Studio :
3284 runs-on : ubuntu-latest
3385 strategy :
@@ -49,14 +101,17 @@ jobs:
49101 with :
50102 toolchain : ' arm-gcc'
51103
52- - name : Analyze
104+ - name : Install Tools
53105 run : |
54106 wget -q -O - https://files.pvs-studio.com/etc/pubkey.txt | sudo apt-key add -
55107 sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.pvs-studio.com/etc/viva64.list
56108 sudo apt update
57109 sudo apt install pvs-studio
58110 pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }}
59- cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_BUILD_TYPE=MinSizeRel
111+
112+ - name : Analyze
113+ run : |
114+ cmake examples -B build -G Ninja -DBOARD=${{ matrix.board }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MinSizeRel
60115 cmake --build build
61116 pvs-studio-analyzer analyze -f build/compile_commands.json -j --exclude-path hw/mcu/ --exclude-path lib/
62117 plog-converter -t sarif -o pvs.sarif PVS-Studio.log
@@ -66,3 +121,25 @@ jobs:
66121 with :
67122 sarif_file : pvs.sarif
68123 category : PVS-Studio
124+
125+ # SonarQube:
126+ # name: Build and analyze
127+ # runs-on: ubuntu-latest
128+ # env:
129+ # BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
130+ # steps:
131+ # - uses: actions/checkout@v4
132+ # with:
133+ # fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
134+ # - name: Install Build Wrapper
135+ # uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6
136+ # - name: Run Build Wrapper
137+ # run: |
138+ # build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset ${{ env.BOARD }} -t ${{ env.EXAMPLE }}
139+ # - name: SonarQube Scan
140+ # uses: SonarSource/sonarqube-scan-action@v6
141+ # env:
142+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
143+ # with:
144+ # args: >
145+ # --define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
0 commit comments