mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 01:34:29 +01:00
ci(nightly): enable automated daily schedule and Stage 2 signer dispatch
This commit is contained in:
4 files changed
+31
-16
No files matched your search
@@ -118,7 +118,9 @@
|
||||
}
|
||||
},
|
||||
"max_artifact_bytes": 2147483648,
|
||||
"automatic_signer_actors": [],
|
||||
"automatic_signer_actors": [
|
||||
"github-actions[bot]"
|
||||
],
|
||||
"platforms": {
|
||||
"windows-x86_64": {
|
||||
"unsigned_artifact_name": "nightly-unsigned-windows-x86_64",
|
||||
|
||||
@@ -11,9 +11,9 @@ permissions: {}
|
||||
|
||||
jobs:
|
||||
dispatch:
|
||||
# SOURCE PREPARATION: literal off until immutable shared tooling and policy qualification.
|
||||
# Enabled for automated scheduled producer completions on main.
|
||||
if: >-
|
||||
false && github.repository == 'storytold/vectorcraft' &&
|
||||
github.repository == 'storytold/vectorcraft' &&
|
||||
github.event_name == 'workflow_run'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
name: VectorCraft unsigned nightly
|
||||
|
||||
# Enabled for supervised manual runs by the reviewed manual actor only; no schedule yet.
|
||||
# A later explicit opt-in may add a cadence (and turn on nightly-dispatch.yml with it).
|
||||
# Automated daily nightly builds at 06:30 UTC, plus supervised manual runs by reviewed manual actors.
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 6 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
|
||||
@@ -244,15 +244,21 @@ class TrustedSourcePreparation(unittest.TestCase):
|
||||
self.assertTrue(literal_off("${{ false }}"))
|
||||
self.assertTrue(literal_off("false && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')"))
|
||||
|
||||
def test_no_nightly_schedule_is_registered(self):
|
||||
for name, event in (("nightly.yml", "workflow_dispatch"),
|
||||
("nightly-sign.yml", "workflow_dispatch")):
|
||||
def test_nightly_triggers_and_schedule_contract(self):
|
||||
expected_triggers = {
|
||||
"nightly.yml": [" schedule:", " workflow_dispatch:"],
|
||||
"nightly-sign.yml": [" workflow_dispatch:"],
|
||||
}
|
||||
for name, expected in expected_triggers.items():
|
||||
source = (ROOT / ".github/workflows" / name).read_text()
|
||||
events = source.split("\non:\n", 1)[1].split("\npermissions:", 1)[0]
|
||||
triggers = [line for line in events.splitlines() if line.startswith(" ")
|
||||
and not line.startswith(" ") and line.strip() and not line.lstrip().startswith("#")]
|
||||
with self.subTest(workflow=name):
|
||||
self.assertEqual(triggers, [f" {event}:"], "schedule/activation needs explicit review")
|
||||
self.assertEqual(triggers, expected, "workflow triggers must match the reviewed schedule contract")
|
||||
producer = (ROOT / ".github/workflows/nightly.yml").read_text()
|
||||
crons = re.findall(r"(?m)^ - cron: '([^']+)'$", producer)
|
||||
self.assertEqual(crons, ["30 6 * * *"], "scheduled nightly cadence must stay at 06:30 UTC")
|
||||
|
||||
def test_signer_serialization_contract_is_enforced(self):
|
||||
assert_nightly_serialization((ROOT / ".github/workflows/nightly-sign.yml").read_text())
|
||||
@@ -387,7 +393,8 @@ class NightlyEnabledCallers(unittest.TestCase):
|
||||
source = (ROOT / ".github/workflows/nightly.yml").read_text()
|
||||
policy = json.loads(INSTALLED_POLICY.read_text())
|
||||
self.assertEqual(reviewed_manual_actors(source, policy), RELEASE_MANAGERS)
|
||||
self.assertEqual(policy["automatic_signer_actors"], [], "no automatic signer without a schedule")
|
||||
self.assertEqual(policy["automatic_signer_actors"], ["github-actions[bot]"],
|
||||
"scheduled dispatch signs only as github-actions[bot]")
|
||||
|
||||
def test_an_actor_outside_the_release_managers_is_refused(self):
|
||||
source = (ROOT / ".github/workflows/nightly.yml").read_text()
|
||||
@@ -863,19 +870,24 @@ def dispatch_triggers(source):
|
||||
|
||||
|
||||
class NightlyDispatchTransport(unittest.TestCase):
|
||||
"""The scheduled transport stays literally off and can only reach the signer branch."""
|
||||
"""The scheduled transport keeps its exact context guard and can only reach the signer branch."""
|
||||
|
||||
EXPECTED_GUARD = "github.repository == 'storytold/vectorcraft' && github.event_name == 'workflow_run'"
|
||||
|
||||
def setUp(self):
|
||||
self.source = (ROOT / ".github/workflows/nightly-dispatch.yml").read_text()
|
||||
|
||||
def test_every_dispatch_job_is_literal_off(self):
|
||||
def test_dispatch_job_keeps_exact_context_guard(self):
|
||||
jobs = self.source.split("\njobs:\n", 1)[1]
|
||||
headers = re.findall(r"(?m)^ (?![\s#])[^\n]+", jobs)
|
||||
conditions = job_conditions(jobs)
|
||||
self.assertTrue(headers)
|
||||
self.assertEqual(len(conditions), len(headers), "every job needs a literal-off condition")
|
||||
for _, expression in conditions:
|
||||
self.assertTrue(literal_off(expression), "nightly activation requires reviewed test update")
|
||||
self.assertEqual(headers, [" dispatch:"])
|
||||
self.assertEqual(len(conditions), 1, "dispatch job needs its exact context guard")
|
||||
indicator, expression = conditions[0]
|
||||
self.assertEqual(indicator, ">-")
|
||||
self.assertEqual(" ".join(expression.split()), self.EXPECTED_GUARD,
|
||||
"dispatch context guard may only change with review")
|
||||
self.assertFalse(literal_off(expression), "scheduled dispatch transport must be enabled")
|
||||
|
||||
def test_only_a_completed_scheduled_producer_is_transported(self):
|
||||
self.assertEqual(re.findall(r"(?m)^ workflows: (.+)$", self.source),
|
||||
|
||||
Reference in new issue
Block a user