build(macos): pin gz tap unconditionally, add weekly refresh

macos.sh only pinned osrf/simulation when --ci was passed, so dev
machines still hit OSRF's bottle-gap window and built Gazebo from
source. Apply it whenever --sim-tools runs.

The pin is a point-in-time SHA with nothing to advance it, so add a
weekly workflow that checks whether osrf/simulation HEAD is fully
bottled and opens a PR bumping gz-tap-pin.txt when it is.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: FARHANG <farhang.nba@gmail.com>
This commit is contained in:
FARHANG authored and Ramon Roche committed 2026-09-04 13:26:30 -07:00
1 parent 354823e2ef
commit d840da70b6
3 files changed
+113 -18

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@ jobs:
- name: setup
run: |
./Tools/setup/macos.sh --sim-tools --ci
./Tools/setup/macos.sh --sim-tools
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- uses: ./.github/actions/setup-ccache
@@ -0,0 +1,104 @@
name: macOS - Refresh gz tap pin
# Tools/setup/macos.sh pins osrf/simulation to a known-bottled commit so
# --sim-tools installs Gazebo from a binary instead of compiling it (see
# Tools/setup/gz-tap-pin.txt for why). That pin goes stale as OSRF's bot
# rebuilds bottles for newer commits. This checks weekly whether the tap's
# current HEAD is fully bottled and, if so, opens a PR bumping the pin.
on:
schedule:
- cron: '0 9 * * 1' # Mondays at 09:00 UTC
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
check-pin:
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
- name: Tap osrf/simulation
id: tap
run: |
brew tap osrf/simulation
if brew trust --help &> /dev/null; then
brew trust osrf/simulation
fi
GZ_TAP_DIR=$(brew --repo osrf/simulation)
echo "dir=${GZ_TAP_DIR}" >> "$GITHUB_OUTPUT"
echo "head=$(git -C "${GZ_TAP_DIR}" rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Check whether tap HEAD is fully bottled
id: bottled
run: |
# Same package list as the --sim-tools block in macos.sh. Kept in
# sync manually since the formula names aren't easy to extract
# from the script without duplicating its parsing.
PACKAGES=(
exiftool
glog
graphviz
gstreamer
opencv@4
osrf/simulation/gz-harmonic
protobuf
)
if brew install --dry-run --formula "${PACKAGES[@]}" 2>&1 | tee /tmp/dry-run.txt | grep -q "from source"; then
echo "[refresh] tap HEAD (${{ steps.tap.outputs.head }}) would build at least one formula from source, skipping"
echo "fully_bottled=false" >> "$GITHUB_OUTPUT"
else
echo "[refresh] tap HEAD (${{ steps.tap.outputs.head }}) is fully bottled"
echo "fully_bottled=true" >> "$GITHUB_OUTPUT"
fi
- name: Compare against current pin
if: steps.bottled.outputs.fully_bottled == 'true'
id: compare
run: |
CURRENT_PIN=$(grep -v '^#' Tools/setup/gz-tap-pin.txt | tr -d '[:space:]')
NEW_PIN="${{ steps.tap.outputs.head }}"
if [[ "$CURRENT_PIN" == "$NEW_PIN" ]]; then
echo "[refresh] pin is already current (${CURRENT_PIN})"
echo "needs_bump=false" >> "$GITHUB_OUTPUT"
else
echo "[refresh] bumping pin ${CURRENT_PIN} -> ${NEW_PIN}"
echo "needs_bump=true" >> "$GITHUB_OUTPUT"
echo "new_pin=${NEW_PIN}" >> "$GITHUB_OUTPUT"
fi
- name: Open PR with the new pin
if: steps.compare.outputs.needs_bump == 'true'
env:
GH_TOKEN: ${{ secrets.PX4BUILTBOT_PERSONAL_ACCESS_TOKEN }}
NEW_PIN: ${{ steps.compare.outputs.new_pin }}
run: |
git config user.name "px4buildbot"
git config user.email "buildbot@px4.io"
BRANCH="chore/gz-tap-pin-${NEW_PIN:0:12}"
git checkout -b "$BRANCH"
sed -i '' "s/^[0-9a-f]\{40\}$/${NEW_PIN}/" Tools/setup/gz-tap-pin.txt
git add Tools/setup/gz-tap-pin.txt
git commit -m "chore(macos): bump gz tap pin to ${NEW_PIN:0:12}"
git push origin "$BRANCH"
PR_BODY_FILE=$(mktemp)
{
echo "Weekly check found that osrf/simulation HEAD (\`${NEW_PIN}\`) has bottles"
echo "for every formula \`macos.sh --sim-tools\` installs. Bumping"
echo "\`Tools/setup/gz-tap-pin.txt\` to this commit."
echo ""
echo "Verify the compile_macos.yml legs pass before merging."
} > "$PR_BODY_FILE"
gh pr create \
--base main \
--head "$BRANCH" \
--title "chore(macos): bump gz tap pin to ${NEW_PIN:0:12}" \
--body-file "$PR_BODY_FILE"