Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
branches: [main]
workflow_dispatch:

# Pull requests cancel superseded runs. Pushes to main queue instead: a run
# on main ends in a release, and cancelling it would skip that version.
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

# Least privilege by default: this workflow executes PR-controlled build code
# (the Justfile and build scripts come from the PR head), so the workflow-wide
Expand Down Expand Up @@ -286,6 +288,7 @@ jobs:
path: |
dist/*/dogfood-*.log
dist/dogfood-install/*.log
dist/dogfood-installer/*.log
if-no-files-found: ignore
retention-days: 7

Expand Down
15 changes: 14 additions & 1 deletion tests/unit/test_release_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import yaml

ROOT = Path(__file__).resolve().parents[2]
JOBS = yaml.safe_load((ROOT / ".github" / "workflows" / "build.yml").read_text(encoding="utf-8"))["jobs"]
WORKFLOW = yaml.safe_load((ROOT / ".github" / "workflows" / "build.yml").read_text(encoding="utf-8"))
JOBS = WORKFLOW["jobs"]
RELEASE = JOBS["release"]
DRY_RUN = JOBS["release-dry-run"]

Expand Down Expand Up @@ -70,3 +71,15 @@ def test_release_attests_files_and_oci_artifact() -> None:
assert RELEASE["permissions"]["id-token"] == "write"
assert RELEASE["permissions"]["attestations"] == "write"
assert not any("id-token" in (job.get("permissions") or {}) for name, job in JOBS.items() if name != "release")


def test_pushes_to_main_never_cancel_a_release_run() -> None:
concurrency = WORKFLOW["concurrency"]
assert concurrency["cancel-in-progress"] == "${{ github.event_name == 'pull_request' }}"


def test_boot_test_uploads_every_harness_log_directory() -> None:
upload = next(s for s in WORKFLOW["jobs"]["boot-test"]["steps"] if s.get("name") == "Upload boot logs")
paths = upload["with"]["path"].split()
for d in ("dist/dogfood-install/", "dist/dogfood-installer/"):
assert any(p.startswith(d) for p in paths), d