Files
PX4-Autopilot/.github/workflows/compile_macos.yml
T
Ramon Roche 47ce39d468 ci(macos): run on pull requests only when macOS setup changes; add weekly run
macOS runners cost roughly 10x Linux per minute, and this workflow was
about $1.8k/month gross running on every pull request. Pull requests now
run it only when they touch the macOS setup scripts, Homebrew pins, pixi
environment, Python requirements or the workflow itself. Pushes to main
still run it on every non-docs change, and a weekly scheduled run catches
upstream Homebrew/conda-forge drift. Non-PR runs save the ccache so pull
requests keep restoring from a fresh entry.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-29 12:47:45 -07:00

86 lines
2.3 KiB
YAML

name: MacOS build
on:
push:
branches:
- 'main'
paths-ignore:
- 'docs/**'
# macOS runners are the most expensive in CI. Pull requests only run this
# when they touch the macOS setup; main and the weekly run catch the rest.
pull_request:
branches:
- '**'
paths:
- 'Tools/setup/macos.sh'
- 'Tools/setup/macos_ci_pins.sh'
- 'Tools/setup/macos/**'
- 'Tools/setup/homebrew-pins.txt'
- 'Tools/setup/requirements.txt'
- '.github/workflows/compile_macos.yml'
schedule:
- cron: '0 6 * * 1' # Every Monday at 06:00 UTC
workflow_dispatch:
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 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: 400M
- name: Build px4_sitl
run: |
source .venv/bin/activate
make px4_sitl
- name: Cache - Stats after px4_sitl
run: ccache -s
- name: Build px4_fmu-v5_default
run: make px4_fmu-v5_default
# Only non-PR runs save: the 10 GB Actions cache cannot hold an entry for
# every PR run, and PRs restore from main's newest entry anyway.
- name: Cache - Stats
if: always() && github.event_name == 'pull_request'
run: ccache -s
- uses: ./.github/actions/save-ccache
if: always() && github.event_name != 'pull_request'
with:
cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }}