Skip to content

Commit 8c1cafc

Browse files
authored
chore: Ensure required simulators are loaded for all platforms (#7022)
* chore: Ensure required simulators are loaded for all platforms * Update comments * Only check runtimes for tvOS and iOS (skip catalyst, macOS) * Ensure runtime is loaded for distribution test too
1 parent cd12dad commit 8c1cafc

File tree

6 files changed

+35
-13
lines changed

6 files changed

+35
-13
lines changed

.github/workflows/test-cross-platform.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ jobs:
7575
timeout-minutes: 5 # 5 minutes timeout
7676
env:
7777
OS_VERSION: "18.4"
78-
run: ./sentry-cocoa/scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION"
78+
PLATFORM: "iOS"
79+
run: ./sentry-cocoa/scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION" --platform "$PLATFORM"
7980

8081
- name: Create simulator device for iOS 18.4
8182
run: ./sentry-cocoa/scripts/ci-create-simulator.sh --platform "iOS" --os-version "18.4" --device-name "iPhone 15 Pro"

.github/workflows/test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ jobs:
118118
--remove-duplicate true \
119119
--change-path false \
120120
--remove-binary-targets true
121+
- name: Ensure required runtime is loaded
122+
# Ideally we will not need this, but CI sometimes is failing to load some runtimes, this will ensure they are loaded
123+
timeout-minutes: 5 # 5 minutes timeout
124+
env:
125+
OS_VERSION: "18.4"
126+
PLATFORM: "iOS"
127+
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION" --platform "$PLATFORM"
121128
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
122129
- run: set -o pipefail && NSUnbufferedIO=YES SKIP_BINARIES=1 xcodebuild test -scheme Sentry-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=18.4,name=iPhone 16 Pro' | tee raw-test-output-distribution.log | xcbeautify --preserve-unbeautified
123130
shell: sh

.github/workflows/ui-tests-common.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,13 @@ jobs:
110110
run: ./scripts/ci-install-platforms.sh --platforms "$PLATFORM" --os-version "$OS_VERSION"
111111

112112
- name: Ensure required runtime is loaded
113+
if: ${{ inputs.platform == 'iOS' || inputs.platform == 'tvOS' }}
113114
# Ideally we will not need this, but CI sometimes is failing to load some runtimes, this will ensure they are loaded
114-
if: ${{ inputs.platform == 'iOS' }}
115115
timeout-minutes: 5 # 5 minutes timeout
116116
env:
117117
OS_VERSION: ${{ inputs.test-destination-os }}
118-
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION"
118+
PLATFORM: ${{ inputs.platform }}
119+
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION" --platform "$PLATFORM"
119120

120121
- name: Create simulator device
121122
if: ${{ inputs.create_device }}

.github/workflows/ui-tests-critical.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ jobs:
107107
timeout-minutes: 5 # 5 minutes timeout
108108
env:
109109
OS_VERSION: "18.4"
110-
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION"
110+
PLATFORM: "iOS"
111+
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION" --platform "$PLATFORM"
111112

112113
- name: Boot simulator
113114
run: ./scripts/ci-boot-simulator.sh

.github/workflows/unit-test-common.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ jobs:
9393
run: ./scripts/ci-install-platforms.sh --platforms "$PLATFORMS" --os-version "$OS_VERSION"
9494

9595
- name: Ensure required runtime is loaded
96+
if: ${{ inputs.platform == 'iOS' || inputs.platform == 'tvOS' || inputs.platform == 'visionOS' }}
9697
# Ideally we will not need this, but CI sometimes is failing to load some runtimes, this will ensure they are loaded
97-
if: ${{ inputs.platform == 'iOS' }}
9898
timeout-minutes: 5 # 5 minutes timeout
9999
env:
100100
OS_VERSION: ${{ inputs.test-destination-os }}
101-
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION"
101+
PLATFORM: ${{ inputs.platform }}
102+
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION" --platform "$PLATFORM"
102103

103104
# Create simulator devices for non-preinstalled simulators
104105
# Required for iOS 16.4, iOS 17.5 (on Xcode 15.4), and iOS/tvOS 26.1

scripts/ci-ensure-runtime-loaded.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ set -euo pipefail
99

1010
# Parse named arguments
1111
OS_VERSION=""
12+
PLATFORM=""
1213

1314
usage() {
14-
echo "Usage: $0 --os-version <os_version>"
15+
echo "Usage: $0 --os-version <os_version> --platform <platform>"
1516
echo " OS version: Version to ensure is loaded (e.g., 26.1 for beta, 16.4 for older iOS)"
16-
echo " Example: $0 --os-version 26.1"
17+
echo " Platform: Platform to ensure is loaded (e.g., iOS, tvOS, visionOS)"
18+
echo " Example: $0 --os-version 26.1 --platform iOS"
1719
echo " Example: $0 --os-version 16.4"
1820
exit 1
1921
}
@@ -24,6 +26,10 @@ while [[ $# -gt 0 ]]; do
2426
OS_VERSION="$2"
2527
shift 2
2628
;;
29+
--platform)
30+
PLATFORM="$2"
31+
shift 2
32+
;;
2733
*)
2834
echo "Unknown argument: $1"
2935
usage
@@ -36,15 +42,20 @@ if [ -z "$OS_VERSION" ]; then
3642
usage
3743
fi
3844

39-
echo "Ensuring runtime $OS_VERSION is loaded"
45+
if [ -z "$PLATFORM" ]; then
46+
echo "Error: --platform argument is required"
47+
usage
48+
fi
49+
50+
echo "Ensuring runtime $PLATFORM ($OS_VERSION) is loaded"
4051

4152
# Check if the runtime is loaded
42-
if xcrun simctl list runtimes -v | grep -qE "iOS $OS_VERSION" && ! xcrun simctl list runtimes -v | grep -qE "iOS $OS_VERSION.*unavailable" ; then
53+
if xcrun simctl list runtimes -v | grep -qE "$PLATFORM $OS_VERSION" && ! xcrun simctl list runtimes -v | grep -qE "$PLATFORM $OS_VERSION.*unavailable" ; then
4354
echo "Runtime $OS_VERSION is loaded"
4455
exit 0
4556
fi
4657

47-
echo "Runtime $OS_VERSION is not loaded, will try to load it"
58+
echo "Runtime $PLATFORM ($OS_VERSION) is not loaded, will try to load it"
4859

4960
# Unmount simulator volumes once before checking
5061
for dir in /Library/Developer/CoreSimulator/Volumes/*; do
@@ -58,7 +69,7 @@ sudo pkill -9 com.apple.CoreSimulator.CoreSimulatorService || true
5869
count=0
5970
MAX_ATTEMPTS=60 # 300 seconds (5 minutes) timeout
6071
while [ $count -lt $MAX_ATTEMPTS ]; do
61-
if xcrun simctl list runtimes -v | grep -qE "iOS $OS_VERSION" && ! xcrun simctl list runtimes -v | grep -qE "iOS $OS_VERSION.*unavailable"; then
72+
if xcrun simctl list runtimes -v | grep -qE "$PLATFORM $OS_VERSION" && ! xcrun simctl list runtimes -v | grep -qE "$PLATFORM $OS_VERSION.*unavailable"; then
6273
echo "Runtime $OS_VERSION is loaded after $count attempts"
6374
exit 0
6475
fi
@@ -67,5 +78,5 @@ while [ $count -lt $MAX_ATTEMPTS ]; do
6778
sleep 5
6879
done
6980

70-
echo "Runtime $OS_VERSION is not loaded after $count attempts"
81+
echo "Runtime $PLATFORM ($OS_VERSION) is not loaded after $count attempts"
7182
exit 1

0 commit comments

Comments
 (0)