Skip to content

Fix CodeQL findings: drop dead branches and redundant guards #69

Fix CodeQL findings: drop dead branches and redundant guards

Fix CodeQL findings: drop dead branches and redundant guards #69

Workflow file for this run

name: CI
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
jobs:
build:
name: pio run -e ${{ matrix.env }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
env: [cores3, core2, visu, pip]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Cache PlatformIO core + libraries
uses: actions/cache@v4
with:
path: |
~/.platformio/.cache
~/.platformio/packages
~/.platformio/platforms
.pio
key: pio-${{ runner.os }}-${{ matrix.env }}-${{ hashFiles('platformio.ini') }}
restore-keys: |
pio-${{ runner.os }}-${{ matrix.env }}-
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Build firmware
run: pio run -e ${{ matrix.env }}
- name: Report binary size
run: pio run -e ${{ matrix.env }} -t size | tail -40
test:
name: pio test -e native (pure-logic units)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Run native unit tests
run: pio test -e native --verbose
check:
name: pio check (cppcheck on src/)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Cover both ESP32 (core2) and ESP32-S3 (cores3) header sets;
# visu / pip / pip-s3 share src files with these two so a clean
# check on cores3 + core2 effectively covers all five envs.
env: [cores3, core2]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Cache PlatformIO core + libraries
uses: actions/cache@v4
with:
path: |
~/.platformio/.cache
~/.platformio/packages
~/.platformio/platforms
key: pio-check-${{ runner.os }}-${{ matrix.env }}-${{ hashFiles('platformio.ini') }}
restore-keys: |
pio-check-${{ runner.os }}-${{ matrix.env }}-
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Static analysis (cppcheck via PlatformIO)
# `--pattern "+<src/>"` narrows the scan to OUR source tree.
# Suppressions for third-party preprocessor noise live in
# platformio.ini (check_flags under [check_common]) since they
# apply both to local `pio check` runs and to CI.
# `--severity high --severity medium` filters the noisier
# low-severity warnings; `--fail-on-defect high` turns
# High-severity findings in our code into red CI.
run: pio check -e ${{ matrix.env }} --pattern "+<src/>" --skip-packages --severity high --severity medium --fail-on-defect high