Skip to content

Commit 4d5fc4b

Browse files
committed
ci: split a port with more than 256 boards into several matrix jobs
GitHub allows 256 configurations per matrix and build-boards.yml runs one matrix per port. espressif reached 257 boards, so every full build fails with "Strategy for job 'board' produced 257 configurations". ci_set_matrix.py now splits such a port into equal parts listed like ports (espressif-1, espressif-2) and a "split_ports" map lets build.yml hand the real port name to build-boards.yml, so the toolchain setup is unchanged. Ports below the limit and the per-board job names are not affected. Fixes adafruit#11324
1 parent e6bf001 commit 4d5fc4b

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,4 @@ jobs:
231231
with:
232232
boards: ${{ toJSON(fromJSON(needs.scheduler.outputs.ports)[matrix.port]) }}
233233
cp-version: ${{ needs.scheduler.outputs.cp-version }}
234-
port: ${{ matrix.port }}
234+
port: ${{ fromJSON(needs.scheduler.outputs.ports).split_ports[matrix.port] || matrix.port }}

tools/ci_set_matrix.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import re
2525
import os
26+
import math
2627
import sys
2728
import json
2829
import pathlib
@@ -68,6 +69,8 @@
6869
r"(?:-stubs|\.(?:md|MD|mk|rst|RST)|/Makefile)$"
6970
)
7071

72+
GITHUB_MATRIX_LIMIT = 256
73+
7174
PATTERN_WINDOWS = {
7275
".github/",
7376
"extmod/",
@@ -267,8 +270,23 @@ def get_settings(board):
267270
port_to_boards_to_build.setdefault(port, []).append(board)
268271
print(" ", board)
269272

273+
# build-boards.yml runs one matrix per port and GitHub allows 256 jobs per matrix.
274+
# Split a bigger port into equal parts, listed like ports; "split_ports" maps a part
275+
# back to the real port name, which build.yml passes on, so the toolchain setup in
276+
# build-boards.yml stays unchanged.
277+
split_ports = {}
278+
for port, boards in list(port_to_boards_to_build.items()):
279+
parts = math.ceil(len(boards) / GITHUB_MATRIX_LIMIT)
280+
if parts > 1:
281+
del port_to_boards_to_build[port]
282+
for index in range(parts):
283+
name = f"{port}-{index + 1}"
284+
port_to_boards_to_build[name] = boards[index::parts]
285+
split_ports[name] = port
286+
270287
if port_to_boards_to_build:
271288
port_to_boards_to_build["ports"] = sorted(list(port_to_boards_to_build.keys()))
289+
port_to_boards_to_build["split_ports"] = split_ports
272290

273291
# Set the step outputs
274292
set_output("ports", json.dumps(port_to_boards_to_build))

0 commit comments

Comments
 (0)