Skip to content

Commit 2397aff

Browse files
committed
Run codeql anaysis on all platforms
Add codeql to esp32-build.yaml workflow Add codeql to pico-build.yaml workflow Add codeql to stm32-build.yaml workflow Add codeql to wasm-build.yaml workflow Signed-off-by: Winford <winford@object.stream>
1 parent 0578eb4 commit 2397aff

File tree

5 files changed

+99
-0
lines changed

5 files changed

+99
-0
lines changed

.github/workflows/esp32-build.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@ jobs:
3131
esp-idf:
3232
runs-on: ubuntu-24.04
3333
container: espressif/idf:${{ matrix.idf-version }}
34+
permissions:
35+
actions: read
36+
contents: read
37+
security-events: write
3438

3539
strategy:
3640
fail-fast: false
3741

3842
matrix:
3943
esp-idf-target: ["esp32", "esp32c3"]
44+
language: ['cpp']
4045
idf-version:
4146
- 'v5.0.7'
4247
- 'v5.1.5'
@@ -53,6 +58,16 @@ jobs:
5358
- name: Checkout repo
5459
uses: actions/checkout@v4
5560

61+
- name: "Git config safe.directory for codeql"
62+
run: git config --global --add safe.directory /__w/AtomVM/AtomVM
63+
64+
- name: "Initialize CodeQL"
65+
uses: github/codeql-action/init@v3
66+
with:
67+
languages: ${{matrix.language}}
68+
build-mode: manual
69+
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql
70+
5671
- name: Build with idf.py
5772
shell: bash
5873
working-directory: ./src/platforms/esp32/
@@ -69,6 +84,9 @@ jobs:
6984
. $IDF_PATH/export.sh
7085
idf.py size-components
7186
87+
- name: "Perform CodeQL Analysis"
88+
uses: github/codeql-action/analyze@v3
89+
7290
- name: Install dependencies to build host AtomVM and run qemu
7391
run: |
7492
set -eu

.github/workflows/pico-build.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ on:
2525
- 'src/libAtomVM/**'
2626

2727
permissions:
28+
actions: read
2829
contents: write
30+
security-events: write
2931

3032
concurrency:
3133
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
@@ -37,6 +39,7 @@ jobs:
3739
strategy:
3840
matrix:
3941
board: ["pico", "pico_w", "pico2"]
42+
language: ["cpp"]
4043

4144
steps:
4245
- name: Checkout repo
@@ -52,6 +55,16 @@ jobs:
5255
libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib \
5356
erlang-base erlang-dev erlang-dialyzer erlang-eunit rebar3
5457
58+
- name: "Git config safe.directory for codeql"
59+
run: git config --global --add safe.directory /__w/AtomVM/AtomVM
60+
61+
- name: "Initialize CodeQL"
62+
uses: github/codeql-action/init@v3
63+
with:
64+
languages: ${{matrix.language}}
65+
build-mode: manual
66+
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql
67+
5568
- name: Build
5669
shell: bash
5770
working-directory: ./src/platforms/rp2/
@@ -62,6 +75,9 @@ jobs:
6275
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }}
6376
ninja
6477
78+
- name: "Perform CodeQL Analysis"
79+
uses: github/codeql-action/analyze@v3
80+
6581
- name: Install nvm and nodejs 20
6682
if: matrix.board != 'pico2'
6783
run: |

.github/workflows/stm32-build.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ concurrency:
2727
jobs:
2828
stm32:
2929
runs-on: ubuntu-24.04
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
3035
steps:
3136
- uses: actions/cache@v4
3237
id: builddeps-cache
@@ -63,6 +68,16 @@ jobs:
6368
- name: Checkout repo
6469
uses: actions/checkout@v4
6570

71+
- name: "Git config safe.directory for codeql"
72+
run: git config --global --add safe.directory /__w/AtomVM/AtomVM
73+
74+
- name: "Initialize CodeQL"
75+
uses: github/codeql-action/init@v3
76+
with:
77+
languages: 'cpp'
78+
build-mode: manual
79+
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql
80+
6681
- name: Build
6782
shell: bash
6883
working-directory: ./src/platforms/stm32/
@@ -73,3 +88,6 @@ jobs:
7388
# -DAVM_WARNINGS_ARE_ERRORS=ON
7489
cmake .. -DCMAKE_TOOLCHAIN_FILE=cmake/arm-toolchain.cmake -DLIBOPENCM3_DIR=/home/runner/libopencm3
7590
make -j
91+
92+
- name: "Perform CodeQL Analysis"
93+
uses: github/codeql-action/analyze@v3

.github/workflows/wasm-build.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,38 @@ concurrency:
3030
cancel-in-progress: true
3131

3232
jobs:
33+
3334
compile_tests:
35+
3436
runs-on: ubuntu-24.04
3537
container: erlang:27
38+
permissions:
39+
actions: read
40+
contents: read
41+
security-events: write
42+
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
language: ["c-cpp"]
47+
3648
steps:
3749
- name: Checkout repo
3850
uses: actions/checkout@v4
3951

4052
- name: Install required packages
4153
run: apt update && apt install -y gperf zlib1g-dev cmake ninja-build
4254

55+
- name: "Git config safe.directory for codeql"
56+
run: git config --global --add safe.directory /__w/AtomVM/AtomVM
57+
58+
- name: "Initialize CodeQL"
59+
uses: github/codeql-action/init@v3
60+
with:
61+
languages: ${{matrix.language}}
62+
build-mode: manual
63+
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql
64+
4365
- name: Compile AtomVM and test modules
4466
run: |
4567
set -e
@@ -49,6 +71,9 @@ jobs:
4971
# test_eavmlib does not work with wasm due to http + ssl test
5072
ninja AtomVM atomvmlib erlang_test_modules test_etest test_alisp test_estdlib hello_world run_script call_cast html5_events wasm_webserver
5173
74+
- name: "Perform CodeQL Analysis"
75+
uses: github/codeql-action/analyze@v3
76+
5277
- name: Upload AtomVM and test modules
5378
uses: actions/upload-artifact@v4
5479
with:
@@ -80,6 +105,7 @@ jobs:
80105
needs: compile_tests
81106
runs-on: ubuntu-24.04
82107
container: emscripten/emsdk
108+
83109
steps:
84110
- name: Checkout repo
85111
uses: actions/checkout@v4
@@ -145,13 +171,30 @@ jobs:
145171
wasm_build_web:
146172
runs-on: ubuntu-24.04
147173
container: emscripten/emsdk
174+
permissions:
175+
actions: read
176+
contents: read
177+
security-events: write
178+
179+
strategy:
180+
fail-fast: false
181+
matrix:
182+
language: ["javascript-typescript"]
183+
148184
steps:
149185
- name: Checkout repo
150186
uses: actions/checkout@v4
151187

152188
- name: "Install deps"
153189
run: sudo apt update -y && sudo apt install -y cmake gperf
154190

191+
- name: "Initialize CodeQL"
192+
uses: github/codeql-action/init@v3
193+
with:
194+
languages: ${{matrix.language}}
195+
build-mode: none
196+
db-location: '${{ github.runner_temp }}/codeql_js_database'
197+
155198
- name: Build wasm build for web
156199
shell: bash
157200
working-directory: ./src/platforms/emscripten/
@@ -162,6 +205,9 @@ jobs:
162205
emcmake cmake .. -DAVM_EMSCRIPTEN_ENV=web
163206
emmake make -j
164207
208+
- name: "Perform CodeQL Analysis"
209+
uses: github/codeql-action/analyze@v3
210+
165211
- name: Upload wasm build for web
166212
uses: actions/upload-artifact@v4
167213
with:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3333
- Added `code:is_loaded/1` and `code:which/1`
3434
- Added several `io_lib` functions including `io_lib:fwrite/2` and `io_lib:write_atom/1`
3535
- Added `init:get_argument/1`, `init:get_plain_arguments/0` and `init:notify_when_started/1`
36+
- Added CodeQL analysis to esp32, stm32, pico, and wasm workflows
3637

3738
### Fixed
3839
- ESP32: improved sntp sync speed from a cold boot.

0 commit comments

Comments
 (0)