Require matching green CI before promoting checked release artifacts

This commit is contained in:
waozi committed 2026-10-22 23:25:53 -03:00
1 parent 7020c96143
commit 000415628f
3 files changed
+22 -1

No files matched your search

+7
View File
@@ -136,6 +136,13 @@ jobs:
if (len(matches) != 1 or matches[0]['status'] != 'completed' or
matches[0]['conclusion'] != 'success'):
raise SystemExit(name + ' must have passed for the identical source')
ci_runs = api(f'repos/{repository}/actions/workflows/ci.yml/runs?head_sha={source}&event=push&per_page=100')['workflow_runs']
matching = [item for item in ci_runs if item['head_sha'] == source and
item['path'] == '.github/workflows/ci.yml' and item['event'] == 'push' and
item['head_branch'] == 'master' and item['status'] == 'completed' and
item['conclusion'] == 'success']
if len(matching) != 1:
raise SystemExit('The identical source must also pass CI, including browser add-on smoke tests')
with output.open('a') as stream:
stream.write('reuse_artifacts=true\n')
print('All source, test, visual, platform and F-Droid gates passed; reusing their immutable artifacts')
+1
View File
@@ -841,6 +841,7 @@ A release names one fixed commit while peers keep working on master:
When an earlier Release run already passed every test, visual, platform and
F-Droid reproducibility job for the source, supply its run ID as `reuse_run`.
The identical source must also pass CI, including browser add-on smoke tests.
The workflow admits reuse only when the release commit adds that version's
valid phone-check receipt and changes no other file. It downloads the original
immutable build artifacts for publication and store delivery. A changed source,
+14 -1
View File
@@ -266,7 +266,7 @@ class ReleaseArtifactReuseTest(unittest.TestCase):
self.workflow = workflow
def evaluate(self, *, jobs=None, changed=None, run_changes=None, source_receipt=False,
ancestor=True, phone_passes=True, run_id="123"):
ancestor=True, phone_passes=True, run_id="123", ci_changes=None):
source = "1" * 40
candidate = "2" * 40
run = {"path": ".github/workflows/release.yml", "event": "push", "head_branch": "master",
@@ -280,6 +280,11 @@ class ReleaseArtifactReuseTest(unittest.TestCase):
def read(command, **kwargs):
if command[:2] == ["gh", "api"]:
if '/actions/workflows/ci.yml/runs?' in command[-1]:
ci = dict(head_sha=source, path='.github/workflows/ci.yml', event='push',
head_branch='master', status='completed', conclusion='success')
ci.update(ci_changes or {})
return json.dumps({'workflow_runs': [ci]})
return json.dumps({"jobs": jobs} if command[-1].endswith("/jobs?per_page=100") else run)
if command[:2] == ["git", "diff"]:
self.assertEqual(command[-2:], [source, candidate])
@@ -373,6 +378,14 @@ class ReleaseArtifactReuseTest(unittest.TestCase):
with self.assertRaises(SystemExit):
self.evaluate(source_receipt=True)
def test_ci_and_browser_smoke_must_also_pass_for_the_identical_source(self):
for change in ({"conclusion": "failure"}, {"conclusion": "cancelled"},
{"status": "in_progress"}, {"head_sha": "3" * 40},
{"head_branch": "other"}, {"event": "workflow_dispatch"},
{"path": ".github/workflows/other.yml"}):
with self.subTest(change=change), self.assertRaises(SystemExit):
self.evaluate(ci_changes=change)
def test_reuse_policy_covers_every_declared_build_and_reproducibility_gate(self):
builds = set()
for identifier, body in re.findall(r"^ (build-[a-z-]+):\n(.*?)(?=^ [a-z][a-z-]*:|\Z)",