From b7fe19c616389cf40dca2288771a6f2805c7918f Mon Sep 17 00:00:00 2001 From: Ryan Lintott <2143656+ryanlintott@users.noreply.github.com> Date: Sun, 6 Sep 2026 20:31:01 -0400 Subject: [PATCH 1/2] Pick a Swift 6.0 Xcode that has an iOS SDK Some macos-15 runner instances come up without an iOS platform installed for Xcode 16.0, which fails destination resolution before any code is compiled. Probe Xcode 16.0, 16.1 and 16.2 (Swift 6.0, 6.0.2 and 6.0.3) and use the first that reports an iphoneos SDK, failing with a clear message if none does so a bad runner is obvious and can simply be re-run. Also bump actions/checkout to v7, which runs on Node 24. Co-Authored-By: Claude Opus 5 --- .github/workflows/swift-compatibility.yml | 34 ++++++++++++++++------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/swift-compatibility.yml b/.github/workflows/swift-compatibility.yml index 742f4d6..4867e24 100644 --- a/.github/workflows/swift-compatibility.yml +++ b/.github/workflows/swift-compatibility.yml @@ -22,25 +22,39 @@ jobs: name: Swift 6.0 compatibility runs-on: macos-15 timeout-minutes: 20 - env: - DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 - - name: Report toolchain + # Xcode 16.0, 16.1 and 16.2 all ship Swift 6.0.x, so any of them proves + # the same thing. Which of them has an iOS platform installed varies + # between runner images, so pick the first that can actually build for + # iOS rather than pinning one and breaking when the image changes. + - name: Select a Swift 6.0 Xcode with an iOS SDK run: | - xcodebuild -version - swift --version + for app in /Applications/Xcode_16.app /Applications/Xcode_16.1.app /Applications/Xcode_16.2.app; do + developer_dir="$app/Contents/Developer" + [ -d "$developer_dir" ] || continue + if DEVELOPER_DIR="$developer_dir" xcodebuild -showsdks | grep -q -e '-sdk iphoneos'; then + echo "Using $app" + DEVELOPER_DIR="$developer_dir" xcodebuild -version + DEVELOPER_DIR="$developer_dir" swift --version + echo "DEVELOPER_DIR=$developer_dir" >> "$GITHUB_ENV" + exit 0 + fi + echo "$app has no iOS SDK installed" + done + echo "No Swift 6.0 Xcode on this runner has an iOS SDK installed." >&2 + exit 1 # Only the library is built here. This job guards the minimum Swift # version the package claims to support, which is a promise about the # code consumers compile. The test target is exercised by the # current-swift job instead. The package is iOS only, so this cannot be - # a plain `swift build` against the macOS host, and the runner image - # carries no iOS 18 simulator runtime for Xcode 16.0, so it cannot be a - # simulator test either. + # a plain `swift build` against the macOS host, and no runner image + # carries an iOS 18.0 simulator runtime for these Xcodes, so it cannot + # be a simulator test either. - name: Build for iOS run: >- xcodebuild build @@ -55,7 +69,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Report toolchain run: | From 4cd12e3c1a8f70fe2f5a55494b34fd735249c404 Mon Sep 17 00:00:00 2001 From: Ryan Lintott <2143656+ryanlintott@users.noreply.github.com> Date: Sun, 6 Sep 2026 20:36:03 -0400 Subject: [PATCH 2/2] Probe iOS destinations instead of installed SDKs A stripped runner still lists an iphoneos SDK in `xcodebuild -showsdks` even though the iOS platform is missing, so the previous check selected Xcode 16.0 on a runner that could not resolve an iOS destination and the build failed anyway. Ask for the scheme's destinations and require an `Any iOS Device` entry that carries no error. Co-Authored-By: Claude Opus 5 --- .github/workflows/swift-compatibility.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/swift-compatibility.yml b/.github/workflows/swift-compatibility.yml index 4867e24..e4d96be 100644 --- a/.github/workflows/swift-compatibility.yml +++ b/.github/workflows/swift-compatibility.yml @@ -28,24 +28,27 @@ jobs: uses: actions/checkout@v7 # Xcode 16.0, 16.1 and 16.2 all ship Swift 6.0.x, so any of them proves - # the same thing. Which of them has an iOS platform installed varies - # between runner images, so pick the first that can actually build for - # iOS rather than pinning one and breaking when the image changes. - - name: Select a Swift 6.0 Xcode with an iOS SDK + # the same thing. Some runner instances come up with no iOS platform + # installed for a given Xcode, so pick the first that can actually + # resolve an iOS destination rather than pinning one. `-showsdks` is not + # a usable test here: on a stripped runner it still lists iphoneos while + # the platform itself is missing, so ask for destinations instead. + - name: Select a Swift 6.0 Xcode that can build for iOS run: | for app in /Applications/Xcode_16.app /Applications/Xcode_16.1.app /Applications/Xcode_16.2.app; do developer_dir="$app/Contents/Developer" [ -d "$developer_dir" ] || continue - if DEVELOPER_DIR="$developer_dir" xcodebuild -showsdks | grep -q -e '-sdk iphoneos'; then + if DEVELOPER_DIR="$developer_dir" xcodebuild -showdestinations -scheme ILikeToMoveIt 2>/dev/null \ + | grep 'name:Any iOS Device' | grep -qv 'error:'; then echo "Using $app" DEVELOPER_DIR="$developer_dir" xcodebuild -version DEVELOPER_DIR="$developer_dir" swift --version echo "DEVELOPER_DIR=$developer_dir" >> "$GITHUB_ENV" exit 0 fi - echo "$app has no iOS SDK installed" + echo "$app has no installed iOS platform" done - echo "No Swift 6.0 Xcode on this runner has an iOS SDK installed." >&2 + echo "No Swift 6.0 Xcode on this runner has an iOS platform installed." >&2 exit 1 # Only the library is built here. This job guards the minimum Swift