Skip to content

Commit 14514e0

Browse files
committed
[CI] Select Xcode and Simulator version based on OS version
1 parent 1a40e1e commit 14514e0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/test.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020

2121
set -euo pipefail
2222

23+
macos_version=$(sw_vers --productVersion)
24+
if [[ "$macos_version" -ge 15 ]]; then
25+
xcode_version="16.1"
26+
iphone_version="16"
27+
else
28+
xcode_version="15.3"
29+
iphone_version="15"
30+
fi
31+
2332
# Set default parameters
2433
if [[ -z "${SPM:-}" ]]; then
2534
SPM=false
@@ -31,7 +40,7 @@ if [[ -z "${SPM:-}" ]]; then
3140
fi
3241
if [[ -z "${OS:-}" ]]; then
3342
OS=iOS
34-
DEVICE="iPhone 16"
43+
DEVICE="iPhone ${iphone_version}"
3544
echo "Defaulting to OS=$OS"
3645
echo "Defaulting to DEVICE=$DEVICE"
3746
fi
@@ -123,6 +132,6 @@ function xcb() {
123132
}
124133

125134
# Run xcodebuild
126-
sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer
135+
sudo xcode-select -s "/Applications/Xcode_${xcode_version}.app/Contents/Developer"
127136
xcb "${flags[@]}"
128137
echo "$message"

0 commit comments

Comments
 (0)