diff --git a/.github/actions/setup-e2e-env/action.yml b/.github/actions/setup-e2e-env/action.yml index bb71d6c1..8549d29c 100644 --- a/.github/actions/setup-e2e-env/action.yml +++ b/.github/actions/setup-e2e-env/action.yml @@ -16,11 +16,6 @@ inputs: description: 'Whether to setup simulator/emulator' required: false default: 'false' - # See https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md#installed-simulators - ios-device: - description: Name of iOS device to boot (e.g., "iPhone 15") - required: false - default: 'iPhone 15' bundler-version: description: 'Bundler version to use (only for iOS)' required: false @@ -214,29 +209,9 @@ runs: run: brew tap wix/brew && brew install applesimutils shell: bash - - name: Boot iOS Simulator (if not already booted) - if: ${{ inputs.platform == 'ios' && inputs.setup-simulator == 'true' }} - run: | - echo "Looking for simulator named: ${{ inputs.ios-device }}" - - SIMULATOR_LINE=$(xcrun simctl list devices | grep -m1 "${{ inputs.ios-device }}") - if [ -z "$SIMULATOR_LINE" ]; then - echo "No simulator found with name '${{ inputs.ios-device }}'" - exit 1 - fi - - SIMULATOR_ID=$(echo "$SIMULATOR_LINE" | awk -F '[()]' '{print $2}') - SIMULATOR_STATE=$(echo "$SIMULATOR_LINE" | awk -F '[()]' '{print $(NF-1)}') - - echo "Simulator ID: $SIMULATOR_ID" - echo "Simulator State: $SIMULATOR_STATE" - - if [ "$SIMULATOR_STATE" = "Booted" ]; then - echo "Simulator is already booted. Skipping boot step." - else - echo "Booting simulator..." - xcrun simctl boot "$SIMULATOR_ID" - fi + - name: Check simutils + if: ${{ inputs.platform == 'ios' }} + run: xcrun simctl list devices shell: bash ## Android Setup ## @@ -248,8 +223,7 @@ runs: with: java-version: ${{ inputs.jdk-version }} distribution: ${{ inputs.jdk-distribution }} - - ## Android Certificate Setup + - name: Configure Android Signing Certificates if: ${{ inputs.platform == 'android' && inputs.configure-keystores == 'true' }} uses: MetaMask/github-tools/.github/actions/configure-keystore@e2e-env-actions @@ -259,6 +233,14 @@ runs: platform: 'android' environment: ${{ inputs.environment }} + - name: Enable KVM group perms (Ubuntu only) + if: ${{ inputs.platform == 'android' && runner.os == 'Linux' }} + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + shell: bash + ## Android SDK Setup - name: Install required emulator dependencies @@ -344,78 +326,3 @@ runs: --package "$IMAGE" \ --device "${{ inputs.android-device }}" shell: bash - - # Launch Android Emulator - - name: Launch Android Emulator - if: ${{ inputs.platform == 'android' && inputs.setup-simulator == 'true' }} - run: | - # Linux with KVM hardware acceleration - nohup "$ANDROID_HOME/emulator/emulator" \ - -avd "${{ inputs.android-avd-name }}" \ - -no-audio \ - -no-boot-anim \ - -no-window \ - -gpu swiftshader_indirect \ - -no-snapshot \ - -wipe-data \ - -accel on \ - -verbose > /dev/null 2>&1 & - shell: bash - - ## Wait for Emulator to Boot - - name: Wait for Android Emulator to Boot - if: ${{ inputs.platform == 'android' && inputs.setup-simulator == 'true' }} - run: | - echo "Waiting for emulator to be ready on $RUNNER_OS..." - - # Wait for device to be detected by ADB - echo "Waiting for ADB to detect device..." - adb wait-for-device - - # Additional wait for emulator to stabilize - sleep 10 - - # Check emulator status - echo "Checking emulator processes..." - if [ "$RUNNER_OS" = "Linux" ]; then - ps aux | grep emulator || echo "No emulator processes found" - fi - - # Wait for boot to complete - bootanim="" - timeout=600 # 10 minutes for initial boot (Linux might be slower) - elapsed=0 - - while [[ "$elapsed" -lt "$timeout" ]]; do - bootanim=$(adb shell getprop init.svc.bootanim 2>/dev/null || echo "unknown") - sys_boot_completed=$(adb shell getprop sys.boot_completed 2>/dev/null || echo "0") - - echo "Waiting for emulator... bootanim: $bootanim, boot_completed: $sys_boot_completed (${elapsed}s elapsed)" - - if [[ "$bootanim" == *"stopped"* ]] && [[ "$sys_boot_completed" == "1" ]]; then - echo "✅ Emulator booted successfully" - - # Unlock screen and disable animations for testing - adb shell input keyevent 82 # Unlock - adb shell settings put global window_animation_scale 0 - adb shell settings put global transition_animation_scale 0 - adb shell settings put global animator_duration_scale 0 - - echo "✅ Emulator is ready for testing" - exit 0 - fi - - sleep 10 - elapsed=$((elapsed + 10)) - done - - echo "❌ Timeout waiting for emulator to boot" - - # Debug information on failure - echo "Debug: ADB devices:" - adb devices - echo "Debug: Emulator processes:" - ps aux | grep emulator || echo "No emulator processes found" - - exit 1 - shell: bash