Skip to content

Commit 4ab0ce0

Browse files
ci(ui-tests): Cold boot the critical UI test emulator instead of caching the AVD (#6720)
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
1 parent 8c11538 commit 4ab0ce0

1 file changed

Lines changed: 2 additions & 53 deletions

File tree

‎.github/workflows/integration-tests-ui-critical.yml‎

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ jobs:
9494
# to API 3 and boots misconfigured. Update cmdline-tools so avdmanager parses it.
9595
# See https://github.com/ReactiveCircus/android-emulator-runner/issues/482
9696
- name: Update SDK cmdline-tools
97-
id: cmdline-tools
9897
run: |
9998
SDK="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-/usr/local/lib/android/sdk}}"
10099
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --install "cmdline-tools;latest" > /dev/null
@@ -103,57 +102,6 @@ jobs:
103102
rm -rf "$SDK/cmdline-tools/latest"
104103
mv "$SDK/cmdline-tools/latest-2" "$SDK/cmdline-tools/latest"
105104
fi
106-
echo "version=$("$SDK/cmdline-tools/latest/bin/sdkmanager" --version 2>/dev/null | grep -Eo '^[0-9][0-9.]*' | head -1)" >> "$GITHUB_OUTPUT"
107-
108-
# Snapshots only load on the emulator version that created them. The canary channel
109-
# moves often, so a cached snapshot from an older emulator is silently rejected and the
110-
# emulator cold boots. Tests then run while the system is still busy with first-boot work.
111-
# Install the emulator up front (the runner reuses it) and key the AVD cache on its version.
112-
- name: Install emulator
113-
id: emulator
114-
run: |
115-
SDK="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-/usr/local/lib/android/sdk}}"
116-
case "${{ matrix.channel }}" in
117-
stable) CHANNEL=0 ;;
118-
beta) CHANNEL=1 ;;
119-
dev) CHANNEL=2 ;;
120-
canary) CHANNEL=3 ;;
121-
*) echo "Unknown channel: ${{ matrix.channel }}"; exit 1 ;;
122-
esac
123-
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --install emulator --channel="$CHANNEL" > /dev/null
124-
VERSION=$(grep -E '^Pkg\.Revision=' "$SDK/emulator/source.properties" | cut -d= -f2)
125-
if [ -z "$VERSION" ]; then
126-
echo "Could not read the emulator version from $SDK/emulator/source.properties"
127-
exit 1
128-
fi
129-
echo "Emulator version: $VERSION"
130-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
131-
132-
- name: AVD cache
133-
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
134-
id: avd-cache
135-
with:
136-
path: |
137-
~/.android/avd/*
138-
~/.android/adb*
139-
# Keyed on memory, the cmdline-tools version and the emulator version so incompatible
140-
# snapshots and AVDs created by the old, broken avdmanager are invalidated automatically.
141-
key: avd-api-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }}-memory${{ matrix.memory }}-tools${{ steps.cmdline-tools.outputs.version }}-emulator${{ steps.emulator.outputs.version }}
142-
143-
- name: Create AVD and generate snapshot for caching
144-
if: steps.avd-cache.outputs.cache-hit != 'true'
145-
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2
146-
with:
147-
api-level: ${{ matrix.api-level }}
148-
target: ${{ matrix.target }}
149-
channel: ${{ matrix.channel }}
150-
arch: ${{ matrix.arch }}
151-
force-avd-creation: false
152-
disable-animations: true
153-
disable-spellchecker: true
154-
emulator-options: -memory ${{ matrix.memory }} -no-window -gpu auto -noaudio -no-boot-anim -camera-back none
155-
disk-size: 4096M
156-
script: echo "Generated AVD snapshot for caching."
157105
158106
- name: Download APK artifact
159107
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
@@ -168,7 +116,7 @@ jobs:
168116
- name: Run tests
169117
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2.38.0
170118
env:
171-
# Default is 15s. In case of an emulator cold-boot due to cache invalidation this isn't always enough.
119+
# Default is 15s. The emulator cold boots and is still busy with first-boot work, so this isn't always enough.
172120
MAESTRO_DRIVER_STARTUP_TIMEOUT: 60000
173121
with:
174122
api-level: ${{ matrix.api-level }}
@@ -179,6 +127,7 @@ jobs:
179127
disable-animations: true
180128
disable-spellchecker: true
181129
emulator-options: -memory ${{ matrix.memory }} -no-window -gpu auto -noaudio -no-boot-anim -camera-back none -no-snapshot-save
130+
disk-size: 4096M
182131
script: |
183132
adb uninstall io.sentry.uitest.android.critical || echo "Already uninstalled (or not found)"
184133
adb install -r -d "${{env.APK_NAME}}"

0 commit comments

Comments
 (0)