Skip to content

CI - All boards test #8114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/scripts/find_all_boards.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# Get all boards
boards_array=()

for line in `grep '.tarch=' boards.txt`; do
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
boards_array+=("espressif:esp32:$board_name")
echo "Added 'espressif:esp32:$board_name' to array"
done

# Create JSON like string with all boards found and pass it to env variable
board_count=${#boards_array[@]}
echo "Boards found: $board_count"
echo "BOARD-COUNT=$board_count" >> $GITHUB_ENV

if [ $board_count -gt 0 ]
then
json_matrix='['
for board in ${boards_array[@]}
do
json_matrix+='"'$board'"'
if [ $board_count -gt 1 ]
then
json_matrix+=","
fi
board_count=$(($board_count - 1))
done
json_matrix+=']'

echo $json_matrix
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV
else
echo "FQBNS=" >> $GITHUB_ENV
fi
86 changes: 86 additions & 0 deletions .github/workflows/allboards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Boards Test - Remote trigger

# The workflow will run on remote dispath with event-type set to "test-boards"
on:
repository_dispatch:
types: [test-boards]

jobs:
find-boards:
runs-on: ubuntu-latest

outputs:
fqbns: ${{ env.FQBNS }}
board-count: ${{ env.BOARD-COUNT }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.branch }}

- name: Get boards fqbns
run:
bash .github/scripts/find_all_boards.sh

setup-chunks:
needs: find-boards
runs-on: ubuntu-latest
if: needs.find-boards.outputs.fqbns != ''

outputs:
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}

steps:
- uses: actions/checkout@v3
- run: npm install
- name: Setup jq
uses: dcarbone/install-jq-action@v1.0.1

- id: set-test-chunks
name: Set Chunks
run:
echo "test-chunks<<EOF" >> $GITHUB_OUTPUT

echo "$( jq -nc '${{ needs.find-boards.outputs.fqbns }} | [_nwise( ${{ needs.find-boards.outputs.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@v3

- name: Echo FQBNS to file
run:
echo "$FQBN" > fqbns.json
env:
FQBN: ${{ toJSON(matrix.chunk) }}

- name: Compile sketch
uses: P-R-O-C-H-Y/compile-sketches@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"
sketch-paths:
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"