ci(macos): install from pinned Homebrew commits

The job ran brew update and then installed whatever Homebrew was publishing, except Gazebo, which stayed on one commit. Those were built against different protobufs, so a release upstream failed the build with no commit here. Check the package repos out at commits recorded in the tree and do not update them. Run on macos-15 only, so the OS label cannot move either.

Assisted-by: Grok:grok-4.7
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
This commit is contained in:
Jacob Dahl authored and Ramon Roche committed 2026-09-21 16:55:31 -07:00
1 parent 49339b843f
commit fbfc1386ee
9 files changed
+257 -9

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
name: MacOS build
on:
push:
branches:
- 'main'
paths-ignore:
- 'docs/**'
pull_request:
branches:
- '**'
paths-ignore:
- 'docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: macos-15
steps:
- name: install Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
- uses: actions/checkout@v6
- name: Cache - Restore Homebrew Packages
uses: actions/cache@v5
with:
path: ~/Library/Caches/Homebrew/downloads
key: macos-homebrew-${{ runner.arch }}-${{ hashFiles('Tools/setup/macos.sh', 'Tools/setup/macos_ci_pins.sh', 'Tools/setup/homebrew-pins.txt', 'Tools/setup/protobuf-pin.txt', 'Tools/setup/gz-tap-pin.txt') }}
restore-keys: |
macos-homebrew-${{ runner.arch }}-
- name: Cache - Restore pip Packages
uses: actions/cache@v5
with:
path: ~/Library/Caches/pip
key: macos-pip-${{ runner.arch }}-${{ hashFiles('Tools/setup/requirements.txt') }}
restore-keys: |
macos-pip-${{ runner.arch }}-
- name: setup
env:
# Read the checked-out package repos. The default is a live index,
# which ignores those checkouts.
HOMEBREW_NO_AUTO_UPDATE: "1"
HOMEBREW_NO_INSTALL_FROM_API: "1"
run: |
./Tools/setup/macos_ci_pins.sh
./Tools/setup/macos.sh --sim-tools
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- uses: ./.github/actions/setup-ccache
id: ccache
with:
cache-key-prefix: ccache-macos-15
max-size: 200M
- name: Build px4_sitl
run: make px4_sitl
- name: Cache - Stats after px4_sitl
run: ccache -s
- name: Build px4_fmu-v5_default
run: make px4_fmu-v5_default
- uses: ./.github/actions/save-ccache
if: always()
with:
cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }}
@@ -0,0 +1,64 @@
name: macOS - Refresh gz tap pin
# Tools/setup/macos.sh pins osrf/simulation to Tools/setup/gz-tap-pin.txt so
# --sim-tools pours Gazebo bottles instead of compiling them, and protobuf to
# Tools/setup/protobuf-pin.txt so those bottles' generated headers still
# compile (see those files). OSRF advances the tap several times a week and
# homebrew-core moves protobuf on its own schedule, so once a week this moves
# the tap pin to the newest commit whose Gazebo formulae are all bottled,
# repoints the protobuf pin at whatever those bottles were built against, and
# opens a PR for it. Tools/ci/refresh_gz_tap_pin.rb does the work under
# Homebrew's Ruby and can be run by hand on any Mac.
on:
schedule:
- cron: '0 9 * * 1' # Mondays at 09:00 UTC
workflow_dispatch:
permissions:
contents: read
jobs:
refresh:
# Same runner as the MacOS build.
runs-on: macos-15
steps:
- uses: actions/checkout@v6
- name: Find the newest fully bottled osrf/simulation commit
id: pin
env:
# Walking homebrew-core's protobuf history goes through the GitHub
# API, which is rate limited per IP for runners without this.
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: brew ruby Tools/ci/refresh_gz_tap_pin.rb
- name: Open PR with the new pins
if: steps.pin.outputs.needs_bump == 'true'
uses: peter-evans/create-pull-request@v8
with:
# The PX4BuildBot PAT rather than GITHUB_TOKEN so the PR runs the
# MacOS build workflow, which is what verifies the new pin.
token: ${{ secrets.PX4BUILTBOT_PERSONAL_ACCESS_TOKEN }}
author: ${{ secrets.PX4BUILDBOT_USER }} <${{ secrets.PX4BUILDBOT_EMAIL }}>
committer: ${{ secrets.PX4BUILDBOT_USER }} <${{ secrets.PX4BUILDBOT_EMAIL }}>
branch: px4buildbot/gz-tap-pin
delete-branch: true
add-paths: |
Tools/setup/gz-tap-pin.txt
Tools/setup/protobuf-pin.txt
commit-message: "build(macos): ${{ steps.pin.outputs.summary }}"
title: "build(macos): ${{ steps.pin.outputs.summary }}"
body: |
Weekly check of the two macOS Gazebo pins. `Tools/setup/gz-tap-pin.txt` holds osrf/simulation at the newest commit where every formula `macos.sh --sim-tools` poured at the previous pin still has a bottle Homebrew pours on macos-15 and every bottle tarball is still served. `Tools/setup/protobuf-pin.txt` holds protobuf at the version those bottles were built against, which is the only one their generated headers compile against.
| pin | from | to |
| --- | --- | --- |
| osrf/simulation | `${{ steps.pin.outputs.old_pin }}` | `${{ steps.pin.outputs.new_pin }}` |
| protobuf | `${{ steps.pin.outputs.old_protobuf_version }}` (`${{ steps.pin.outputs.old_protobuf_pin }}`) | `${{ steps.pin.outputs.protobuf_version }}` (`${{ steps.pin.outputs.new_protobuf_pin }}`) |
An empty "to" means that pin did not move.
Tap changes: https://github.com/osrf/homebrew-simulation/compare/${{ steps.pin.outputs.old_pin }}...${{ steps.pin.outputs.new_pin || steps.pin.outputs.old_pin }}
The MacOS build legs on this PR are the real test. Merge once both pour the gz bottles without compiling anything from osrf/simulation.