Skip to content

Commit 90be54e

Browse files
committed
Use xcodebuild showdestinations to pick simulator in CI
1 parent fb51275 commit 90be54e

1 file changed

Lines changed: 10 additions & 26 deletions

File tree

.github/workflows/ios-ci.yml

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,40 +43,24 @@ jobs:
4343
shell: bash
4444
run: |
4545
set -euo pipefail
46-
# Pick the newest available iOS runtime on the runner.
47-
RUNTIME=$(
48-
xcrun simctl list runtimes available \
49-
| awk -F'[()]' '/iOS [0-9]+/{print $2}' \
50-
| tail -n 1
46+
DEST_LINE=$(
47+
xcodebuild \
48+
-project SOPA.xcodeproj \
49+
-scheme SOPA \
50+
-showdestinations \
51+
| grep -m1 "platform:iOS Simulator" || true
5152
)
5253
53-
if [[ -z "${RUNTIME:-}" ]]; then
54-
echo "No iOS runtime found on this runner."
55-
xcrun simctl list runtimes available
56-
exit 1
57-
fi
58-
59-
# Prefer iPhone 16 to match local development, fallback to any available iPhone.
60-
DEVICE_UDID=$(
61-
xcrun simctl list devices available "${RUNTIME}" \
62-
| awk -F'[()]' '/iPhone 16 /{print $2; exit}'
63-
)
64-
65-
if [[ -z "${DEVICE_UDID:-}" ]]; then
66-
DEVICE_UDID=$(
67-
xcrun simctl list devices available "${RUNTIME}" \
68-
| awk -F'[()]' '/iPhone [0-9]+/{print $2; exit}'
69-
)
70-
fi
54+
DEVICE_UDID=$(echo "${DEST_LINE}" | sed -n 's/.*id:\([^,}]*\).*/\1/p' | tr -d ' ')
7155
7256
if [[ -z "${DEVICE_UDID:-}" ]]; then
73-
echo "No iPhone simulator found for runtime ${RUNTIME}."
74-
xcrun simctl list devices available "${RUNTIME}"
57+
echo "No usable iOS Simulator destination found for scheme SOPA."
58+
xcodebuild -project SOPA.xcodeproj -scheme SOPA -showdestinations
7559
exit 1
7660
fi
7761
7862
echo "destination=id=${DEVICE_UDID}" >> "$GITHUB_OUTPUT"
79-
echo "Using destination id=${DEVICE_UDID} on runtime ${RUNTIME}"
63+
echo "Using destination id=${DEVICE_UDID}"
8064
8165
- name: Build
8266
run: |

0 commit comments

Comments
 (0)