macOS builds
runs-on: groundbox-macos runs a GitHub Actions job on macOS. Change the one line in a workflow that runs on macos-latest:
runs-on: groundbox-macos- The machine: macOS 26 Tahoe with Xcode 27.2, on Apple silicon (M6). The iOS simulator runtime for Xcode 27.2 is installed.
- Two sizes:
groundbox-macosis 12 vCPU and 12 GB at $0.05 a minute.groundbox-macos-6vcpuis 6 vCPU and 7 GB at $0.025 a minute: the memory of GitHub's standard macOS runner and twice its cores. Use the small one for jobs that run onmacos-latesttoday, and the large one for big Xcode builds. - Tools: fastlane, CocoaPods and xcpretty (Ruby through rbenv), Flutter, Node.js 24, Java 17, Homebrew, Git LFS, jq, the GitHub CLI, Carthage, SwiftLint, SwiftFormat and xcbeautify are on the PATH, as on GitHub's macOS runners.
- One job per VM: each job gets a fresh macOS VM, deleted when the job ends. Nothing is left from the job before.
- Price: $0.025 or $0.05 a minute by size, billed by the second. GitHub's standard macOS runner is $0.062 a minute, rounded up to the minute.
- Free minutes: on the free plan a minute of
groundbox-macosuses 15 free minutes and a minute ofgroundbox-macos-6vcpu7, so the 3,000 minutes a month are 200 large or 428 small macOS minutes. Past them, macOS is paid from credit like any CI time: the $5 of free credit or a top-up. Without either, it waits until the month resets. - No terminal: groundbox ci ssh and the debug hold work on Linux jobs only. Leave
groundbox-debug-holdout of macOS jobs. - Caches:
actions/cacheand thesetup-*cache options save and restore on the Mac the job runs on, with no workflow change. Each Mac keeps its own, so the first job on another Mac misses once. Each job's VM starts empty, so cache your Swift packages and Xcode build. - GitHub Actions only: macOS is for CI jobs from GitHub. There are no macOS sandboxes, and GitLab runners are Linux.
Test a Swift package
.github/workflows/swift.yml
name: Swift
on: [push, pull_request]
jobs:
test:
runs-on: groundbox-macos
steps:
- uses: actions/checkout@v4
- run: swift build
- run: swift test
Test an iOS app on the simulator
This picks an iPhone simulator from the ones Xcode has, by its id, and runs a scheme's tests on it. Put your scheme in place of MyApp, and add -project or -workspace if the folder has more than one:
.github/workflows/ios.yml
name: iOS
on: [push, pull_request]
jobs:
test:
runs-on: groundbox-macos
steps:
- uses: actions/checkout@v4
- run: xcodebuild -version
- name: Test on an iPhone simulator
run: |
udid=$(xcrun simctl list devices available | grep -m1 -E '^ +iPhone' | grep -oE '[0-9A-F-]{36}' || true)
if [ -z "$udid" ]; then xcrun simctl list devices available; exit 1; fi
xcodebuild test \
-scheme MyApp \
-destination "platform=iOS Simulator,id=$udid" \
CODE_SIGNING_ALLOWED=NO
Cache Swift packages and Xcode builds
Each job starts in a new VM, so without a cache it downloads and compiles every Swift package again. Save them with actions/cache, keyed on Package.resolved: the packages change only when it does, so commit it. For a Swift package, cache .build and SwiftPM's own cache:
.github/workflows/swift.yml
name: Swift
on: [push, pull_request]
jobs:
test:
runs-on: groundbox-macos
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
.build
~/Library/Caches/org.swift.swiftpm
key: swiftpm-${{ hashFiles('Package.resolved') }}
restore-keys: swiftpm-
- run: swift build
- run: swift test
For an app built with xcodebuild, put the packages and DerivedData in fixed folders with -clonedSourcePackagesDirPath and -derivedDataPath, and cache each one:
.github/workflows/ios.yml
name: iOS
on: [push, pull_request]
jobs:
test:
runs-on: groundbox-macos
steps:
- uses: actions/checkout@v4
- name: Cache Swift packages
uses: actions/cache@v4
with:
path: ~/spm
key: spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: spm-
- name: Cache DerivedData
uses: actions/cache@v4
with:
path: ~/DerivedData
key: deriveddata-${{ github.ref_name }}-${{ hashFiles('**/Package.resolved', '**/*.swift', '**/*.pbxproj') }}
restore-keys: |
deriveddata-${{ github.ref_name }}-
deriveddata-
- name: Test on an iPhone simulator
run: |
udid=$(xcrun simctl list devices available | grep -m1 -E '^ +iPhone' | grep -oE '[0-9A-F-]{36}' || true)
if [ -z "$udid" ]; then xcrun simctl list devices available; exit 1; fi
xcodebuild test \
-scheme MyApp \
-destination "platform=iOS Simulator,id=$udid" \
-clonedSourcePackagesDirPath ~/spm \
-derivedDataPath ~/DerivedData \
CODE_SIGNING_ALLOWED=NO
- Packages are the sure win: a restored package folder skips the download, and SwiftPM reuses the packages it built before.
- DerivedData helps less: Xcode decides what to rebuild from the files' dates, and a fresh checkout gives every file a new one, so it may compile some of your own code again anyway. Keep the DerivedData cache only if your builds get faster with it.
- The keys: on an exact match the cache is restored and not saved again. On a
restore-keysmatch the newest close cache is restored and the job saves its own at the end. A branch also reads the caches saved on the default branch.