@@ -16,11 +16,6 @@ inputs:
1616 description : ' Whether to setup simulator/emulator'
1717 required : false
1818 default : ' false'
19- # See https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md#installed-simulators
20- ios-device :
21- description : Name of iOS device to boot (e.g., "iPhone 15")
22- required : false
23- default : ' iPhone 15'
2419 bundler-version :
2520 description : ' Bundler version to use (only for iOS)'
2621 required : false
@@ -214,29 +209,9 @@ runs:
214209 run : brew tap wix/brew && brew install applesimutils
215210 shell : bash
216211
217- - name : Boot iOS Simulator (if not already booted)
218- if : ${{ inputs.platform == 'ios' && inputs.setup-simulator == 'true' }}
219- run : |
220- echo "Looking for simulator named: ${{ inputs.ios-device }}"
221-
222- SIMULATOR_LINE=$(xcrun simctl list devices | grep -m1 "${{ inputs.ios-device }}")
223- if [ -z "$SIMULATOR_LINE" ]; then
224- echo "No simulator found with name '${{ inputs.ios-device }}'"
225- exit 1
226- fi
227-
228- SIMULATOR_ID=$(echo "$SIMULATOR_LINE" | awk -F '[()]' '{print $2}')
229- SIMULATOR_STATE=$(echo "$SIMULATOR_LINE" | awk -F '[()]' '{print $(NF-1)}')
230-
231- echo "Simulator ID: $SIMULATOR_ID"
232- echo "Simulator State: $SIMULATOR_STATE"
233-
234- if [ "$SIMULATOR_STATE" = "Booted" ]; then
235- echo "Simulator is already booted. Skipping boot step."
236- else
237- echo "Booting simulator..."
238- xcrun simctl boot "$SIMULATOR_ID"
239- fi
212+ - name : Check simutils
213+ if : ${{ inputs.platform == 'ios' }}
214+ run : xcrun simctl list devices
240215 shell : bash
241216
242217 # # Android Setup ##
@@ -248,8 +223,7 @@ runs:
248223 with :
249224 java-version : ${{ inputs.jdk-version }}
250225 distribution : ${{ inputs.jdk-distribution }}
251-
252- # # Android Certificate Setup
226+
253227 - name : Configure Android Signing Certificates
254228 if : ${{ inputs.platform == 'android' && inputs.configure-keystores == 'true' }}
255229 uses : MetaMask/github-tools/.github/actions/configure-keystore@e2e-env-actions
@@ -259,6 +233,14 @@ runs:
259233 platform : ' android'
260234 environment : ${{ inputs.environment }}
261235
236+ - name : Enable KVM group perms (Ubuntu only)
237+ if : ${{ inputs.platform == 'android' && runner.os == 'Linux' }}
238+ run : |
239+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
240+ sudo udevadm control --reload-rules
241+ sudo udevadm trigger --name-match=kvm
242+ shell : bash
243+
262244 # # Android SDK Setup
263245
264246 - name : Install required emulator dependencies
@@ -344,78 +326,3 @@ runs:
344326 --package "$IMAGE" \
345327 --device "${{ inputs.android-device }}"
346328 shell : bash
347-
348- # Launch Android Emulator
349- - name : Launch Android Emulator
350- if : ${{ inputs.platform == 'android' && inputs.setup-simulator == 'true' }}
351- run : |
352- # Linux with KVM hardware acceleration
353- nohup "$ANDROID_HOME/emulator/emulator" \
354- -avd "${{ inputs.android-avd-name }}" \
355- -no-audio \
356- -no-boot-anim \
357- -no-window \
358- -gpu swiftshader_indirect \
359- -no-snapshot \
360- -wipe-data \
361- -accel on \
362- -verbose > /dev/null 2>&1 &
363- shell : bash
364-
365- # # Wait for Emulator to Boot
366- - name : Wait for Android Emulator to Boot
367- if : ${{ inputs.platform == 'android' && inputs.setup-simulator == 'true' }}
368- run : |
369- echo "Waiting for emulator to be ready on $RUNNER_OS..."
370-
371- # Wait for device to be detected by ADB
372- echo "Waiting for ADB to detect device..."
373- adb wait-for-device
374-
375- # Additional wait for emulator to stabilize
376- sleep 10
377-
378- # Check emulator status
379- echo "Checking emulator processes..."
380- if [ "$RUNNER_OS" = "Linux" ]; then
381- ps aux | grep emulator || echo "No emulator processes found"
382- fi
383-
384- # Wait for boot to complete
385- bootanim=""
386- timeout=600 # 10 minutes for initial boot (Linux might be slower)
387- elapsed=0
388-
389- while [[ "$elapsed" -lt "$timeout" ]]; do
390- bootanim=$(adb shell getprop init.svc.bootanim 2>/dev/null || echo "unknown")
391- sys_boot_completed=$(adb shell getprop sys.boot_completed 2>/dev/null || echo "0")
392-
393- echo "Waiting for emulator... bootanim: $bootanim, boot_completed: $sys_boot_completed (${elapsed}s elapsed)"
394-
395- if [[ "$bootanim" == *"stopped"* ]] && [[ "$sys_boot_completed" == "1" ]]; then
396- echo "✅ Emulator booted successfully"
397-
398- # Unlock screen and disable animations for testing
399- adb shell input keyevent 82 # Unlock
400- adb shell settings put global window_animation_scale 0
401- adb shell settings put global transition_animation_scale 0
402- adb shell settings put global animator_duration_scale 0
403-
404- echo "✅ Emulator is ready for testing"
405- exit 0
406- fi
407-
408- sleep 10
409- elapsed=$((elapsed + 10))
410- done
411-
412- echo "❌ Timeout waiting for emulator to boot"
413-
414- # Debug information on failure
415- echo "Debug: ADB devices:"
416- adb devices
417- echo "Debug: Emulator processes:"
418- ps aux | grep emulator || echo "No emulator processes found"
419-
420- exit 1
421- shell : bash
0 commit comments