|
1 | 1 | name: CodeQL |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [ master, main ] |
6 | 4 | pull_request: |
7 | 5 | branches: [ master, main ] |
| 6 | + push: |
| 7 | + branches: [ master, main ] |
8 | 8 | schedule: |
9 | 9 | - cron: '12 6 * * 0' |
10 | 10 |
|
11 | 11 | jobs: |
12 | 12 | analyze: |
13 | | - name: Analyze (C/C++) |
| 13 | + name: CodeQL (C/C++ via Arduino CLI) |
14 | 14 | runs-on: ubuntu-latest |
15 | 15 | permissions: |
16 | 16 | actions: read |
17 | 17 | contents: read |
18 | 18 | security-events: write |
19 | | - strategy: |
20 | | - fail-fast: false |
21 | | - matrix: |
22 | | - language: [ 'cpp' ] |
| 19 | + env: |
| 20 | + CODEQL_EXTRACTOR_CPP_TRACING: "on" |
23 | 21 | steps: |
24 | 22 | - uses: actions/checkout@v4 |
25 | | - - uses: github/codeql-action/init@v3 |
| 23 | + |
| 24 | + - name: Initialize CodeQL |
| 25 | + uses: github/codeql-action/init@v3 |
26 | 26 | with: |
27 | | - languages: ${{ matrix.language }} |
28 | | - - uses: github/codeql-action/analyze@v3 |
| 27 | + languages: cpp |
| 28 | + build-mode: manual |
| 29 | + |
| 30 | + - name: Set up Arduino CLI |
| 31 | + uses: arduino/setup-arduino-cli@v2 |
| 32 | + with: |
| 33 | + version: "1.x" |
| 34 | + |
| 35 | + - name: Install AVR core |
| 36 | + run: | |
| 37 | + arduino-cli core update-index |
| 38 | + arduino-cli core install arduino:avr |
| 39 | +
|
| 40 | + - name: List example sketches |
| 41 | + id: ex |
| 42 | + shell: bash |
| 43 | + run: | |
| 44 | + EXS=$(find examples -type f -name '*.ino' | sort || true) |
| 45 | + echo "examples<<EOF" >> $GITHUB_OUTPUT |
| 46 | + echo "${EXS}" >> $GITHUB_OUTPUT |
| 47 | + echo "EOF" >> $GITHUB_OUTPUT |
| 48 | + echo "Found sketches:" |
| 49 | + echo "${EXS}" |
| 50 | +
|
| 51 | + - name: Compile examples (arduino:avr:uno) |
| 52 | + if: ${{ steps.ex.outputs.examples != '' }} |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + set -e |
| 56 | + while IFS= read -r SKETCH; do |
| 57 | + echo "==> Building $SKETCH" |
| 58 | + arduino-cli compile --fqbn arduino:avr:uno "$SKETCH" |
| 59 | + done <<< "${{ steps.ex.outputs.examples }}" |
| 60 | +
|
| 61 | + - name: Analyze with CodeQL |
| 62 | + uses: github/codeql-action/analyze@v3 |
0 commit comments