Skip to content

Commit ceddd90

Browse files
committed
Create allboards.yml for all boards test
1 parent 237a3fe commit ceddd90

File tree

2 files changed

+152
-0
lines changed

2 files changed

+152
-0
lines changed

.github/scripts/find_all_boards.sh

Lines changed: 35 additions & 0 deletions
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

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Boards Test - Remote trigger
2+
3+
# The workflow will run on schedule and labeled pull requests
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+
# This step makes the contents of the repository available to the workflow
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
with:
21+
ref: ${{ github.event.client_payload.branch }}
22+
23+
- name: Get boards fqbns
24+
run:
25+
bash .github/scripts/find_all_boards.sh
26+
27+
setup-chunks:
28+
needs: find-boards
29+
runs-on: ubuntu-latest
30+
if: needs.find-boards.outputs.fqbns != ''
31+
32+
outputs:
33+
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
34+
test-chunk-ids: ${{ steps['set-test-chunks-ids'].outputs['test-chunks-ids'] }}
35+
36+
steps:
37+
- uses: actions/checkout@v3
38+
- run: npm install
39+
- name: Setup jq
40+
uses: dcarbone/install-jq-action@v1.0.1
41+
42+
- id: set-test-chunks
43+
name: Set Chunks
44+
run:
45+
echo "test-chunks<<EOF" >> $GITHUB_OUTPUT
46+
47+
echo "$( jq -nc '${{ needs.find-boards.outputs.fqbns }} | [_nwise( ${{ needs.find-boards.outputs.board-count }}/15 | ceil)]')" >> $GITHUB_OUTPUT
48+
49+
echo "EOF" >> $GITHUB_OUTPUT
50+
51+
- id: set-test-chunks-ids
52+
name: Set Chunk IDs
53+
run:
54+
echo "$(echo $CHUNKS | jq -M 'to_entries | map(.key)')"
55+
56+
echo "test-chunks-ids<<EOF" >> $GITHUB_OUTPUT
57+
58+
echo "$(echo $CHUNKS | jq -M 'to_entries | map(.key)')" >> $GITHUB_OUTPUT
59+
60+
echo "EOF" >> $GITHUB_OUTPUT
61+
env:
62+
CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
63+
64+
- name: Echo chunks
65+
run:
66+
echo $CHUNK
67+
env:
68+
CHUNK: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
69+
70+
- name: Echo chunks ids
71+
run:
72+
echo $CHUNKID
73+
env:
74+
CHUNKID: ${{ steps['set-test-chunks-ids'].outputs['test-chunks-ids'] }}
75+
76+
77+
test-boards:
78+
needs: setup-chunks
79+
runs-on: ubuntu-latest
80+
81+
env:
82+
REPOSITORY: |
83+
- source-path: '.'
84+
name: "espressif:esp32"
85+
86+
strategy:
87+
fail-fast: false
88+
matrix:
89+
chunk: ${{ fromJSON(needs.setup-chunks.outputs['test-chunks']) }}
90+
91+
steps:
92+
# This step makes the contents of the repository available to the workflow
93+
- name: Checkout repository
94+
uses: actions/checkout@v3
95+
96+
- name: Echo FQBNS to file
97+
run:
98+
echo "$FQBN" > fqbns.json
99+
env:
100+
FQBN: ${{ toJSON(matrix.chunk) }}
101+
102+
- name: Compile sketch
103+
uses: P-R-O-C-H-Y/compile-sketches@development
104+
with:
105+
platforms: |
106+
${{ env.REPOSITORY }}
107+
multiple-fqbn: true
108+
multiple-fqbn-path: "fqbns.json"
109+
use-json-file: false
110+
enable-deltas-report: false
111+
enable-warnings-report: false
112+
cli-compile-flags: |
113+
- --warnings="all"
114+
sketch-paths:
115+
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
116+
117+
#jq -nc '["espressif:esp32:esp32s3","espressif:esp32:esp32c3","espressif:esp32:esp32s2","espressif:esp32:esp32","espressif:esp32:esp32da"] | _nwise(15)'

0 commit comments

Comments
 (0)