Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 2 additions & 53 deletions .github/workflows/integration-tests-ui-critical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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}}"
Expand Down
Loading