CodeQL #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CodeQL" | |
on: | |
push: | |
branches: [master, ] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [master] | |
schedule: | |
- cron: '0 5 * * 1' | |
jobs: | |
analyse: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- example: get_charger_state | |
board: huzzah | |
platform: espressif8266 | |
- example: get_charger_state | |
board: esp-wrover-kit | |
platform: espressif32 | |
name: Analyse ${{ matrix.example }}-${{ matrix.board }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# We must fetch at least the immediate parents so that if this is | |
# a pull request then we can checkout the head. | |
fetch-depth: 2 | |
# If this run was triggered by a pull request event, then checkout | |
# the head of the pull request instead of the merge commit. | |
- run: git checkout HEAD^2 | |
if: ${{ github.event_name == 'pull_request' }} | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: cpp | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install Platform IO | |
run: pip install -U platformio | |
# Force install of the platform, we need to tweak it | |
- name: Install platform | |
run: | |
platformio platform install ${{ matrix.platform }} | |
- name: Enable CodeQL wrappers for Platform IO toolchains | |
if: ${{ matrix.platform != 'native' }} | |
run: | |
| | |
# See https://github.com/github/securitylab/discussions/171 | |
for i in ~/.platformio/packages/toolchain-*/bin/*; do | |
mv "$i" "$i.real"; | |
printf '#!/bin/bash\nexec "'"$i"'.real" ${1+"$@"}\n' > "$i"; | |
chmod +x "$i"; | |
done | |
- name: Install Checked out OpenEVSE_Lib | |
run: | |
pio lib -g install $GITHUB_WORKSPACE | |
- name: Build example | |
run: | | |
cd examples/${{ matrix.example }} | |
pio run -e ${{ matrix.board }} | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 |