From 47ce39d4686ec6c4d02bc883cd121f41631df14b Mon Sep 17 00:00:00 2001 From: Ramon Roche Date: Tue, 29 Sep 2026 12:39:33 -0700 Subject: [PATCH] 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 --- .github/workflows/compile_macos.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/compile_macos.yml b/.github/workflows/compile_macos.yml index 08fcbf55bd5..075ae2dfddc 100644 --- a/.github/workflows/compile_macos.yml +++ b/.github/workflows/compile_macos.yml @@ -6,11 +6,21 @@ on: - '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-ignore: - - 'docs/**' + 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 }} @@ -63,13 +73,13 @@ jobs: - name: Build px4_fmu-v5_default run: make px4_fmu-v5_default - # Only main saves: the 10 GB Actions cache cannot hold an entry for every - # PR run, and PRs restore from main's newest entry anyway. + # 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 != 'push' + if: always() && github.event_name == 'pull_request' run: ccache -s - uses: ./.github/actions/save-ccache - if: always() && github.event_name == 'push' + if: always() && github.event_name != 'pull_request' with: cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }}