Skip to content

Commit 916825c

Browse files
committed
chore: Ensure required simulators are loaded for all platforms
1 parent 3acb318 commit 916825c

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
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/ui-tests-common.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ jobs:
111111

112112
- name: Ensure required runtime is loaded
113113
# 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' }}
115114
timeout-minutes: 5 # 5 minutes timeout
116115
env:
117116
OS_VERSION: ${{ inputs.test-destination-os }}
118-
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION"
117+
PLATFORM: ${{ inputs.platform }}
118+
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION" --platform "$PLATFORM"
119119

120120
- name: Create simulator device
121121
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ jobs:
9494

9595
- name: Ensure required runtime is loaded
9696
# 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' }}
9897
timeout-minutes: 5 # 5 minutes timeout
9998
env:
10099
OS_VERSION: ${{ inputs.test-destination-os }}
101-
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION"
100+
PLATFORM: ${{ inputs.platform }}
101+
run: ./scripts/ci-ensure-runtime-loaded.sh --os-version "$OS_VERSION" --platform "$PLATFORM"
102102

103103
# Create simulator devices for non-preinstalled simulators
104104
# 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: 15 additions & 4 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,10 +42,15 @@ if [ -z "$OS_VERSION" ]; then
3642
usage
3743
fi
3844

45+
if [ -z "$PLATFORM" ]; then
46+
echo "Error: --platform argument is required"
47+
usage
48+
fi
49+
3950
echo "Ensuring runtime $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
@@ -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

0 commit comments

Comments
 (0)