Skip to content

Commit ae3e4c7

Browse files
runningcodeclaude
andauthored
ci: Add Android 37 emulator to critical UI test matrix (JAVA-647) (#5775)
Add an API level 37 (Android 17) emulator to the critical UI test matrix. API 37 ships only as a minor-versioned image, so the api-level is "37.0" (the platform and system image packages are android-37.0, not android-37) and only as google_apis_ps16k; there is no plain google_apis image. The runner's preinstalled avdmanager is too old to parse the minor version and writes target=android-0 into the AVD config, so the emulator clamps to API 3 and boots misconfigured. Update cmdline-tools before creating the AVD, and key the AVD cache on the tools version to invalidate broken caches. Workaround from ReactiveCircus/android-emulator-runner#482. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e82419d commit ae3e4c7

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ jobs:
7575
target: google_apis
7676
channel: canary # Necessary for ATDs
7777
arch: x86_64
78+
- api-level: "37.0" # Android 17; API 37 ships only as a minor-versioned image
79+
target: google_apis_ps16k # API 37 has no plain google_apis image
80+
channel: canary # Necessary for ATDs
81+
arch: x86_64
7882
steps:
7983
- name: Checkout code
8084
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -85,14 +89,32 @@ jobs:
8589
sudo udevadm control --reload-rules
8690
sudo udevadm trigger --name-match=kvm
8791
92+
# The runner ships an outdated avdmanager that writes target=android-0 into the
93+
# AVD config for minor-versioned packages (android-37.x), so the emulator clamps
94+
# to API 3 and boots misconfigured. Update cmdline-tools so avdmanager parses it.
95+
# See https://github.com/ReactiveCircus/android-emulator-runner/issues/482
96+
- name: Update SDK cmdline-tools
97+
id: cmdline-tools
98+
run: |
99+
SDK="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-/usr/local/lib/android/sdk}}"
100+
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --install "cmdline-tools;latest" > /dev/null
101+
# sdkmanager won't overwrite the preinstalled dir, so it installs to latest-2.
102+
if [ -d "$SDK/cmdline-tools/latest-2" ]; then
103+
rm -rf "$SDK/cmdline-tools/latest"
104+
mv "$SDK/cmdline-tools/latest-2" "$SDK/cmdline-tools/latest"
105+
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+
88108
- name: AVD cache
89109
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
90110
id: avd-cache
91111
with:
92112
path: |
93113
~/.android/avd/*
94114
~/.android/adb*
95-
key: avd-api-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }}
115+
# Keyed on the cmdline-tools version so AVDs created by the old, broken
116+
# avdmanager are invalidated automatically.
117+
key: avd-api-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }}-tools${{ steps.cmdline-tools.outputs.version }}
96118

97119
- name: Create AVD and generate snapshot for caching
98120
if: steps.avd-cache.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)