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 env: # Test runs never reach the telemetry server: no live-count ping, no uploads (docs/telemetry.md). HORIZON_TELEMETRY_URL: "off" 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 env: BASE_SHA: ${{ inputs.base }} run: | # main's script: one written before a fix to it left a real .local/horizon-client without sounds.json on # the runner, and every later job there failed `subtitle`. A branch that changes the script runs its own. set -euo pipefail if git rev-parse --verify -q origin/main >/dev/null \ && git diff --quiet "$(git merge-base "$BASE_SHA" HEAD)" HEAD -- tools/ci/vanilla-data.sh; then git show origin/main:tools/ci/vanilla-data.sh > "$RUNNER_TEMP/vanilla-data.sh" bash "$RUNNER_TEMP/vanilla-data.sh" else bash tools/ci/vanilla-data.sh fi - name: The prepared output is the one the preparer's OUTPUT_VERSION says env: BASE_SHA: ${{ inputs.base }} run: python3 tools/prepare_output.py check --cache --base "$BASE_SHA" - name: The version constants are the pinned jar's run: python3 tools/gen_version_consts.py --check - name: The harnesses this change can affect env: PARITY_HOSTS: '' BASE_SHA: ${{ inputs.base }} run: | # main's selection (tools/parity.py --changed --list with main's parity.py and parity_reach.py), so a # branch made before a better selection landed gets it too; the head's own runner then runs those # harnesses. A branch that changes the selection itself selects with its own code. set -euo pipefail own() { python3 tools/parity.py --changed "$BASE_SHA" --timeout 2400; } # world_spawn takes ~1480 s on a busy runner fork_point=$(git merge-base "$BASE_SHA" HEAD) if ! git rev-parse --verify -q origin/main >/dev/null || ! git diff --quiet "$fork_point" HEAD -- tools/parity.py tools/parity_reach.py; then own exit fi had_reach=$(git ls-files tools/parity_reach.py) git show origin/main:tools/parity.py > tools/parity.py git show origin/main:tools/parity_reach.py > tools/parity_reach.py status=0 python3 tools/parity.py --changed "$BASE_SHA" --list > .local/parity-selection.txt || status=$? git checkout -- tools/parity.py if [ -n "$had_reach" ]; then git checkout -- tools/parity_reach.py; else rm -f tools/parity_reach.py; fi cat .local/parity-selection.txt if [ "$status" != 0 ]; then echo "main's selection failed: the head's own selection runs" own exit fi names=$(sed '$d' .local/parity-selection.txt | grep -E '^[A-Za-z0-9_#]+$' || true) # The summary line says how many would run: a count that doesn't match the names read (a format change) # must not let the job pass untested. expected=$(tail -1 .local/parity-selection.txt | sed -nE 's/^([0-9]+) of [0-9]+ harnesses would run$/\1/p') count=$(printf '%s' "$names" | grep -c . || true) if [ -z "$expected" ] || [ "$expected" != "$count" ]; then echo "main's selection listed $count names, its summary says '${expected:-?}': the head's own selection runs" own exit fi if [ "$count" = 0 ]; then echo "Nothing to run." exit 0 fi # shellcheck disable=SC2086 python3 tools/parity.py $names --timeout 2400 - 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