From d0cb372fddb469f7a475546aa7d9b3433702abf1 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Fri, 20 Nov 2026 16:44:05 +0000 Subject: [PATCH] ci(ui-tests): Cold boot the critical UI test emulator instead of caching the AVD Co-Authored-By: Roman Zavarnitsyn --- .../integration-tests-ui-critical.yml | 55 +------------------ 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 22c262fd21..46345d8fad 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -94,7 +94,6 @@ jobs: # to API 3 and boots misconfigured. Update cmdline-tools so avdmanager parses it. # See https://github.com/ReactiveCircus/android-emulator-runner/issues/482 - name: Update SDK cmdline-tools - id: cmdline-tools run: | SDK="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-/usr/local/lib/android/sdk}}" yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --install "cmdline-tools;latest" > /dev/null @@ -103,57 +102,6 @@ jobs: rm -rf "$SDK/cmdline-tools/latest" mv "$SDK/cmdline-tools/latest-2" "$SDK/cmdline-tools/latest" fi - echo "version=$("$SDK/cmdline-tools/latest/bin/sdkmanager" --version 2>/dev/null | grep -Eo '^[0-9][0-9.]*' | head -1)" >> "$GITHUB_OUTPUT" - - # Snapshots only load on the emulator version that created them. The canary channel - # moves often, so a cached snapshot from an older emulator is silently rejected and the - # emulator cold boots. Tests then run while the system is still busy with first-boot work. - # Install the emulator up front (the runner reuses it) and key the AVD cache on its version. - - name: Install emulator - id: emulator - run: | - SDK="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-/usr/local/lib/android/sdk}}" - case "${{ matrix.channel }}" in - stable) CHANNEL=0 ;; - beta) CHANNEL=1 ;; - dev) CHANNEL=2 ;; - canary) CHANNEL=3 ;; - *) echo "Unknown channel: ${{ matrix.channel }}"; exit 1 ;; - esac - yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --install emulator --channel="$CHANNEL" > /dev/null - VERSION=$(grep -E '^Pkg\.Revision=' "$SDK/emulator/source.properties" | cut -d= -f2) - if [ -z "$VERSION" ]; then - echo "Could not read the emulator version from $SDK/emulator/source.properties" - exit 1 - fi - echo "Emulator version: $VERSION" - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - - name: AVD cache - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - id: avd-cache - with: - path: | - ~/.android/avd/* - ~/.android/adb* - # Keyed on memory, the cmdline-tools version and the emulator version so incompatible - # snapshots and AVDs created by the old, broken avdmanager are invalidated automatically. - key: avd-api-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }}-memory${{ matrix.memory }}-tools${{ steps.cmdline-tools.outputs.version }}-emulator${{ steps.emulator.outputs.version }} - - - name: Create AVD and generate snapshot for caching - if: steps.avd-cache.outputs.cache-hit != 'true' - uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2 - with: - api-level: ${{ matrix.api-level }} - target: ${{ matrix.target }} - channel: ${{ matrix.channel }} - arch: ${{ matrix.arch }} - force-avd-creation: false - disable-animations: true - disable-spellchecker: true - emulator-options: -memory ${{ matrix.memory }} -no-window -gpu auto -noaudio -no-boot-anim -camera-back none - disk-size: 4096M - script: echo "Generated AVD snapshot for caching." - name: Download APK artifact uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 @@ -168,7 +116,7 @@ jobs: - name: Run tests uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2.38.0 env: - # Default is 15s. In case of an emulator cold-boot due to cache invalidation this isn't always enough. + # Default is 15s. The emulator cold boots and is still busy with first-boot work, so this isn't always enough. MAESTRO_DRIVER_STARTUP_TIMEOUT: 60000 with: api-level: ${{ matrix.api-level }} @@ -179,6 +127,7 @@ jobs: disable-animations: true disable-spellchecker: true emulator-options: -memory ${{ matrix.memory }} -no-window -gpu auto -noaudio -no-boot-anim -camera-back none -no-snapshot-save + disk-size: 4096M script: | adb uninstall io.sentry.uitest.android.critical || echo "Already uninstalled (or not found)" adb install -r -d "${{env.APK_NAME}}"