Files
pulse/scripts/tests/test_release_train_ci_contract.py
pulse-triage[bot] 3413b37940 fix(ci): include release trains in build and E2E triggers
PR #1921 targets release/v6.4 but receives only docs and boundary checks because build and E2E triggers still name the historical release branch. Include versioned release trains for push and pull request events without changing job gates or path filters. A focused regression fails all four event/workflow combinations before repair and passes after it.

Change-source: pulse-maintainer
2026-09-06 00:58:57 +01:00

37 lines
1.5 KiB
Python

"""Release trains must receive the same CI triggers as main."""
import fnmatch
from pathlib import Path
import re
import unittest
ROOT = Path(__file__).resolve().parents[2]
class ReleaseTrainCIContractTest(unittest.TestCase):
def test_build_and_e2e_cover_release_train_pushes_and_proposals(self):
for workflow in ("build-and-test.yml", "test-e2e.yml"):
source = (ROOT / ".github/workflows" / workflow).read_text()
for event in ("push", "pull_request"):
with self.subTest(workflow=workflow, event=event):
block = re.search(
rf"^ {event}:\n(.*?)(?=^ \w|^\S|\Z)",
source, re.MULTILINE | re.DOTALL,
)
self.assertIsNotNone(block)
branches = re.search(
r"^ branches:\n((?: - .*\n)+)",
block.group(1), re.MULTILINE,
)
self.assertIsNotNone(branches)
patterns = [line.strip()[2:].strip('\"\'')
for line in branches.group(1).splitlines()]
for branch in ("main", "release/v6.4", "release/v7.0"):
self.assertTrue(
any(fnmatch.fnmatchcase(branch, p) for p in patterns),
f"{workflow} {event} excludes {branch}: {patterns}",
)
if __name__ == "__main__":
unittest.main()