Run docs snippets only on macOS and Ubuntu in CI

This commit is contained in:
Nick Sweeting 2026-07-25 14:11:34 -07:00
parent ddad35b85b
commit 0bdb6f116c
No known key found for this signature in database

View File

@ -34,6 +34,7 @@ ENVIRONMENT_RUNNERS = {
"freebsd": "ubuntu-24.04",
"openbsd": "ubuntu-24.04",
}
CI_ENVIRONMENTS = {"ubuntu", "macos"}
SCENARIOS = {"project", "collection", "system", "system-data", "docker", "docker-data"}
FENCE_START = re.compile(r"^(?P<indent>[ \t]*)(?P<fence>`{3,}|~{3,})[ \t]*(?P<info>[^\n]*)$")
HTML_PRE = re.compile(
@ -274,6 +275,7 @@ def matrix() -> dict[str, list[dict[str, str]]]:
snippets = validate_all()
records = load_manifest()
environments = {records[snippet.id]["environment"] for snippet in snippets if records[snippet.id]["disposition"] == "run"}
ci_environments = environments.intersection(CI_ENVIRONMENTS)
include = [
{
"name": environment,
@ -281,12 +283,14 @@ def matrix() -> dict[str, list[dict[str, str]]]:
"runner": ENVIRONMENT_RUNNERS[environment],
}
for environment in ENVIRONMENT_RUNNERS
if environment in environments
if environment in ci_environments
]
assigned_ids = [snippet.id for snippet in snippets if records[snippet.id]["disposition"] == "run"]
assert include, "At least one deterministic documentation example must run in CI"
assert len(set(assigned_ids)) == len(assigned_ids)
assert {entry["environment"] for entry in include} == environments, "Every runnable snippet environment must have exactly one CI lane"
assert {entry["environment"] for entry in include} == ci_environments, (
"Every selected CI documentation environment must have exactly one lane"
)
return {"include": include}