Skip to content

Commit fb51275

Browse files
committed
Make simulator selection runtime-agnostic in CI
1 parent e3bc23b commit fb51275

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

.github/workflows/ios-ci.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,34 @@ jobs:
4343
shell: bash
4444
run: |
4545
set -euo pipefail
46-
RUNTIME=$(xcrun simctl list runtimes available | grep -E 'iOS 18\\.' | head -n 1 | awk -F'[()]' '{print $2}')
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
51+
)
4752
4853
if [[ -z "${RUNTIME:-}" ]]; then
49-
echo "No iOS 18.x runtime found on this runner."
54+
echo "No iOS runtime found on this runner."
5055
xcrun simctl list runtimes available
5156
exit 1
5257
fi
5358
54-
DEVICE_UDID=$(xcrun simctl list devices available "${RUNTIME}" | grep 'iPhone 16 (' | head -n 1 | awk -F '[()]' '{print $2}')
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+
)
5564
5665
if [[ -z "${DEVICE_UDID:-}" ]]; then
57-
echo "No iPhone 16 simulator found for runtime ${RUNTIME}."
66+
DEVICE_UDID=$(
67+
xcrun simctl list devices available "${RUNTIME}" \
68+
| awk -F'[()]' '/iPhone [0-9]+/{print $2; exit}'
69+
)
70+
fi
71+
72+
if [[ -z "${DEVICE_UDID:-}" ]]; then
73+
echo "No iPhone simulator found for runtime ${RUNTIME}."
5874
xcrun simctl list devices available "${RUNTIME}"
5975
exit 1
6076
fi

0 commit comments

Comments
 (0)