5454 SIMULATOR_NAME="iPhone 16"
5555 echo "SIMULATOR_NAME=$SIMULATOR_NAME" >> $GITHUB_ENV
5656
57- # List available simulators
57+ # List available simulators and runtimes
58+ echo "=== Available iOS Simulators ==="
5859 xcrun simctl list devices available
60+ echo ""
61+ echo "=== Available iOS Runtimes ==="
62+ xcrun simctl list runtimes
63+ echo ""
64+ echo "=== Available Device Types ==="
65+ xcrun simctl list devicetypes
66+
67+ # Check if iPhone 16 simulator exists, if not create it
68+ if ! xcrun simctl list devices available | grep -q "iPhone 16"; then
69+ echo "iPhone 16 simulator not found, creating it..."
70+
71+ # Get the latest iOS runtime
72+ LATEST_RUNTIME=$(xcrun simctl list runtimes | grep "iOS" | tail -1 | awk '{print $NF}' | tr -d '()')
73+ echo "Latest iOS runtime: $LATEST_RUNTIME"
74+
75+ # Get iPhone 16 device type
76+ IPHONE_16_TYPE=$(xcrun simctl list devicetypes | grep "iPhone 16" | head -1 | awk '{print $NF}' | tr -d '()')
77+ echo "iPhone 16 device type: $IPHONE_16_TYPE"
78+
79+ if [ -n "$LATEST_RUNTIME" ] && [ -n "$IPHONE_16_TYPE" ]; then
80+ # Create the simulator
81+ xcrun simctl create "$SIMULATOR_NAME" "$IPHONE_16_TYPE" "$LATEST_RUNTIME"
82+ echo "Created iPhone 16 simulator"
83+ else
84+ echo "Could not find suitable runtime or device type for iPhone 16"
85+ # List available options for debugging
86+ echo "Available runtimes:"
87+ xcrun simctl list runtimes
88+ echo "Available device types:"
89+ xcrun simctl list devicetypes | grep iPhone
90+ fi
91+ fi
5992
6093 # Kill any existing simulators to start fresh
6194 xcrun simctl shutdown all || true
@@ -79,12 +112,6 @@ jobs:
79112 # Additional wait for simulator to be fully ready
80113 sleep 15
81114
82- # Install the app
83- #xcrun simctl install "$SIMULATOR_NAME" e2e-app/bitkit.app
84-
85- # Verify app installation
86- xcrun simctl listapps "$SIMULATOR_NAME" | grep -i bitkit || echo "App not found in simulator"
87-
88115 # Check simulator status
89116 xcrun simctl list devices | grep "$SIMULATOR_NAME"
90117
@@ -113,13 +140,31 @@ jobs:
113140 E2E : true
114141 run : |
115142 echo "=== Building iOS app ==="
116- xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
117- -scheme Bitkit \
118- -configuration Debug \
119- -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
120- -derivedDataPath DerivedData \
121- -allowProvisioningUpdates \
122- build
143+
144+ # Get the UDID of the booted simulator
145+ SIMULATOR_UDID=$(xcrun simctl list devices | grep "$SIMULATOR_NAME" | grep "Booted" | awk '{print $NF}' | tr -d '()')
146+ echo "Using simulator UDID: $SIMULATOR_UDID"
147+
148+ if [ -n "$SIMULATOR_UDID" ]; then
149+ # Build with specific simulator UDID
150+ xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
151+ -scheme Bitkit \
152+ -configuration Debug \
153+ -destination "platform=iOS Simulator,id=$SIMULATOR_UDID" \
154+ -derivedDataPath DerivedData \
155+ -allowProvisioningUpdates \
156+ build
157+ else
158+ # Fallback to generic iOS Simulator destination
159+ echo "No booted simulator found, trying generic destination..."
160+ xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
161+ -scheme Bitkit \
162+ -configuration Debug \
163+ -destination 'platform=iOS Simulator,name=iPhone 16' \
164+ -derivedDataPath DerivedData \
165+ -allowProvisioningUpdates \
166+ build
167+ fi
123168
124169 - name : Prepare app for E2E tests
125170 run : |
0 commit comments