Skip to content

Commit cda95fc

Browse files
authored
ci: Update simulator boot process to set iOS version based on Xcode version (#5775)
* ci: Update simulator boot process to set iOS version based on Xcode version * Use parameters instead of fixed values
1 parent cd1b465 commit cda95fc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

scripts/ci-boot-simulator.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,40 @@ while [[ $# -gt 0 ]]; do
2929
done
3030

3131
SIMULATOR="iPhone 16"
32+
IOS_VERSION="18.5"
3233

3334
# Select simulator based on Xcode version
3435
case "$XCODE_VERSION" in
3536
"14.3.1")
3637
SIMULATOR="iPhone 14"
38+
IOS_VERSION="16.4"
3739
;;
3840
"15.4")
3941
SIMULATOR="iPhone 15"
42+
IOS_VERSION="17.5"
4043
;;
4144
"16.2")
4245
SIMULATOR="iPhone 16"
46+
IOS_VERSION="18.5"
4347
;;
4448
*)
4549
SIMULATOR="iPhone 16" # Default fallback
50+
IOS_VERSION="18.5"
4651
;;
4752
esac
4853

49-
echo "Booting simulator $SIMULATOR"
50-
xcrun simctl boot "$SIMULATOR"
54+
UDID=$(xcrun simctl list devices available | \
55+
grep -A 5 "^-- iOS $IOS_VERSION --" | \
56+
grep "$SIMULATOR (" | \
57+
sed -n 's/.*(\([0-9A-F-]\{36\}\)).*/\1/p' | \
58+
head -n1)
59+
60+
echo "Booting simulator $SIMULATOR - iOS $IOS_VERSION: $UDID"
61+
xcrun simctl boot "$UDID"
5162

5263
# Wait for the simulator to boot
5364
# We need to wait for the simulator to boot to avoid the test to fail due to timeout (because the simulator is not booted yet)
54-
xcrun simctl bootstatus "$SIMULATOR"
65+
xcrun simctl bootstatus "$UDID"
5566

5667
# Print details about the booted simulator, iOS version, etc.
5768
xcrun simctl list devices --json | jq '.devices | to_entries[] | select(.value[] | .state == "Booted")'

0 commit comments

Comments
 (0)