From cef652d026166b575c1e9fe85033036c3c897e56 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Mon, 19 Oct 2026 13:58:27 +0200 Subject: [PATCH] checks: verify always runs, so a skipped job can never satisfy main's required check Labels started `checks` runs whose verify job was skipped, and GitHub counts a skipped required check as passed: auto-merge merged #823 and #837 before the real verify finished. Labels no longer start `checks` (the fork-only run-parity label has its own workflow), and verify has no condition. The parity job moves into a reusable workflow both call. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 51 ++++++++------------------------ .github/workflows/parity.yml | 48 ++++++++++++++++++++++++++++++ .github/workflows/run-parity.yml | 20 +++++++++++++ docs/release-flow.md | 19 ++++++++---- 4 files changed, 95 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/parity.yml create mode 100644 .github/workflows/run-parity.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da23874b8..d6577d49e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,23 +1,25 @@ name: checks -# verify: every pull request and every push to main, on GitHub's runners (the repository is public). +# verify: every pull request and every push to main, on GitHub's runners (the repository is public). It is the +# check main requires, so it never has a condition: a skipped job counts as passed, and every run of this workflow +# must report a real verify (a pull request that changes no Rust finishes it in seconds instead). # parity: the vanilla harnesses a pull request's changes can affect, on the Mac mini's runner, which holds the -# maintainer's own Minecraft files (Horizon never downloads the game). A fork's pull request runs it only when -# a maintainer adds the run-parity label, once per label. See docs/release-flow.md. +# maintainer's own Minecraft files (Horizon never downloads the game); .github/workflows/parity.yml. A fork's pull +# request runs it only when a maintainer adds the run-parity label (.github/workflows/run-parity.yml), so labels +# never start this workflow. See docs/release-flow.md. on: push: branches: [main] pull_request: - types: [opened, synchronize, reopened, labeled] + types: [opened, synchronize, reopened] workflow_dispatch: permissions: contents: read concurrency: # A new push to a pull request replaces its running checks; main's runs all finish (releases follow them). - group: checks-${{ github.event.pull_request.number || github.sha }}-${{ github.event.action == 'labeled' && 'label' || 'run' }} + group: checks-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: verify: - if: github.event.action != 'labeled' runs-on: ubuntu-latest timeout-minutes: 30 steps: @@ -62,38 +64,11 @@ jobs: if: steps.rust.outputs.required != 'false' run: cargo +stable test --workspace parity: - if: >- - github.event_name == 'pull_request' && ( - (github.event.pull_request.head.repo.full_name == github.repository && github.event.action != 'labeled') || - (github.event.action == 'labeled' && github.event.label.name == 'run-parity')) - runs-on: [self-hosted, horizon-game] - timeout-minutes: 120 # a change to core crates reruns ~300 harnesses: ~60-90 min on the Mac mini - steps: - - uses: actions/checkout@v4 - with: - # The commit the event names: a fork's later pushes need another run-parity label. - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - persist-credentials: false - # Keeps .local/ (parity state, probe builds, oracle results) and target/ between runs. - clean: false - - uses: dtolnay/rust-toolchain@stable - - name: Tools from the runner - run: bash tools/ci/runner-env.sh - - name: Vanilla data, and resources prepared by this preparer - run: bash tools/ci/vanilla-data.sh - - name: The harnesses this change can affect - env: - PARITY_HOSTS: '' - run: python3 tools/parity.py --changed ${{ github.event.pull_request.base.sha }} --timeout 2400 # world_spawn takes ~1480 s on a busy runner - - name: Logs of the failed harnesses - if: failure() - uses: actions/upload-artifact@v4 - with: - name: parity-logs - path: .local/parity-runner/logs/ - if-no-files-found: ignore - retention-days: 3 + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + uses: ./.github/workflows/parity.yml + with: + base: ${{ github.event.pull_request.base.sha }} + head: ${{ github.event.pull_request.head.sha }} # Horizon never downloads the game. These jobs need a self-hosted Linux runner # (label horizon-game) holding the maintainer's own copy: the official launcher's # game directory in HORIZON_MINECRAFT_DIR and the pinned server jar in diff --git a/.github/workflows/parity.yml b/.github/workflows/parity.yml new file mode 100644 index 000000000..ef03b6df2 --- /dev/null +++ b/.github/workflows/parity.yml @@ -0,0 +1,48 @@ +name: parity +# The vanilla harnesses a pull request's changes can affect, on the Mac mini's runner, which holds the maintainer's +# own Minecraft files (Horizon never downloads the game). Called by ci.yml for pull requests from this repository +# and by run-parity.yml when a maintainer labels a fork's pull request run-parity. See docs/release-flow.md. +on: + workflow_call: + inputs: + base: + description: The pull request's base commit (the harnesses its changes since then can affect) + type: string + required: true + head: + description: The commit to check out and test + type: string + required: true +permissions: + contents: read +jobs: + parity: + runs-on: [self-hosted, horizon-game] + timeout-minutes: 120 # a change to core crates reruns ~300 harnesses: ~60-90 min on the Mac mini + steps: + - uses: actions/checkout@v4 + with: + # The commit the event names: a fork's later pushes need another run-parity label. + ref: ${{ inputs.head }} + fetch-depth: 0 + persist-credentials: false + # Keeps .local/ (parity state, probe builds, oracle results) and target/ between runs. + clean: false + - uses: dtolnay/rust-toolchain@stable + - name: Tools from the runner + run: bash tools/ci/runner-env.sh + - name: Vanilla data, and resources prepared by this preparer + run: bash tools/ci/vanilla-data.sh + - name: The harnesses this change can affect + env: + PARITY_HOSTS: '' + BASE_SHA: ${{ inputs.base }} + run: python3 tools/parity.py --changed "$BASE_SHA" --timeout 2400 # world_spawn takes ~1480 s on a busy runner + - name: Logs of the failed harnesses + if: failure() + uses: actions/upload-artifact@v4 + with: + name: parity-logs + path: .local/parity-runner/logs/ + if-no-files-found: ignore + retention-days: 3 diff --git a/.github/workflows/run-parity.yml b/.github/workflows/run-parity.yml new file mode 100644 index 000000000..fd3cce6f8 --- /dev/null +++ b/.github/workflows/run-parity.yml @@ -0,0 +1,20 @@ +name: run-parity +# A fork's pull request runs the parity job (parity.yml) on the Mac mini only when a maintainer who has read the +# change adds the run-parity label: once, on the commit the pull request has then. Remove the label and add it +# again after new pushes. A separate workflow, so that labels never start `checks`: there a label's run reported a +# skipped `verify`, and GitHub counts a skipped required check as passed. +on: + pull_request: + types: [labeled] +permissions: + contents: read +concurrency: + group: run-parity-${{ github.event.pull_request.number }} + cancel-in-progress: true +jobs: + parity: + if: github.event.label.name == 'run-parity' + uses: ./.github/workflows/parity.yml + with: + base: ${{ github.event.pull_request.base.sha }} + head: ${{ github.event.pull_request.head.sha }} diff --git a/docs/release-flow.md b/docs/release-flow.md index b72d896b8..e5fee9d07 100644 --- a/docs/release-flow.md +++ b/docs/release-flow.md @@ -6,17 +6,26 @@ there is no separate development channel. ## Pull request checks -The `checks` workflow (`.github/workflows/ci.yml`) runs two jobs on every pull request: +The `checks` workflow (`.github/workflows/ci.yml`) runs two jobs on every pull request (opened, pushed to or +reopened; labels never start it): | Job | Runs on | What | Time | | --- | --- | --- | --- | | `verify` | GitHub `ubuntu-latest` | Public-tree check, Python tests, rustfmt, clippy with warnings denied, Rust tests. Dependencies and the workspace build come from a cache saved by main's runs | ~4 min cold, less warm | -| `parity` | The Mac mini's runner (`ludovics-mac-mini`, label `horizon-game`) | The vanilla harnesses the change can affect (`tools/parity.py --changed `) | seconds when nothing is affected; minutes per affected harness | +| `parity / parity` | The Mac mini's runner (`ludovics-mac-mini`, label `horizon-game`) | The vanilla harnesses the change can affect (`tools/parity.py --changed `) | seconds when nothing is affected; minutes per affected harness | Pushes to main run `verify` only; the nightly audit covers main's harnesses. +`verify` is the check main requires, so it has no condition and runs in every run of `checks`: GitHub counts a +*skipped* required check as passed, and labels used to start runs whose `verify` was skipped, which let +auto-merge merge before the real `verify` finished. A pull request that changes no Rust (docs, tools) runs only its +quick steps and finishes in seconds. + ### The parity job +The job is `.github/workflows/parity.yml`, a reusable workflow: `checks` calls it for pull requests from this +repository, `run-parity.yml` for a fork's pull request a maintainer labels `run-parity`. + Horizon never downloads the game, so harnesses that compare with vanilla run only where the maintainer's own copy is: the Mac mini. Its runner runs as the maintainer's account and keeps its checkout between runs (`clean: false`), so the probes build incrementally into `.local/parity-target` and earlier passes stand. @@ -64,11 +73,11 @@ parallel, and main's own `checks` run catches the rare semantic conflict. `parity` becomes required once it has run green on pull requests for a while (a week without a false failure): ```sh -gh api -X POST repos/ludovic111/horizon/branches/main/protection/required_status_checks/contexts -f 'contexts[]=parity' +gh api -X POST repos/ludovic111/horizon/branches/main/protection/required_status_checks/contexts -f 'contexts[]=parity / parity' ``` -A skipped `parity` (a fork without the label, a run started by a label) counts as passed, so requiring it never -blocks a fork's pull request; the maintainer decides whether to run it. +A skipped `parity` (a fork's pull request without the label) counts as passed, so requiring it never blocks a +fork's pull request; the maintainer decides whether to run it. ## Game releases