Engine version watch #41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Engine version watch | |
| # Reconciles the engine versions BAR actually runs (from the synced BYAR-Chobby | |
| # dist_cfg) against the macOS builds we maintain, and surfaces what needs human | |
| # action as a single tracking issue. It never builds or relabels anything itself: | |
| # a new engine version's macOS back-port needs per-version conflict/build/ | |
| # determinism work, and promoting a version to the macOS default must be gated on | |
| # confirming that build actually syncs. So this only detects and reports. | |
| # | |
| # Two things it watches for: | |
| # - New version: upstream references an engine version with no macos-<version> | |
| # branch yet -> needs onboarding via the back-port recipe. | |
| # - Promotion: the production ("Alpha") engine version no longer matches what | |
| # the macOS dropdown marks stable -> the darwin setups need relabelling. | |
| on: | |
| schedule: | |
| - cron: "41 5 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| concurrency: | |
| group: engine-version-watch | |
| cancel-in-progress: false | |
| env: | |
| CONFIG_URL: https://raw.githubusercontent.com/ExaDev/BYAR-Chobby/main/dist_cfg/config.json | |
| ISSUE_TITLE: "macOS engine version watch" | |
| jobs: | |
| watch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Reconcile upstream engine versions against macOS builds | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| curl -fsSL "$CONFIG_URL" -o /tmp/config.json | |
| norm() { sed 's/^recoil_//'; } | |
| # Engine versions referenced by the upstream (non-darwin) setups: the | |
| # versions BAR's autohosts run, hence the ones we must have a macOS | |
| # build for. | |
| # Engine version lives at .launch.engine for upstream setups | |
| # ("recoil_<ver>") and .downloads.engines[] for our darwin setups. | |
| WANTED="$(jq -r ' | |
| [ .setups[] | |
| | select((.package.platform // .platform) != "darwin") | |
| | (.launch.engine? , .engine? , (.downloads.engines[]?) ) | |
| ] | map(select(. != null)) | unique | .[]' /tmp/config.json | norm | sort -u)" | |
| # Production engine = the version the "Alpha" setup points at. | |
| PROD="$(jq -r ' | |
| [ .setups[] | |
| | select((.package.display // .display) == "Alpha") | |
| | (.launch.engine? , .engine? , (.downloads.engines[]?) ) | |
| ] | map(select(. != null)) | unique | .[0] // ""' /tmp/config.json | norm)" | |
| # The version our macOS dropdown currently labels "stable". | |
| DARWIN_STABLE="$(jq -r ' | |
| [ .setups[] | |
| | select((.package.platform // .platform) == "darwin") | |
| | select(((.package.display // .display) // "") | test("stable"; "i")) | |
| | (.downloads.engines[]?) ] | map(select(. != null)) | .[0] // ""' /tmp/config.json | norm)" | |
| git fetch origin --quiet --prune | |
| HAVE="$(git for-each-ref --format='%(refname:short)' 'refs/remotes/origin/macos-[0-9]*' | sed 's#^origin/macos-##' | sort -u)" | |
| echo "wanted=[$(echo $WANTED)] have=[$(echo $HAVE)] prod=$PROD darwin_stable=$DARWIN_STABLE" | |
| MISSING="" | |
| for v in $WANTED; do | |
| grep -qxF "$v" <<<"$HAVE" || MISSING="$MISSING $v" | |
| done | |
| MISSING="$(echo $MISSING | xargs -n1 2>/dev/null | sort -u | xargs || true)" | |
| PROMOTION="" | |
| if [ -n "$PROD" ] && [ -n "$DARWIN_STABLE" ] && [ "$PROD" != "$DARWIN_STABLE" ]; then | |
| PROMOTION="yes" | |
| fi | |
| BODY="$(mktemp)" | |
| { | |
| echo "_Automated by engine-version-watch. Last checked $(date -u +%FT%TZ)._" | |
| echo | |
| echo "- Upstream engine versions: \`$(echo ${WANTED:-none})\`" | |
| echo "- Production (Alpha): \`${PROD:-unknown}\` - macOS dropdown stable: \`${DARWIN_STABLE:-unknown}\`" | |
| echo "- macOS builds present: \`$(echo ${HAVE:-none})\`" | |
| echo | |
| if [ -n "$MISSING" ]; then | |
| echo "## New versions needing a macOS build" | |
| for v in $MISSING; do | |
| echo "- \`$v\` has no \`macos-$v\` branch. Onboard with the back-port recipe:" | |
| echo " 1. \`git worktree add wt -b macos-$v $v\`" | |
| echo " 2. cherry-pick the macOS layer from the newest \`macos-<version>\` branch, resolving conflicts (keep the tag's sim untouched)" | |
| echo " 3. write \`$v\` into \`PINNED_VERSION\`; push \`macos-$v\`" | |
| echo " 4. dispatch \`macos-build-gpu.yml\` (engine_branch=\`macos-$v\`, engine_version=\`$v\`) -> publishes \`engine-macos-arm64-$v\`" | |
| echo " 5. determinism-test before adding/promoting its dropdown entry" | |
| done | |
| echo | |
| fi | |
| if [ -n "$PROMOTION" ]; then | |
| echo "## Promotion pending" | |
| echo "Production is now \`$PROD\` but the macOS dropdown still marks \`$DARWIN_STABLE\` stable." | |
| echo "Once \`engine-macos-arm64-$PROD\` is built and determinism-tested, relabel the darwin setups in BYAR-Chobby \`dist_cfg/config.json\` (\"$PROD\" -> stable / default)." | |
| echo | |
| fi | |
| } > "$BODY" | |
| find_issue() { | |
| gh issue list --repo "$GITHUB_REPOSITORY" --state open --search "$ISSUE_TITLE in:title" \ | |
| --json number,title --jq 'map(select(.title=="'"$ISSUE_TITLE"'")) | .[0].number // ""' | |
| } | |
| NUM="$(find_issue)" | |
| if [ -z "$MISSING" ] && [ -z "$PROMOTION" ]; then | |
| echo "All upstream engine versions have macOS builds and the dropdown is current." | |
| if [ -n "$NUM" ]; then | |
| gh issue close "$NUM" --repo "$GITHUB_REPOSITORY" \ | |
| --comment "Resolved: all upstream engine versions have macOS builds and the dropdown is current." | |
| fi | |
| exit 0 | |
| fi | |
| if [ -n "$NUM" ]; then | |
| gh issue edit "$NUM" --repo "$GITHUB_REPOSITORY" --body-file "$BODY" | |
| echo "Updated tracking issue #$NUM" | |
| else | |
| gh issue create --repo "$GITHUB_REPOSITORY" --title "$ISSUE_TITLE" --body-file "$BODY" | |
| echo "Opened tracking issue" | |
| fi |