@@ -67,10 +67,10 @@ jobs:
6767 # Convert the race into a bounded wait: poll the index's mcpp.lua until
6868 # it carries the released version (<=15 min), then let every job run.
6969 # Non-workflow_run triggers (manual, cron, PR) skip the wait.
70- wait-index :
70+ resolve-version :
7171 runs-on : ubuntu-latest
7272 if : ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
73- timeout-minutes : 20
73+ timeout-minutes : 5
7474 outputs :
7575 version : ${{ steps.resolve.outputs.version }}
7676 steps :
@@ -91,10 +91,19 @@ jobs:
9191 esac
9292 echo "version=$VER" >> "$GITHUB_OUTPUT"
9393 echo "version under test: $VER"
94+
95+ wait-index :
96+ needs : resolve-version
97+ runs-on : ubuntu-latest
98+ if : ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
99+ timeout-minutes : 20
100+ outputs :
101+ version : ${{ needs.resolve-version.outputs.version }}
102+ steps :
94103 - name : Wait for the PUBLISHED index artifact to track the released mcpp
95104 if : ${{ github.event_name == 'workflow_run' }}
96105 env :
97- VER : ${{ steps .resolve.outputs.version }}
106+ VER : ${{ needs .resolve-version .outputs.version }}
98107 run : |
99108 # Poll the ARTIFACT, not the git file.
100109 #
@@ -537,7 +546,10 @@ jobs:
537546 # from BOTH sides: refused before `brew trust`, accepted after.
538547 macos-brew-fresh :
539548 name : macOS fresh install (Homebrew, ${{ matrix.image }})
549+ needs : resolve-version
540550 if : ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
551+ env :
552+ MCPP_PIN : ${{ needs.resolve-version.outputs.version }}
541553 # Same two images as macos-fresh: the formula declares `depends_on macos:
542554 # :sonoma` + arm64, macos-14 is the oldest image satisfying it, and
543555 # xcode-27 is macOS 27, the newest release.
@@ -561,6 +573,27 @@ jobs:
561573 [ "$(sw_vers -productVersion | cut -d. -f1)" = 27 ] || { echo "::error::xcode-27 delivered macOS $(sw_vers -productVersion), not 27"; exit 1; }
562574 fi
563575
576+ # The tap's update is asynchronous, independently of the xlings index.
577+ # Read its published formula without tapping, so the one-liner below
578+ # still exercises a machine that has never added this tap.
579+ - name : Wait for the tap to carry the version under test
580+ run : |
581+ set -euo pipefail
582+ deadline=$((SECONDS + 600))
583+ ready=false
584+ while (( SECONDS < deadline )); do
585+ formula=$(curl -fsSL --retry 2 --retry-all-errors --max-time 30 \
586+ https://raw.githubusercontent.com/mcpp-community/homebrew-mcpp/main/Formula/mcpp-m.rb 2>/dev/null || true)
587+ version=$(printf '%s\n' "$formula" | sed -nE 's/^[[:space:]]*version "([^"]+)".*/\1/p' | head -1)
588+ if [ "$version" = "$MCPP_PIN" ]; then
589+ ready=true
590+ break
591+ fi
592+ echo "Waiting for tap: expected $MCPP_PIN, observed ${version:-unavailable}"
593+ sleep 15
594+ done
595+ [ "$ready" = true ] || { echo "::error::the tap never published mcpp $MCPP_PIN"; exit 1; }
596+
564597 # ① The command README.md documents, on a machine that has never tapped.
565598 # Fully qualified, so Homebrew treats it as explicit intent.
566599 - name : " Documented one-liner installs"
@@ -570,8 +603,8 @@ jobs:
570603 # runtime, so a bare symlink into the Cellar would make MCPP_HOME the
571604 # versioned Cellar dir and `brew upgrade` would drop every installed
572605 # toolchain. Assert the binary on PATH is brew's and reports the
573- # version the FORMULA declares — not a hardcoded one, which would go
574- # stale on every release.
606+ # exact release selected for every installation job. Agreement with
607+ # an old formula alone does not validate the new release.
575608 - name : " Installed binary is brew's, and agrees with the formula"
576609 run : |
577610 set -euo pipefail
@@ -583,8 +616,9 @@ jobs:
583616 formula_version="$(brew info --json=v2 mcpp-community/mcpp/mcpp-m \
584617 | python3 -c 'import json,sys; print(json.load(sys.stdin)["formulae"][0]["versions"]["stable"])')"
585618 echo "formula declares: $formula_version"
619+ test "$formula_version" = "$MCPP_PIN"
586620 mcpp --version
587- mcpp --version | grep -Fq "$formula_version "
621+ test "$( mcpp --version)" = "mcpp $MCPP_PIN "
588622
589623 # ③ THE TRUST GATE, from the failing side first.
590624 #
@@ -620,7 +654,8 @@ jobs:
620654 brew install mcpp-m # short form
621655 brew uninstall --force mcpp-m
622656 brew install mcpp-community/mcpp/mcpp # the `mcpp` alias
623- brew upgrade mcpp-m || true # no-op when current; must not be refused
657+ brew upgrade mcpp-m # no-op when current; must not be refused
658+ test "$(mcpp --version)" = "mcpp $MCPP_PIN"
624659
625660 # ⑤ The only assertion a user actually cares about: it builds and runs.
626661 # Exercises the launcher's MCPP_HOME/MCPP_VENDORED_XLINGS pinning,
0 commit comments