From a68628ab67262a1fe2e1af385173ee4812491299 Mon Sep 17 00:00:00 2001 From: Tim Taplin Date: Tue, 6 Oct 2026 06:20:32 -0600 Subject: [PATCH] CI: wait for the iOS simulator before testing On a fresh macos-26 runner the simulator service can start late. xcodebuild then lists no simulators at all and the iOS job fails with "Unable to find a device matching the provided destination specifier" after its own 60-second wait (Perfect-SQLite #29, second attempt; a retry passed). This matches actions/runner-images#12948. Before testing, poll xcodebuild -showdestinations for the iPhone 17 for up to 5 minutes. Each round first runs simctl list, the workaround from that issue, which makes the service refresh its runtimes. xcodebuild's errors stay in the log, so a package-resolution failure isn't hidden. The test also gets -destination-timeout 120 in case the device drops out again between the check and the run. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f7257b..8fe5004 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,26 @@ jobs: sudo xcode-select -s /Applications/Xcode_26.6.app xcodebuild -version + # On a fresh runner the simulator service can start late, and xcodebuild then lists no + # simulators at all ("Unable to find a device"). Wait until it offers the one we test on. + # Listing devices with simctl makes the service refresh its runtimes + # (actions/runner-images#12948). + - name: Wait for the simulator + run: | + deadline=$((SECONDS + 300)) + while [ $SECONDS -lt $deadline ]; do + xcrun simctl list devices available > /dev/null 2>&1 || true + if destinations=$(xcodebuild -showdestinations -scheme PerfectSQLite) \ + && grep -q "name:iPhone 17 }" <<< "$destinations"; then + exit 0 + fi + echo "No iPhone 17 simulator yet; retrying in 5 seconds" + sleep 5 + done + echo "No iPhone 17 simulator after 5 minutes" + xcrun simctl list devices available + exit 1 + # The test target builds at the package's iOS 15 deployment target, so this also # catches APIs that need a newer iOS. No SWIFT_TREAT_WARNINGS_AS_ERRORS: Xcode builds the # Perfect-CRUD dependency with warnings suppressed, and the two flags conflict. The macOS @@ -89,4 +109,5 @@ jobs: - name: Test run: | xcodebuild test -scheme PerfectSQLite \ - -destination 'platform=iOS Simulator,name=iPhone 17,OS=latest' + -destination 'platform=iOS Simulator,name=iPhone 17,OS=latest' \ + -destination-timeout 120