Skip to content

Commit

Permalink
Run codeql anaysis on all platforms
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
UncleGrumpy committed Feb 10, 2025
1 parent a7dbecd commit 54e30a9
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/esp32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ jobs:
esp-idf:
runs-on: ubuntu-24.04
container: espressif/idf:${{ matrix.idf-version }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false

matrix:
esp-idf-target: ["esp32", "esp32c3"]
language: ['cpp']
idf-version:
- 'v5.0.7'
- 'v5.1.5'
Expand All @@ -53,6 +58,16 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: "Git config safe.directory for codeql"
run: git config --global --add safe.directory /__w/AtomVM/AtomVM

- name: "Initialize CodeQL"
uses: github/codeql-action/init@v3
with:
languages: ${{matrix.language}}
build-mode: manual
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql

- name: Build with idf.py
shell: bash
working-directory: ./src/platforms/esp32/
Expand All @@ -69,6 +84,9 @@ jobs:
. $IDF_PATH/export.sh
idf.py size-components
- name: "Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v3

- name: Install dependencies to build host AtomVM and run qemu
run: |
set -eu
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/pico-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ on:
- 'src/libAtomVM/**'

permissions:
actions: read
contents: write
security-events: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
Expand All @@ -37,6 +39,7 @@ jobs:
strategy:
matrix:
board: ["pico", "pico_w"]
language: ["cpp"]

steps:
- name: Checkout repo
Expand All @@ -48,6 +51,16 @@ jobs:
- name: "Install deps"
run: sudo apt install -y cmake gperf ninja-build gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib erlang-base erlang-dialyzer

- name: "Git config safe.directory for codeql"
run: git config --global --add safe.directory /__w/AtomVM/AtomVM

- name: "Initialize CodeQL"
uses: github/codeql-action/init@v3
with:
languages: ${{matrix.language}}
build-mode: manual
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql

- name: Build
shell: bash
working-directory: ./src/platforms/rp2040/
Expand All @@ -58,6 +71,9 @@ jobs:
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }}
ninja
- name: "Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v3

- name: Install nvm and nodejs 20
run: |
set -euo pipefail
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/stm32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ concurrency:
jobs:
stm32:
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
security-events: write

steps:
- uses: actions/cache@v4
id: builddeps-cache
Expand Down Expand Up @@ -63,6 +68,16 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: "Git config safe.directory for codeql"
run: git config --global --add safe.directory /__w/AtomVM/AtomVM

- name: "Initialize CodeQL"
uses: github/codeql-action/init@v3
with:
languages: 'cpp'
build-mode: manual
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql

- name: Build
shell: bash
working-directory: ./src/platforms/stm32/
Expand All @@ -73,3 +88,6 @@ jobs:
# -DAVM_WARNINGS_ARE_ERRORS=ON
cmake .. -DCMAKE_TOOLCHAIN_FILE=cmake/arm-toolchain.cmake -DLIBOPENCM3_DIR=/home/runner/libopencm3
make -j
- name: "Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v3
46 changes: 46 additions & 0 deletions .github/workflows/wasm-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,38 @@ concurrency:
cancel-in-progress: true

jobs:

compile_tests:

runs-on: ubuntu-24.04
container: erlang:27
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["c-cpp"]

steps:
- name: Checkout repo
uses: actions/checkout@v4

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

- name: "Git config safe.directory for codeql"
run: git config --global --add safe.directory /__w/AtomVM/AtomVM

- name: "Initialize CodeQL"
uses: github/codeql-action/init@v3
with:
languages: ${{matrix.language}}
build-mode: manual
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql

- name: Compile AtomVM and test modules
run: |
set -e
Expand All @@ -49,6 +71,9 @@ jobs:
# test_eavmlib does not work with wasm due to http + ssl test
ninja AtomVM atomvmlib test_alisp hello_world run_script call_cast html5_events wasm_webserver
- name: "Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v3

- name: Upload AtomVM and test modules
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -80,6 +105,7 @@ jobs:
needs: compile_tests
runs-on: ubuntu-24.04
container: emscripten/emsdk

steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -147,13 +173,30 @@ jobs:
wasm_build_web:
runs-on: ubuntu-24.04
container: emscripten/emsdk
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["javascript-typescript"]

steps:
- name: Checkout repo
uses: actions/checkout@v4

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

- name: "Initialize CodeQL"
uses: github/codeql-action/init@v3
with:
languages: ${{matrix.language}}
build-mode: none
db-location: '${{ github.runner_temp }}/codeql_js_database'

- name: Build wasm build for web
shell: bash
working-directory: ./src/platforms/emscripten/
Expand All @@ -164,6 +207,9 @@ jobs:
emcmake cmake .. -DAVM_EMSCRIPTEN_ENV=web
emmake make -j
- name: "Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v3

- name: Upload wasm build for web
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added the ability to run beams from the CLI for Generic Unix platform (it was already possible with nodejs and emscripten).
- Added preliminary support for ESP32P4 (no networking support yet).
- CodeQL action runs on all platforms

### Fixed

Expand Down

0 comments on commit 54e30a9

Please sign in to comment.