Skip to content

Commit a23a0ef

Browse files
antonisclaude
andauthored
chore(ci): Dynamically select available iPhone simulator for tests (#5577)
* chore(ci): Fix flaky iOS native tests by removing OS=latest The OS=latest parameter in xcodebuild destination is unreliable on GitHub's macos-15 runners due to frequent simulator runtime deprecations. By omitting the OS version, xcodebuild automatically selects any available iPhone 16 simulator, making the tests more stable across runner image updates. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * chore(ci): Dynamically select available iPhone simulator for tests Instead of hardcoding device name and OS version, dynamically find the first available iPhone simulator using xcrun simctl. This prevents failures when specific device/OS combinations aren't available on CI runners. Also adds a debug step to list available simulators for troubleshooting. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * chore(ci): Select iPhone simulator from latest iOS runtime Improves device selection to explicitly choose from the latest available iOS runtime, preventing tests from running on older iOS versions. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent d9f44bb commit a23a0ef

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/native-tests.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,36 @@ jobs:
4949
working-directory: packages/core/RNSentryCocoaTester
5050
run: pod install
5151

52+
- name: List Available Simulators
53+
run: xcrun simctl list devices available iPhone
54+
5255
- name: Run iOS Tests
5356
working-directory: packages/core/RNSentryCocoaTester
5457
env:
5558
SCHEME: RNSentryCocoaTester
5659
CONFIGURATION: Release
57-
DESTINATION: 'platform=iOS Simulator,OS=latest,name=iPhone 16'
5860
run: |
61+
# Find first available iPhone simulator from latest iOS runtime
62+
DEVICE_ID=$(xcrun simctl list devices available iPhone -j | jq -r '
63+
.devices |
64+
to_entries |
65+
map(select(.key | startswith("com.apple.CoreSimulator.SimRuntime.iOS-"))) |
66+
sort_by(.key) |
67+
reverse |
68+
.[0].value[] |
69+
select(.isAvailable == true) |
70+
.udid
71+
' | head -1)
72+
if [ -z "$DEVICE_ID" ]; then
73+
echo "No iPhone simulators available"
74+
exit 1
75+
fi
76+
echo "Using simulator: $DEVICE_ID"
77+
5978
env NSUnbufferedIO=YES \
6079
xcodebuild -workspace *.xcworkspace \
6180
-scheme $SCHEME -configuration $CONFIGURATION \
62-
-destination "$DESTINATION" \
81+
-destination "id=$DEVICE_ID" \
6382
-quiet \
6483
test
6584

0 commit comments

Comments
 (0)