From 84e45063fb35d04fc29e99d6956b82609a67334a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o?= Date: Thu, 17 Jul 2025 11:20:52 +0100 Subject: [PATCH 1/6] feat(INFRA-2766): test simulator configs --- .github/actions/setup-e2e-env/action.yml | 43 ++++++++++++++---------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/actions/setup-e2e-env/action.yml b/.github/actions/setup-e2e-env/action.yml index 2a29f58f..c3f50037 100644 --- a/.github/actions/setup-e2e-env/action.yml +++ b/.github/actions/setup-e2e-env/action.yml @@ -189,29 +189,31 @@ runs: run: brew tap wix/brew && brew install applesimutils shell: bash - - name: Boot iOS Simulator (if not already booted) + - name: Boot iOS Simulator 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 }}'" + # Find and boot simulator + SIMULATOR_ID=$(xcrun simctl list devices | grep "${{ inputs.ios-device }}" | \ + grep -oE '\([A-F0-9-]{36}\)' | tr -d '()' | head -1) + + if [ -z "$SIMULATOR_ID" ]; then + echo "Simulator not found" 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 + + # Shutdown other simulators (key performance win) + xcrun simctl shutdown all 2>/dev/null || true + + # Boot if needed + if ! xcrun simctl list devices | grep "$SIMULATOR_ID" | grep -q "(Booted)"; then echo "Booting simulator..." xcrun simctl boot "$SIMULATOR_ID" fi + + # Essential performance settings + xcrun simctl status_bar "$SIMULATOR_ID" override \ + --time "9:41" --batteryState charged --batteryLevel 100 + shell: bash ## Android Setup ## @@ -321,9 +323,14 @@ runs: -no-boot-anim \ -no-window \ -gpu swiftshader_indirect \ - -no-snapshot \ - -wipe-data \ + -memory 6144 \ + -cores 4 \ + -partition-size 4096 \ + -data-partition-size 4096 \ + -snapshot-save \ + -no-snapshot-load \ -accel on \ + -qemu -smp 4 \ -verbose > /dev/null 2>&1 & shell: bash From f8b5b29ddda43f2c0a70cff2f1e13d192f0d3a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o?= Date: Fri, 18 Jul 2025 11:40:14 +0100 Subject: [PATCH 2/6] feat(INFRA-2766): remove boot --- .github/actions/setup-e2e-env/action.yml | 204 +++++++++++------------ 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/.github/actions/setup-e2e-env/action.yml b/.github/actions/setup-e2e-env/action.yml index c3f50037..3d0e08fb 100644 --- a/.github/actions/setup-e2e-env/action.yml +++ b/.github/actions/setup-e2e-env/action.yml @@ -189,32 +189,32 @@ runs: run: brew tap wix/brew && brew install applesimutils shell: bash - - name: Boot iOS Simulator - if: ${{ inputs.platform == 'ios' && inputs.setup-simulator == 'true' }} - run: | - # Find and boot simulator - SIMULATOR_ID=$(xcrun simctl list devices | grep "${{ inputs.ios-device }}" | \ - grep -oE '\([A-F0-9-]{36}\)' | tr -d '()' | head -1) - - if [ -z "$SIMULATOR_ID" ]; then - echo "Simulator not found" - exit 1 - fi - - # Shutdown other simulators (key performance win) - xcrun simctl shutdown all 2>/dev/null || true - - # Boot if needed - if ! xcrun simctl list devices | grep "$SIMULATOR_ID" | grep -q "(Booted)"; then - echo "Booting simulator..." - xcrun simctl boot "$SIMULATOR_ID" - fi - - # Essential performance settings - xcrun simctl status_bar "$SIMULATOR_ID" override \ - --time "9:41" --batteryState charged --batteryLevel 100 - - shell: bash + #- name: Boot iOS Simulator + # if: ${{ inputs.platform == 'ios' && inputs.setup-simulator == 'true' }} + # run: | + # # Find and boot simulator + # SIMULATOR_ID=$(xcrun simctl list devices | grep "${{ inputs.ios-device }}" | \ + # grep -oE '\([A-F0-9-]{36}\)' | tr -d '()' | head -1) + # + # if [ -z "$SIMULATOR_ID" ]; then + # echo "Simulator not found" + # exit 1 + # fi + # + # # Shutdown other simulators (key performance win) + # xcrun simctl shutdown all 2>/dev/null || true + # + # # Boot if needed + # if ! xcrun simctl list devices | grep "$SIMULATOR_ID" | grep -q "(Booted)"; then + # echo "Booting simulator..." + # xcrun simctl boot "$SIMULATOR_ID" + # fi + # + # # Essential performance settings + # xcrun simctl status_bar "$SIMULATOR_ID" override \ + # --time "9:41" --batteryState charged --batteryLevel 100 + # + # shell: bash ## Android Setup ## @@ -313,81 +313,81 @@ runs: 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 \ - -memory 6144 \ - -cores 4 \ - -partition-size 4096 \ - -data-partition-size 4096 \ - -snapshot-save \ - -no-snapshot-load \ - -accel on \ - -qemu -smp 4 \ - -verbose > /dev/null 2>&1 & - shell: bash + #- 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 \ + # -memory 6144 \ + # -cores 4 \ + # -partition-size 4096 \ + # -data-partition-size 4096 \ + # -snapshot-save \ + # -no-snapshot-load \ + # -accel on \ + # -qemu -smp 4 \ + # -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 + #- 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 From e748a92a5099fa44676a77ac5892f22a0d3b9335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o?= Date: Fri, 18 Jul 2025 11:41:48 +0100 Subject: [PATCH 3/6] feat(INFRA-2766): list ios emuls --- .github/actions/setup-e2e-env/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/setup-e2e-env/action.yml b/.github/actions/setup-e2e-env/action.yml index 3d0e08fb..db06dfd4 100644 --- a/.github/actions/setup-e2e-env/action.yml +++ b/.github/actions/setup-e2e-env/action.yml @@ -189,6 +189,10 @@ runs: run: brew tap wix/brew && brew install applesimutils shell: bash + - name: Check simutils + run: xcrun simctl list devices + shell: bash + #- name: Boot iOS Simulator # if: ${{ inputs.platform == 'ios' && inputs.setup-simulator == 'true' }} # run: | From 07b7c68a270b2090d7481ddf18231f43397157b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o?= Date: Fri, 18 Jul 2025 11:46:47 +0100 Subject: [PATCH 4/6] feat(INFRA-2766): test --- .github/actions/setup-e2e-env/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-e2e-env/action.yml b/.github/actions/setup-e2e-env/action.yml index db06dfd4..557761fb 100644 --- a/.github/actions/setup-e2e-env/action.yml +++ b/.github/actions/setup-e2e-env/action.yml @@ -190,6 +190,7 @@ runs: shell: bash - name: Check simutils + if: ${{ inputs.platform == 'ios' }} run: xcrun simctl list devices shell: bash From fa3e310271d12b393e08652227b33e78fc2d7950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o?= Date: Fri, 18 Jul 2025 16:12:00 +0100 Subject: [PATCH 5/6] feat(INFRA-2766): remove boot stuff for commented --- .github/actions/setup-e2e-env/action.yml | 112 ----------------------- 1 file changed, 112 deletions(-) diff --git a/.github/actions/setup-e2e-env/action.yml b/.github/actions/setup-e2e-env/action.yml index 557761fb..79909738 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 @@ -194,33 +189,6 @@ runs: run: xcrun simctl list devices shell: bash - #- name: Boot iOS Simulator - # if: ${{ inputs.platform == 'ios' && inputs.setup-simulator == 'true' }} - # run: | - # # Find and boot simulator - # SIMULATOR_ID=$(xcrun simctl list devices | grep "${{ inputs.ios-device }}" | \ - # grep -oE '\([A-F0-9-]{36}\)' | tr -d '()' | head -1) - # - # if [ -z "$SIMULATOR_ID" ]; then - # echo "Simulator not found" - # exit 1 - # fi - # - # # Shutdown other simulators (key performance win) - # xcrun simctl shutdown all 2>/dev/null || true - # - # # Boot if needed - # if ! xcrun simctl list devices | grep "$SIMULATOR_ID" | grep -q "(Booted)"; then - # echo "Booting simulator..." - # xcrun simctl boot "$SIMULATOR_ID" - # fi - # - # # Essential performance settings - # xcrun simctl status_bar "$SIMULATOR_ID" override \ - # --time "9:41" --batteryState charged --batteryLevel 100 - # - # shell: bash - ## Android Setup ## ## JDK Setup @@ -316,83 +284,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 \ - # -memory 6144 \ - # -cores 4 \ - # -partition-size 4096 \ - # -data-partition-size 4096 \ - # -snapshot-save \ - # -no-snapshot-load \ - # -accel on \ - # -qemu -smp 4 \ - # -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 From c9a9b0956c98a6521e2ca3da76e32eb8feda6c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o?= Date: Fri, 18 Jul 2025 16:14:26 +0100 Subject: [PATCH 6/6] feat(INFRA-2766): add kvm stuff --- .github/actions/setup-e2e-env/action.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/actions/setup-e2e-env/action.yml b/.github/actions/setup-e2e-env/action.yml index 79909738..3902f7d9 100644 --- a/.github/actions/setup-e2e-env/action.yml +++ b/.github/actions/setup-e2e-env/action.yml @@ -199,6 +199,14 @@ runs: java-version: ${{ inputs.jdk-version }} distribution: ${{ inputs.jdk-distribution }} + - 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