Skip to content

Commit 3250425

Browse files
committed
👷 ci: pick the newest Xcode the runner has
Every macOS job hardcoded /Applications/Xcode_26.app, and the macos-26 image does not ship that name, so all four failed before running a single check. Scripts/select-xcode.sh takes the highest-sorting Xcode in /Applications and refuses anything below 26, which survives the point releases the image rotates through while still failing loudly if the SDK regresses. Claude-Session: https://claude.ai/code/session_01CGckDFXvufWVmRH4uyE4z8
1 parent 588926a commit 3250425

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
persist-credentials: false
2424
- uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2.4.4
2525
- name: Select Xcode
26-
run: sudo xcode-select -s /Applications/Xcode_26.app/Contents/Developer
26+
run: Scripts/select-xcode.sh
2727
- name: Run every hook
2828
run: just lint
2929

@@ -36,7 +36,7 @@ jobs:
3636
persist-credentials: false
3737
- uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2.4.4
3838
- name: Select Xcode
39-
run: sudo xcode-select -s /Applications/Xcode_26.app/Contents/Developer && swift --version
39+
run: Scripts/select-xcode.sh
4040
- name: Cache SwiftPM
4141
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
4242
with:
@@ -63,7 +63,7 @@ jobs:
6363
persist-credentials: false
6464
- uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2.4.4
6565
- name: Select Xcode
66-
run: sudo xcode-select -s /Applications/Xcode_26.app/Contents/Developer
66+
run: Scripts/select-xcode.sh
6767
- name: Generate project
6868
run: just xcode
6969
- name: Build

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
ref: ${{ env.TAG }}
8585
persist-credentials: false
8686
- name: Select Xcode
87-
run: sudo xcode-select -s /Applications/Xcode_26.app/Contents/Developer
87+
run: Scripts/select-xcode.sh
8888
- name: Install tools
8989
run: brew install xcodegen
9090
- name: Stamp version
@@ -198,7 +198,7 @@ jobs:
198198
ref: ${{ env.TAG }}
199199
persist-credentials: false
200200
- name: Select Xcode
201-
run: sudo xcode-select -s /Applications/Xcode_26.app/Contents/Developer
201+
run: Scripts/select-xcode.sh
202202
- name: Install tools
203203
run: brew install xcodegen
204204
- name: Stamp version

‎Scripts/select-xcode.sh‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Runner images name their Xcodes differently between generations (Xcode_26.app, Xcode_26.0.1.app), so pick the newest
5+
# one installed rather than a fixed path, and refuse anything older than the macOS 26 SDK the app is built against.
6+
newest="$(find /Applications -maxdepth 1 -name 'Xcode*.app' | sort -V | tail -1)"
7+
if [ -z "$newest" ]; then
8+
echo "No Xcode in /Applications; the package builds with swift alone, the app bundle needs Xcode" >&2
9+
exit 1
10+
fi
11+
sudo xcode-select -s "$newest/Contents/Developer"
12+
13+
version="$(xcodebuild -version | head -1 | cut -d' ' -f2)"
14+
if [ "${version%%.*}" -lt 26 ]; then
15+
echo "Xcode ${version} is too old, the app needs the macOS 26 SDK" >&2
16+
exit 1
17+
fi
18+
xcodebuild -version
19+
swift --version

0 commit comments

Comments
 (0)