eleven / ocho Public

ci: cut wasted GitHub Actions minutes on the macOS build (#246)

* ci: stop wasting macOS minutes on non-ios changes, duplicate builds, and drafts

The mac build was rebuilding on every push to any branch (duplicating the
pull_request build for the same commit), on docs-only edits under ios/
(e.g. ios/README.md), and on every push to a draft PR being iterated on —
all on the 10x-cost macOS runner. Restrict push to main, exclude *.md from
the ios/** path filter, cancel superseded in-flight runs, and skip both
workflows while a PR is still a draft.

* ci: cache SwiftPM checkouts to shave time off the mac build

Sparkle (pinned in ios/project.yml) was re-cloned/resolved from scratch on
every macOS build. Cache ios/build/SourcePackages keyed on the project.yml
hash so unchanged dependency pins reuse the checkout instead of refetching.
James Adam 33a11040de4609844520cc109ac4b4aaf83a6c09 parent b6459d7
2 files changed, +23 −0
  • .github/workflows/build-apps.yml +17 −0
  • .github/workflows/test.yml +6 −0
diff --git a/.github/workflows/build-apps.yml b/.github/workflows/build-apps.yml
index dc6cd54..ea474b0 100644
--- a/.github/workflows/build-apps.yml
+++ b/.github/workflows/build-apps.yml
@@ -2,17 +2,26 @@ name: Build Native macOS App
on:
push:
+ branches: [ main ]
paths:
- 'ios/**'
+ - '!ios/**/*.md'
- '.github/workflows/build-apps.yml'
pull_request:
+ types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'ios/**'
+ - '!ios/**/*.md'
workflow_dispatch:
+concurrency:
+ group: build-apps-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
build:
runs-on: macos-latest
+ if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
permissions:
contents: write
@@ -27,6 +36,14 @@ jobs:
working-directory: ios
run: xcodegen generate
+ - name: Cache Swift Package Manager checkouts
+ uses: actions/cache@v4
+ with:
+ path: ios/build/SourcePackages
+ key: spm-${{ runner.os }}-${{ hashFiles('ios/project.yml') }}
+ restore-keys: |
+ spm-${{ runner.os }}-
+
- name: Build macOS (native)
working-directory: ios
run: |
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 53e9d73..8ee9f8f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -5,10 +5,16 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
+ types: [opened, synchronize, reopened, ready_for_review]
+
+concurrency:
+ group: tests-${{ github.ref }}
+ cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
+ if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
strategy:
matrix:
go-version: ['1.23']