Skip to content

Commit 9d8471d

Browse files
authored
CI - All boards test (espressif#8114)
* Create allboards.yml for all boards test * Clean workflow from unused stuff * Use compile-sketch main * Update find_all_boards.sh
1 parent 2c71406 commit 9d8471d

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

.github/scripts/find_all_boards.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
# Get all boards
4+
boards_array=()
5+
6+
for line in `grep '.tarch=' boards.txt`; do
7+
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
8+
boards_array+=("espressif:esp32:$board_name")
9+
echo "Added 'espressif:esp32:$board_name' to array"
10+
done
11+
12+
# Create JSON like string with all boards found and pass it to env variable
13+
board_count=${#boards_array[@]}
14+
echo "Boards found: $board_count"
15+
echo "BOARD-COUNT=$board_count" >> $GITHUB_ENV
16+
17+
if [ $board_count -gt 0 ]
18+
then
19+
json_matrix='['
20+
for board in ${boards_array[@]}
21+
do
22+
json_matrix+='"'$board'"'
23+
if [ $board_count -gt 1 ]
24+
then
25+
json_matrix+=","
26+
fi
27+
board_count=$(($board_count - 1))
28+
done
29+
json_matrix+=']'
30+
31+
echo $json_matrix
32+
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV
33+
else
34+
echo "FQBNS=" >> $GITHUB_ENV
35+
fi

.github/workflows/allboards.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Boards Test - Remote trigger
2+
3+
# The workflow will run on remote dispath with event-type set to "test-boards"
4+
on:
5+
repository_dispatch:
6+
types: [test-boards]
7+
8+
jobs:
9+
find-boards:
10+
runs-on: ubuntu-latest
11+
12+
outputs:
13+
fqbns: ${{ env.FQBNS }}
14+
board-count: ${{ env.BOARD-COUNT }}
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
with:
20+
ref: ${{ github.event.client_payload.branch }}
21+
22+
- name: Get boards fqbns
23+
run:
24+
bash .github/scripts/find_all_boards.sh
25+
26+
setup-chunks:
27+
needs: find-boards
28+
runs-on: ubuntu-latest
29+
if: needs.find-boards.outputs.fqbns != ''
30+
31+
outputs:
32+
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
- run: npm install
37+
- name: Setup jq
38+
uses: dcarbone/install-jq-action@v1.0.1
39+
40+
- id: set-test-chunks
41+
name: Set Chunks
42+
run:
43+
echo "test-chunks<<EOF" >> $GITHUB_OUTPUT
44+
45+
echo "$( jq -nc '${{ needs.find-boards.outputs.fqbns }} | [_nwise( ${{ needs.find-boards.outputs.board-count }}/15 | ceil)]')" >> $GITHUB_OUTPUT
46+
47+
echo "EOF" >> $GITHUB_OUTPUT
48+
49+
test-boards:
50+
needs: setup-chunks
51+
runs-on: ubuntu-latest
52+
53+
env:
54+
REPOSITORY: |
55+
- source-path: '.'
56+
name: "espressif:esp32"
57+
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
chunk: ${{ fromJSON(needs.setup-chunks.outputs['test-chunks']) }}
62+
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v3
66+
67+
- name: Echo FQBNS to file
68+
run:
69+
echo "$FQBN" > fqbns.json
70+
env:
71+
FQBN: ${{ toJSON(matrix.chunk) }}
72+
73+
- name: Compile sketch
74+
uses: P-R-O-C-H-Y/compile-sketches@main
75+
with:
76+
platforms: |
77+
${{ env.REPOSITORY }}
78+
multiple-fqbn: true
79+
multiple-fqbn-path: "fqbns.json"
80+
use-json-file: false
81+
enable-deltas-report: false
82+
enable-warnings-report: false
83+
cli-compile-flags: |
84+
- --warnings="all"
85+
sketch-paths:
86+
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"

0 commit comments

Comments
 (0)