Add explicit board_level = release (#11305)

Relying on board_level = <empty> was causing some inheritence footguns.
Let's be explicit about what's being released.
This commit is contained in:
Austin
2026-07-31 16:04:24 +00:00
committed by GitHub
parent 33a0f8ffb7
commit 76f4340f3a
100 changed files with 159 additions and 14 deletions
+23 -8
View File
@@ -5,8 +5,15 @@
import argparse
import json
import re
from platformio.project.config import ProjectConfig
# Every variant env must declare one of these as its 'board_level':
# pr - smallest subset, built on every PR (and in every larger matrix)
# release - the full release matrix, built on push / schedule / workflow_dispatch
# extra - opt-in only, built when explicitly requested via '--level extra'
BOARD_LEVELS = ("pr", "release", "extra")
parser = argparse.ArgumentParser(description="Generate the CI matrix")
parser.add_argument("platform", help="Platform to build for")
parser.add_argument(
@@ -14,7 +21,7 @@ parser.add_argument(
choices=["extra", "pr"],
nargs="*",
default=[],
help="Board level to build for (omit for full release boards)",
help="Board level to build for (omit for the 'pr' + 'release' matrix)",
)
args = parser.parse_args()
@@ -39,10 +46,20 @@ for pio_env in pio_envs:
if not env_platform:
print(f"Error: Could not determine platform for environment '{pio_env}'")
exit(1)
board_level = cfg.get(f"env:{pio_env}", "board_level", default=None)
# Intentionally fail on a missing or unrecognized level: every env must opt in
# explicitly, so a new variant can't silently drop out of (or into) the matrix.
if board_level not in BOARD_LEVELS:
found = f"'{board_level}'" if board_level else "no value"
print(
f"Error: environment '{pio_env}' has {found} for 'board_level'; "
f"expected one of: {', '.join(BOARD_LEVELS)}"
)
exit(1)
# Store env details as a dictionary, and add to 'all_envs' list
env = {
"ci": {"board": pio_env, "platform": env_platform},
"board_level": cfg.get(f"env:{pio_env}", "board_level", default=None),
"board_level": board_level,
"board_check": cfg.get(f"env:{pio_env}", "board_check", default="false").strip().lower() == "true",
}
all_envs.append(env)
@@ -52,10 +69,8 @@ for pio_env in pio_envs:
if "check" in args.platform:
for env in all_envs:
if env["board_check"]:
if "pr" in args.level:
if env["board_level"] == "pr":
outlist.append(env["ci"])
else:
# '--level pr' narrows to the PR subset; otherwise check every level
if "pr" not in args.level or env["board_level"] == "pr":
outlist.append(env["ci"])
# Filter (non-check) builds by platform
else:
@@ -67,8 +82,8 @@ else:
# Include board_level = 'extra' when requested
elif "extra" in args.level and env["board_level"] == "extra":
outlist.append(env["ci"])
# If no board level is specified, include in release builds (not PR)
elif "pr" not in args.level and not env["board_level"]:
# Include board_level = 'release' unless narrowed to the PR subset
elif "pr" not in args.level and env["board_level"] == "release":
outlist.append(env["ci"])
# Return as a JSON list