Skip to content

Boards Test

Boards Test #153

Workflow file for this run

name: Boards Test
# The workflow will run on:
# - Schedule (every Sunday at 4 AM UTC) - tests ALL boards
# - Manual dispatch - tests ALL boards with optional CodeQL
# - Pull requests with boards.txt changes - tests only NEW/MODIFIED boards
on:
workflow_dispatch:
inputs:
codeql:
description: "Enable CodeQL Analysis"
default: false
type: "boolean"
required: true
schedule:
- cron: "0 4 * * SUN"
pull_request:
paths:
- "boards.txt"
- ".github/workflows/boards.yml"
- ".github/scripts/find_boards.sh"
env:
# It's convenient to set variables for values used multiple times in the workflow
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
setup-chunks:
runs-on: ubuntu-latest
outputs:
fqbns: ${{ env.FQBNS }}
board-count: ${{ env.BOARD-COUNT }}
test-mode: ${{ env.TEST_MODE }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup jq
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
- name: Determine test mode and find boards
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "TEST_MODE=new" >> "$GITHUB_ENV"
bash .github/scripts/find_boards.sh new ${{ github.repository }} ${{github.base_ref}}
else
echo "TEST_MODE=all" >> "$GITHUB_ENV"
bash .github/scripts/find_boards.sh all
fi
- id: set-test-chunks
name: Set Chunks
run: |
echo "test-chunks<<EOF" >> $GITHUB_OUTPUT
echo "$( jq -nc '${{ env.FQBNS }} | [_nwise( ${{ env.BOARD-COUNT }}/15 | ceil)]')" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
test-boards:
needs: setup-chunks
runs-on: ubuntu-latest
env:
REPOSITORY: |
- source-path: '.'
name: "espressif:esp32"
strategy:
fail-fast: false
matrix:
chunk: ${{ fromJSON(needs.setup-chunks.outputs.test-chunks) }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Echo FQBNS to file
run: echo "$FQBN" > fqbns.json
env:
FQBN: ${{ toJSON(matrix.chunk) }}
- name: Check if build.board is uppercase
run: |
# Read FQBNs from the JSON file and check each one
invalid_boards=""
while IFS= read -r fqbn; do
board_name=$(echo "$fqbn" | awk -F':' '{print $NF}')
if grep -q "^$board_name.build.board=[A-Z0-9_]*$" boards.txt; then
echo "$board_name.build.board is valid.";
else
echo "Error: $board_name.build.board is not uppercase!";
invalid_boards="$invalid_boards$board_name "
fi
done < <(jq -r '.[]' fqbns.json)
# If any boards are invalid, print them all and fail
if [ -n "$invalid_boards" ]; then
echo "The following boards have non-uppercase build.board entries:"
echo "$invalid_boards"
exit 1;
fi
- name: Get libs cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
key: libs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package/package_esp32_index.template.json', 'tools/get.py') }}
path: |
./tools/dist
./tools/esp32-arduino-libs
./tools/esptool
./tools/mk*
./tools/openocd-esp32
./tools/riscv32-*
./tools/xtensa-*
- name: Initialize CodeQL
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
if: ${{ inputs.codeql }}
with:
languages: cpp
build-mode: manual
config-file: ./.github/codeql/codeql-config.yml
- name: Compile sketch
uses: P-R-O-C-H-Y/compile-sketches@a62f069b92dc8f5053da4ac439ea6d1950cf6379 # main
with:
platforms: |
${{ env.REPOSITORY }}
multiple-fqbn: true
multiple-fqbn-path: "fqbns.json"
use-json-file: false
enable-deltas-report: false
enable-warnings-report: false
cli-compile-flags: |
- --warnings="all"
exit-on-fail: ${{ github.event_name == 'pull_request' }}
sketch-paths: "- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
verbose: true
- name: Run CodeQL Analysis
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
if: ${{ inputs.codeql }}
with:
check_name: "CodeQL Boards"