Skip to content

Commit ab00b5a

Browse files
committed
Detect iPhone sim for testing.
1 parent 51314e8 commit ab00b5a

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

.github/workflows/unit-tests-workflow.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,19 @@ jobs:
2020
- name: Detect Available iOS Simulator
2121
id: detect-simulator
2222
run: |
23-
# Try to find specific iPhone simulators first
24-
SIMULATOR_OUTPUT=$(xcrun simctl list devices available | grep -B 1 "iPhone" | head -2)
23+
echo "Listing available iOS Simulators..."
24+
xcrun simctl list devices available iOS
2525
26-
if [ -n "$SIMULATOR_OUTPUT" ]; then
27-
# Specific iPhone simulator found - extract details
28-
IOS_VERSION=$(echo "$SIMULATOR_OUTPUT" | grep -oE "iOS [0-9]+\.[0-9]+" | sed 's/iOS //')
29-
SIMULATOR_NAME=$(echo "$SIMULATOR_OUTPUT" | grep "iPhone" | grep -oE "iPhone [^(]+" | sed 's/[[:space:]]*$//')
30-
31-
echo "Found specific simulator: $SIMULATOR_NAME with iOS $IOS_VERSION"
32-
echo "destination=platform=iOS Simulator,name=$SIMULATOR_NAME,OS=$IOS_VERSION" >> $GITHUB_OUTPUT
26+
# Find the first available and booted/bootable iPhone simulator
27+
SIMULATOR_ID=$(xcrun simctl list devices available iOS | grep -m 1 "iPhone" | grep -oE '\([A-Z0-9-]+\)' | tr -d '()')
28+
29+
if [ -n "$SIMULATOR_ID" ]; then
30+
echo "Using simulator ID: $SIMULATOR_ID"
31+
echo "destination=platform=iOS Simulator,id=$SIMULATOR_ID" >> $GITHUB_OUTPUT
3332
else
34-
# No specific simulators found - use generic placeholder
35-
echo "No specific iPhone simulators found, using generic 'Any iOS Simulator Device'"
36-
echo "destination=platform=iOS Simulator,name=Any iOS Simulator Device" >> $GITHUB_OUTPUT
33+
# Fallback to generic iOS Simulator (uses default for the Xcode version)
34+
echo "No specific iPhone found, using generic iOS Simulator"
35+
echo "destination=generic/platform=iOS Simulator" >> $GITHUB_OUTPUT
3736
fi
3837
- name: Test
3938
run: xcodebuild test -scheme segment-appsflyer-ios -workspace segment-appsflyer-ios.xcworkspace -destination '${{ steps.detect-simulator.outputs.destination }}' | xcpretty && exit ${PIPESTATUS[0]}

0 commit comments

Comments
 (0)