From 228306f883c2188d3515e80b32d275202e6c9024 Mon Sep 17 00:00:00 2001 From: Andrew Quenehen Date: Sun, 2 Aug 2026 22:08:15 -0300 Subject: [PATCH] ci(switch): run workflow content gate in headless suite Path-gate the Lua gate file and invoke it from scripts/test.sh T0. Co-authored-by: Cursor --- .github/workflows/ci.yml | 2 +- docs/switch-build.md | 5 +++-- scripts/test.sh | 1 + tests/switch_ci_workflows_test.lua | 10 ++++++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6664b63c..f1d43a38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,7 +120,7 @@ jobs: echo "changed=true" >> "$GITHUB_OUTPUT" exit 0 fi - if git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -Eq '^(scripts/build_switch\.sh$|scripts/switch/|docs/switch-build\.md$|\.github/workflows/(ci|release|switch-artifact-comment)\.yml$)'; then + if git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -Eq '^(scripts/build_switch\.sh$|scripts/switch/|docs/switch-build\.md$|tests/switch_ci_workflows_test\.lua$|\.github/workflows/(ci|release|switch-artifact-comment)\.yml$)'; then echo "changed=true" >> "$GITHUB_OUTPUT" else echo "changed=false" >> "$GITHUB_OUTPUT" diff --git a/docs/switch-build.md b/docs/switch-build.md index c534b32b..e4fbd4a3 100644 --- a/docs/switch-build.md +++ b/docs/switch-build.md @@ -132,8 +132,9 @@ Switch packaging has three automated surfaces (same policy as AD-010): ### Path-gated PR / push CI (`.github/workflows/ci.yml`) When a change touches Switch packaging paths -(`scripts/build_switch.sh`, `scripts/switch/**`, `docs/switch-build.md`, or the -Switch-related workflow YAML), CI runs: +(`scripts/build_switch.sh`, `scripts/switch/**`, `docs/switch-build.md`, +`tests/switch_ci_workflows_test.lua`, or the Switch-related workflow YAML), CI +runs: 1. **Offline selftest** on `ubuntu-latest` (forks **and** the canonical repo): `scripts/switch/selftest_build_switch.sh`, diff --git a/scripts/test.sh b/scripts/test.sh index ed3ac9d9..109eab89 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -65,6 +65,7 @@ run_tier() { # ------- ROM-free tiers: these are what CI runs +run_tier "T0 switch CI workflow content gate" "$LUA" tests/switch_ci_workflows_test.lua run_tier "T1/T2 engine invariants + parity gates" "$LUA" tests/run_engine.lua run_tier "T4 mod-SDK" "$LUA" tests/run_modkit.lua diff --git a/tests/switch_ci_workflows_test.lua b/tests/switch_ci_workflows_test.lua index 509c09f4..e5433296 100644 --- a/tests/switch_ci_workflows_test.lua +++ b/tests/switch_ci_workflows_test.lua @@ -22,9 +22,9 @@ local function mustNotContain(body, needle, label) label .. " must not contain " .. string.format("%q", needle)) end --- Exact path regex contract from design.md (SWCI-01 / 4A). +-- Exact path regex contract (SWCI-01 / 4A + SWFIX-03 test path). local SWITCH_PATH_REGEX = - [[^(scripts/build_switch\.sh$|scripts/switch/|docs/switch-build\.md$|\.github/workflows/(ci|release|switch-artifact-comment)\.yml$)]] + [[^(scripts/build_switch\.sh$|scripts/switch/|docs/switch-build\.md$|tests/switch_ci_workflows_test\.lua$|\.github/workflows/(ci|release|switch-artifact-comment)\.yml$)]] local ci = read(".github/workflows/ci.yml") local release = read(".github/workflows/release.yml") @@ -136,6 +136,12 @@ mustContain(development, "selftest_build_switch.sh", "switch-development.md") mustContain(readme, "CI vs release", "README.md") mustContain(readme, "switch-build.md", "README.md") +-- --- SWFIX-03: headless suite also runs the content gate --- +local test_sh = read("scripts/test.sh") +mustContain(test_sh, "tests/switch_ci_workflows_test.lua", "scripts/test.sh") +mustContain(test_sh, "T0 switch CI workflow content gate", "scripts/test.sh") +mustContain(build_doc, "tests/switch_ci_workflows_test.lua", "switch-build.md path list") + -- --- SWCI-08: release Switch hard-fail (no continue-on-error on build/stage) --- do local start = release:find("- name: Build Switch", 1, true)