Skip to content

Commit 055c9bf

Browse files
committed
split boards dynamically
1 parent 8a10069 commit 055c9bf

File tree

10 files changed

+112
-174
lines changed

10 files changed

+112
-174
lines changed

.github/actions/deps/external/action.yml

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,31 @@ inputs:
99
- cache
1010
- restore
1111

12-
platform:
12+
port:
1313
required: false
1414
default: none
15-
type: choice
16-
options:
17-
- arm
18-
- aarch
19-
- esp
20-
- riscv
21-
- none
15+
type: string
2216

2317
runs:
2418
using: composite
2519
steps:
26-
# aarch
27-
- name: Get aarch toolchain
28-
if: inputs.platform == 'aarch'
29-
run: |
30-
wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
31-
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
32-
sudo apt-get install -y mtools
33-
shell: bash
34-
- name: Install mkfs.fat
35-
if: inputs.platform == 'aarch'
36-
run: |
37-
wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz
38-
tar -xaf dosfstools-4.2.tar.gz
39-
cd dosfstools-4.2
40-
./configure
41-
make -j 2
42-
cd src
43-
echo >> $GITHUB_PATH $(pwd)
44-
shell: bash
45-
4620
# arm
4721
- name: Get arm toolchain
48-
if: inputs.platform == 'aarch' || inputs.platform == 'arm'
22+
if: >-
23+
inputs.port != 'none' &&
24+
inputs.port != 'litex' &&
25+
inputs.port != 'espressif'
4926
uses: carlosperate/arm-none-eabi-gcc-action@v1
5027
with:
5128
release: '10-2020-q4'
5229

53-
# esp
54-
- name: Get esp toolchain
55-
if: inputs.platform == 'esp'
30+
# espressif
31+
- name: Get espressif toolchain
32+
if: inputs.port == 'espressif'
5633
run: sudo apt-get install -y ninja-build
5734
shell: bash
5835
- name: Install IDF tools
59-
if: inputs.platform == 'esp'
36+
if: inputs.port == 'espressif'
6037
run: |
6138
echo "Installing ESP-IDF tools"
6239
$IDF_PATH/tools/idf_tools.py --non-interactive install required
@@ -66,24 +43,16 @@ runs:
6643
rm -rf $IDF_TOOLS_PATH/dist
6744
shell: bash
6845
- name: Set environment
69-
if: inputs.platform == 'esp'
46+
if: inputs.port == 'espressif'
7047
run: |
7148
source $IDF_PATH/export.sh
7249
echo >> $GITHUB_ENV "IDF_PYTHON_ENV_PATH=$IDF_PYTHON_ENV_PATH"
7350
echo >> $GITHUB_PATH "$PATH"
7451
shell: bash
7552

76-
# riscv
77-
- name: Get riscv toolchain
78-
if: inputs.platform == 'riscv'
79-
run: |
80-
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
81-
sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
82-
shell: bash
83-
8453
# common
8554
- name: Cache python dependencies
86-
if: inputs.platform != 'esp'
55+
if: inputs.port != 'espressif'
8756
uses: ./.github/actions/deps/python
8857
with:
8958
action: ${{ inputs.action }}

.github/actions/deps/ports/action.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@ runs:
1919
if [ -z $PORT ]; then (exit 1); else echo >> $GITHUB_OUTPUT "port=$PORT"; fi
2020
shell: bash
2121

22-
- name: Set up espressif port
22+
- name: Set up broadcom
23+
if: steps.board-to-port.outputs.port == 'broadcom'
24+
uses: ./.github/actions/deps/ports/broadcom
25+
26+
- name: Set up espressif
2327
if: steps.board-to-port.outputs.port == 'espressif'
2428
uses: ./.github/actions/deps/ports/espressif
2529

26-
- name: Set up nrf port
30+
- name: Set up litex
31+
if: steps.board-to-port.outputs.port == 'litex'
32+
uses: ./.github/actions/deps/ports/litex
33+
34+
- name: Set up nrf
2735
if: steps.board-to-port.outputs.port == 'nrf'
2836
uses: ./.github/actions/deps/ports/nrf
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Fetch broadcom port deps
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Get broadcom toolchain
7+
run: |
8+
wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-10.3-2021.07-x86_64-broadcom64-none-elf.tar.xz
9+
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-10.3-2021.07-x86_64-broadcom64-none-elf.tar.xz
10+
sudo apt-get install -y mtools
11+
shell: bash
12+
- name: Install mkfs.fat
13+
run: |
14+
wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz
15+
tar -xaf dosfstools-4.2.tar.gz
16+
cd dosfstools-4.2
17+
./configure
18+
make -j 2
19+
cd src
20+
echo >> $GITHUB_PATH $(pwd)
21+
shell: bash
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Fetch litex port deps
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Get litex toolchain
7+
run: |
8+
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
9+
sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
10+
shell: bash

.github/workflows/build-boards-custom.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,6 @@ run-name: ${{ inputs.board }}-${{ inputs.language }}-${{ inputs.version }}${{ in
3232
jobs:
3333
build:
3434
runs-on: ubuntu-22.04
35-
env:
36-
PLATFORM_atmel-samd: arm
37-
PLATFORM_broadcom: aarch
38-
PLATFORM_cxd56: arm
39-
PLATFORM_espressif: esp
40-
PLATFORM_litex: riscv
41-
PLATFORM_mimxrt10xx: arm
42-
PLATFORM_nrf: arm
43-
PLATFORM_raspberrypi: arm
44-
PLATFORM_stm: arm
4535
steps:
4636
- name: Set up repository
4737
run: |
@@ -70,7 +60,7 @@ jobs:
7060
uses: ./.github/actions/deps/external
7161
with:
7262
action: cache
73-
platform: ${{ env[format('PLATFORM_{0}', steps.set-up-port.outputs.port)] }}
63+
port: ${{ steps.set-up-port.outputs.port }}
7464
- name: Set up mpy-cross
7565
if: steps.set-up-submodules.outputs.frozen == 'True'
7666
uses: ./.github/actions/mpy_cross

.github/workflows/build-boards.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ name: Build boards
33
on:
44
workflow_call:
55
inputs:
6-
platform:
7-
required: true
8-
type: string
96
boards:
107
required: true
118
type: string
@@ -38,6 +35,7 @@ jobs:
3835
with:
3936
python-version: 3.x
4037
- name: Set up port
38+
id: set-up-port
4139
uses: ./.github/actions/deps/ports
4240
with:
4341
board: ${{ matrix.board }}
@@ -47,7 +45,7 @@ jobs:
4745
- name: Set up external
4846
uses: ./.github/actions/deps/external
4947
with:
50-
platform: ${{ inputs.platform }}
48+
port: ${{ steps.set-up-port.outputs.port }}
5149
- name: Set up mpy-cross
5250
if: steps.set-up-submodules.outputs.frozen == 'True'
5351
uses: ./.github/actions/mpy_cross

.github/workflows/build.yml

Lines changed: 15 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,9 @@ jobs:
2020
scheduler:
2121
runs-on: ubuntu-20.04
2222
outputs:
23-
build-doc: ${{ steps.set-matrix.outputs.build-doc }}
24-
build-boards: ${{ steps.set-matrix.outputs.build-boards }}
25-
build-windows: ${{ steps.set-matrix.outputs.build-windows }}
26-
boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }}
27-
boards-arm: ${{ steps.set-matrix.outputs.boards-arm }}
28-
boards-atmel: ${{ steps.set-matrix.outputs.boards-atmel }}
29-
boards-esp: ${{ steps.set-matrix.outputs.boards-esp }}
30-
boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }}
23+
docs: ${{ steps.set-matrix.outputs.docs }}
24+
boards: ${{ steps.set-matrix.outputs.boards }}
25+
windows: ${{ steps.set-matrix.outputs.windows }}
3126
cp-version: ${{ steps.set-up-submodules.outputs.version }}
3227
steps:
3328
- name: Dump GitHub context
@@ -99,7 +94,7 @@ jobs:
9994

10095
mpy-cross:
10196
needs: scheduler
102-
if: needs.scheduler.outputs.build-boards == 'True'
97+
if: needs.scheduler.outputs.boards != '{}'
10398
uses: ./.github/workflows/build-mpy-cross.yml
10499
secrets: inherit
105100
with:
@@ -108,7 +103,7 @@ jobs:
108103
mpy-cross-mac:
109104
runs-on: macos-11
110105
needs: scheduler
111-
if: needs.scheduler.outputs.build-boards == 'True'
106+
if: needs.scheduler.outputs.boards != '{}'
112107
env:
113108
CP_VERSION: ${{ needs.scheduler.outputs.cp-version }}
114109
steps:
@@ -160,10 +155,10 @@ jobs:
160155
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
161156
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
162157

163-
build-doc:
158+
docs:
164159
runs-on: ubuntu-22.04
165160
needs: scheduler
166-
if: needs.scheduler.outputs.build-doc == 'True'
161+
if: needs.scheduler.outputs.docs == 'True'
167162
env:
168163
CP_VERSION: ${{ needs.scheduler.outputs.cp-version }}
169164
steps:
@@ -218,10 +213,10 @@ jobs:
218213
[ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi"
219214
[ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/*
220215
221-
build-windows:
216+
windows:
222217
runs-on: windows-2022
223218
needs: scheduler
224-
if: needs.scheduler.outputs.build-windows == 'True'
219+
if: needs.scheduler.outputs.windows == 'True'
225220
env:
226221
CP_VERSION: ${{ needs.scheduler.outputs.cp-version }}
227222
defaults:
@@ -286,52 +281,14 @@ jobs:
286281
# ERROR: Platform MINGW64_NT-10.0-17763-x86_64 appears to be unsupported
287282
# https://github.com/espressif/esp-idf/issues/7062
288283

289-
aarch:
284+
boards:
290285
needs: [scheduler, mpy-cross, tests]
291-
if: ${{ needs.scheduler.outputs.boards-aarch != '[]' }}
286+
if: needs.scheduler.outputs.boards != '{}'
292287
uses: ./.github/workflows/build-boards.yml
293288
secrets: inherit
289+
strategy:
290+
matrix:
291+
port: ${{ fromJSON(needs.scheduler.outputs.boards).ports }}
294292
with:
295-
platform: aarch
296-
boards: ${{ needs.scheduler.outputs.boards-aarch }}
297-
cp-version: ${{ needs.scheduler.outputs.cp-version }}
298-
299-
arm:
300-
needs: [scheduler, mpy-cross, tests]
301-
if: ${{ needs.scheduler.outputs.boards-arm != '[]' }}
302-
uses: ./.github/workflows/build-boards.yml
303-
secrets: inherit
304-
with:
305-
platform: arm
306-
boards: ${{ needs.scheduler.outputs.boards-arm }}
307-
cp-version: ${{ needs.scheduler.outputs.cp-version }}
308-
309-
atmel:
310-
needs: [scheduler, mpy-cross, tests]
311-
if: ${{ needs.scheduler.outputs.boards-atmel != '[]' }}
312-
uses: ./.github/workflows/build-boards.yml
313-
secrets: inherit
314-
with:
315-
platform: arm
316-
boards: ${{ needs.scheduler.outputs.boards-atmel }}
317-
cp-version: ${{ needs.scheduler.outputs.cp-version }}
318-
319-
esp:
320-
needs: [scheduler, mpy-cross, tests]
321-
if: ${{ needs.scheduler.outputs.boards-esp != '[]' }}
322-
uses: ./.github/workflows/build-boards.yml
323-
secrets: inherit
324-
with:
325-
platform: esp
326-
boards: ${{ needs.scheduler.outputs.boards-esp }}
327-
cp-version: ${{ needs.scheduler.outputs.cp-version }}
328-
329-
riscv:
330-
needs: [scheduler, mpy-cross, tests]
331-
if: ${{ needs.scheduler.outputs.boards-riscv != '[]' }}
332-
uses: ./.github/workflows/build-boards.yml
333-
secrets: inherit
334-
with:
335-
platform: riscv
336-
boards: ${{ needs.scheduler.outputs.boards-riscv }}
293+
boards: ${{ toJSON(fromJSON(needs.scheduler.outputs.boards)[matrix.port]) }}
337294
cp-version: ${{ needs.scheduler.outputs.cp-version }}

tools/ci_changes_per_commit.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ def get_commit_depth_and_check_suite(query_commits):
167167

168168

169169
def get_bad_check_runs(query_check_runs):
170+
bad_runs = {}
170171
more_pages = True
171-
bad_runs_by_matrix = {}
172172

173173
run_types = ["failed", "incomplete"]
174174

@@ -184,13 +184,12 @@ def get_bad_check_runs(query_check_runs):
184184

185185
for check_run in check_runs[run_type]["nodes"]:
186186
name = check_run["name"]
187-
res_matrix = regex_matrix.search(name)
188-
if res_matrix:
189-
matrix = name.split(" /", 1)[0]
190-
matrix_job = name.split(" (", 1)[1][:-1]
191-
bad_runs_by_matrix.setdefault(matrix, []).append(matrix_job)
187+
if name.startswith("boards") or regex_matrix.search(name):
188+
matrix = name.split(" ", 1)[0]
189+
matrix_job = name.rsplit(" (", 1)[1][:-1]
190+
bad_runs.setdefault(matrix, []).append(matrix_job)
192191
elif name != "scheduler":
193-
bad_runs_by_matrix[name] = True
192+
bad_runs[name] = True
194193
else:
195194
return {}
196195

@@ -200,7 +199,7 @@ def get_bad_check_runs(query_check_runs):
200199
query_check_runs.variables["include" + run_type_camel] = True
201200
more_pages = True
202201

203-
return bad_runs_by_matrix
202+
return bad_runs
204203

205204

206205
def set_commit(commit):

tools/ci_fetch_deps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ def main():
7878
submodules = ["extmod/ulab", "lib/", "tools/"]
7979
elif TARGET == "tests":
8080
submodules = ["extmod/ulab", "lib/", "tools/"]
81-
elif TARGET == "build-doc":
81+
elif TARGET == "docs":
8282
# used in .readthedocs.yml to generate RTD
8383
submodules = ["extmod/ulab"]
8484
submodules_tags = ["frozen/"]
8585
elif TARGET == "mpy-cross" or TARGET == "mpy-cross-mac":
8686
submodules = ["tools/"] # for huffman
87-
elif TARGET == "build-windows":
87+
elif TARGET == "windows":
8888
# This builds one board from a number of ports so fill out a bunch of submodules
8989
submodules = ["extmod/ulab", "lib/", "tools/", "ports/", "data/nvm.toml"]
9090
elif TARGET == "website":

0 commit comments

Comments
 (0)