Skip to content

Commit 6d148e8

Browse files
committed
validate regenerated evidence tip in CI
1 parent 511cd49 commit 6d148e8

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: ou-validation-post-build
2+
3+
on:
4+
workflow_run:
5+
workflows: ["build"]
6+
types: [completed]
7+
8+
# Evidence commits are pushed by GITHUB_TOKEN, so their push event does not
9+
# recursively start CI. workflow_dispatch is explicitly allowed to create a
10+
# new run from GITHUB_TOKEN, which lets us validate the exact tip that the
11+
# completed build/evidence pipeline left on main.
12+
permissions:
13+
actions: write
14+
contents: read
15+
16+
jobs:
17+
validate-current-main:
18+
if: github.event.workflow_run.head_branch == 'main'
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- name: Dispatch smoke validation for the current main tip
22+
env:
23+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
run: |
25+
gh workflow run ou-validation.yml \
26+
--repo "${{ github.repository }}" \
27+
--ref main \
28+
-f validation_mode=smoke

tests/validation/test_workflow_contract.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
REPO_ROOT = Path(__file__).resolve().parents[2]
66
WORKFLOW = REPO_ROOT / ".github" / "workflows" / "ou-validation.yml"
7+
POST_BUILD_WORKFLOW = (
8+
REPO_ROOT / ".github" / "workflows" / "ou-validation-post-build.yml"
9+
)
710

811

912
class WorkflowContractTests(unittest.TestCase):
@@ -48,6 +51,19 @@ def test_failure_message_cannot_run_after_a_push(self):
4851
self.assertNotIn("The regenerated bundle is committed, but", workflow)
4952
self.assertNotIn("Fail if the manuscript no longer matches", workflow)
5053

54+
def test_completed_main_build_dispatches_smoke_for_current_tip(self):
55+
workflow = POST_BUILD_WORKFLOW.read_text(encoding="utf-8")
56+
primary = WORKFLOW.read_text(encoding="utf-8")
57+
58+
self.assertIn("workflow_dispatch:", primary)
59+
self.assertIn("workflow_run:", workflow)
60+
self.assertIn('workflows: ["build"]', workflow)
61+
self.assertIn("head_branch == 'main'", workflow)
62+
self.assertIn("actions: write", workflow)
63+
self.assertIn("gh workflow run ou-validation.yml", workflow)
64+
self.assertIn("--ref main", workflow)
65+
self.assertIn("-f validation_mode=smoke", workflow)
66+
5167

5268
if __name__ == "__main__":
5369
unittest.main()

0 commit comments

Comments
 (0)