From 527dedbfbcd7d0fcd0a9cf2f34cff58d2c504395 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 3 Nov 2026 11:10:39 +1100 Subject: [PATCH 1/7] Run connected tests on an `android` queue emulator Firebase Test Lab rejects `Nexus5X`, so no test has run since at least September 2025. Jeremy Massel listed moving to the `android` queue as one option in AINFRA-3575. The agent image has no emulator or system image, so the job installs them itself. `/dev/kvm` and `-accel-check` run first so a missing nested virtualization fails with a clear signal. --- Generated with the help of Claude Code (Opus 5.5), https://code.claude.com --- .buildkite/commands/connected-tests.sh | 49 ++++++++++++++++++-------- .buildkite/pipeline.yml | 4 ++- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/.buildkite/commands/connected-tests.sh b/.buildkite/commands/connected-tests.sh index 2fc465dbf..2cb3a1017 100644 --- a/.buildkite/commands/connected-tests.sh +++ b/.buildkite/commands/connected-tests.sh @@ -1,21 +1,40 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail -echo "--- :closed_lock_with_key: Installing Secrets" -./gradlew applyConfiguration +SYSTEM_IMAGE="system-images;android-34;google_apis;x86_64" +AVD_NAME="aztec-connected-tests" +EMULATOR_LOG="build/emulator.log" -echo -e "\n--- :gcloud: Logging into Google Cloud" -gcloud auth activate-service-account --key-file .configure-files/firebase.secrets.json +export PATH="$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools:$PATH" -echo -e "\n--- :hammer_and_wrench: Building Tests" -./gradlew --stacktrace app:assembleDebug app:assembleDebugAndroidTest +stop_emulator() { + adb emu kill || true + avdmanager delete avd --name "$AVD_NAME" || true +} -echo -e "\n--- :firebase: Run Tests" -gcloud firebase test android run \ - --project api-project-108380595987 \ - --type instrumentation \ - --app app/build/outputs/apk/debug/app-debug.apk \ - --test app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \ - --device model=Nexus5X,version=26,locale=en,orientation=portrait \ - --verbosity info +echo "--- :package: Installing emulator and system image" +sdkmanager "emulator" "platform-tools" "$SYSTEM_IMAGE" > /dev/null + +echo "--- :mag: Checking hardware acceleration" +ls -la /dev/kvm +emulator -accel-check + +echo "--- :robot_face: Starting Android emulator" +avdmanager create avd --force --name "$AVD_NAME" --package "$SYSTEM_IMAGE" --device "pixel_5" <<< "no" +trap stop_emulator EXIT + +mkdir -p "$(dirname "$EMULATOR_LOG")" +emulator -avd "$AVD_NAME" -no-window -no-audio -no-boot-anim -no-snapshot -gpu swiftshader_indirect > "$EMULATOR_LOG" 2>&1 & + +timeout 300 adb wait-for-device +timeout 300 bash -c 'until [[ "$(adb shell getprop sys.boot_completed 2> /dev/null | tr -d "\r")" == "1" ]]; do sleep 5; done' + +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 +adb shell settings put secure long_press_timeout 1800 +adb shell input keyevent 82 + +echo "--- :android: Running connected tests" +./gradlew --stacktrace :app:connectedDebugAndroidTest diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index df142f5ba..f452c0240 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -33,7 +33,9 @@ steps: command: .buildkite/commands/connected-tests.sh plugins: [$CI_TOOLKIT] artifact_paths: - - "aztec/build/test-results/**/*.xml" + - "app/build/reports/androidTests/connected/**/*" + - "app/build/outputs/androidTest-results/connected/**/*" + - "build/emulator.log" - label: "Publish :aztec" key: "publish-aztec" From 0a911a12761336d10790bd1c6b9e2e7c4287a103 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 3 Nov 2026 11:11:13 +1100 Subject: [PATCH 2/7] Remove the unused Firebase secret setup Connected tests were the only consumer of `firebase.secrets.json`, and they now run on an emulator. That leaves nothing to migrate to `a8c-secrets`, which is the question AINFRA-3575 asked. --- Generated with the help of Claude Code (Opus 5.5), https://code.claude.com --- .configure | 11 ----------- .configure-files/firebase.secrets.json.enc | Bin 2412 -> 0 bytes .gitignore | 10 ---------- build.gradle | 11 ----------- 4 files changed, 32 deletions(-) delete mode 100644 .configure delete mode 100644 .configure-files/firebase.secrets.json.enc diff --git a/.configure b/.configure deleted file mode 100644 index d0982ba4d..000000000 --- a/.configure +++ /dev/null @@ -1,11 +0,0 @@ -{ - "project_name": "aztec-android", - "branch": "trunk", - "pinned_hash": "f1a61c572902401898e7e1c060b86d9da7baf8fa", - "files_to_copy": [ - { - "file": "android/WPAndroid/firebase.secrets.json", - "destination": ".configure-files/firebase.secrets.json" - } - ] -} \ No newline at end of file diff --git a/.configure-files/firebase.secrets.json.enc b/.configure-files/firebase.secrets.json.enc deleted file mode 100644 index 77ba472e3222d1dab3c528528ec10e7f09f33e2f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2412 zcmV-y36u5~q7-u@uFhQ)`+|@61`?_43`rH+dY+t7VZ0DPb&ug! z*AiyAiv${iHzfr9K_M}^248#)xd@{I-G{!=vraA`E1LJh29VsLe}IjY(kN3nD-A_b zxXOFS0pT*4t-pMbR&1l8ahZY2h{>nv3Vx_MCJLMWR7;Xoo~`1CAndS$c$H??vH^a` zL=PJdU#uQ?pf(1B{Vy5`-`P#%qkhRVoNHY4rH{U;EMo-N=f10bV%}#=J@jC(7_0?^ zS#!_RI(UeEuM=GslBg+xyV`IW(G4U+ZG>K_| zb_M-ZUc+iEgm0Gge>>F@O1gGsm7cSmP&oMM75yr?$NymQj^FT3)c+s&&3_QUDCg)k zlf7wnBA@}d*(d&-YSmv}!gYjqiD>6Wa1yKPgI3hT;>%YM5ru|N!%?z^lPZaYr+SE=q@%c435)Q9~w)U zR_FoMa%gx~@x)luduY_YRwn6Z-*P~(HNOr*Dn3}iW=V{3h&Ry++S&Q07JG$aR>+&z z9b&(UixE$yOT9q#4D62q^*PrLPp?I1ZpsU|vw|kg%JbN6=i`)W7GoclwsG~n*Ai(f zgCN6fB7|+?-SwXrx4QD}^N~Q=C`F1j2HYOg;2h4!2tiM7>C4;}KV2+kH_Ntm`!WX4 zokrKoXjuAUAdF*kXj;q&$uoJtFH>!2Fz>h)`ysH(3Up}Hk90}#{i5Fr!fE~C+S??U zbd5k!V|A}v0$-KiOy!<-cNUg@vahF|JDAWbP>5^GaU!HnK?it{JTp_8mUr=yto<`6 zuzyCU&yfj?0K^0ASc=p}O^bq6NRpj4IE1_==bFYl{mhX}#slKTJc2i@+7c14CyQZc ze-q&GG(?A@k7_ztcNLc-p^5VN21Zd}6VGM+Z_UZY$qz}I5;9ooz)<1AX_S(}9s!AL z&nMxl0aevwsHW@UH&ye6Ysr9#qSEQo6Fr^I-q zHEl~qNLd`{O8p}(Ww%GGO%(-!{rUCit%;o0HS;?<6dP#R(fO6?{@F}r{Fh&jA1BIESet%-fL&+N9OzCyw~=?uf&zf0z1G1vO?v>xSiAVQ z`Aj^1$Ja(C>V6>e&{DleGO}PKXxU~oeLO?eYRbwH0Y82DWekU)zK^_kDPfVQ8G8{%Hg@D4{L6E#f&!iIP>s4QH_n_}aff!1rD6h>fdS%bl0kT!ocS^KaN)26;%N$VTse7Ii3a}RLg!jdY zgk7p%C_NQ8OF}WGi40zBtGsdz@F6D5uu{eq6oi$nyn~ue z=5^Py^a4wb9dem~puj~%Q1?5=yyWLv!t)^|ptyzbJE9gHiCQ+IkR)6@P7u`8@craS zGqx+#qjM}i)T6Wh64>A$=Jv=oqPsASf-k2R`sJaAIoR&Oig>abQ;xVkS~{_l3ZWWU zKEq@ap3JZM=}JUO>z;B_hAI~!^{gtQIl*vXZ0uCZMD4a3tu_|*- z^a!pYplib16>ZHYJZVD@hU@w^-M8YKgnczo%l+a`x=P%Ffvb_0(Lb3}gf;cXFbP-E zQ{5!GDWaGME2+>vsjii6ILzjH)rgULT=(j?m`k#kqf->{$9n>uWtTNty-t1Rvn8Af zUI~@O eT>N7);%Uj{-kSpAp$#@30CquogT>Frkw_+R-n%yd diff --git a/.gitignore b/.gitignore index 38e2f5750..f29bdb4b7 100644 --- a/.gitignore +++ b/.gitignore @@ -53,13 +53,3 @@ ktlint # Dependencies vendor - -# Currently, the configure tool stores the encrypted files under -# .configure-files. Everything in that folder without a .enc extension should -# be ignored. -.configure-files/* -!.configure-files/*.enc - -# Secrets files that should never be committed, regardless of location -firebase.secrets.json - diff --git a/build.gradle b/build.gradle index 878b2e1c2..b697472d6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,5 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -buildscript { - repositories { - maven { url "https://a8c-libs.s3.amazonaws.com/android" } - } - dependencies { - classpath 'com.automattic.android:configure:0.6.5' - } -} - plugins { id "com.android.application" apply false id "org.jetbrains.kotlin.android" apply false @@ -35,8 +26,6 @@ allprojects { } } -apply plugin: 'com.automattic.android.configure' - task clean(type: Delete) { delete rootProject.buildDir } From 769407dd8d2ff32705fbde5d9d9e24b5262d4572 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 3 Nov 2026 11:22:26 +1100 Subject: [PATCH 3/7] Install the emulator into a job-local SDK `sdkmanager` failed with `Failed to read or create install properties file`, because the agent user cannot write to the SDK in the `android` image. --- Generated with the help of Claude Code (Opus 5.5), https://code.claude.com --- .buildkite/commands/connected-tests.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.buildkite/commands/connected-tests.sh b/.buildkite/commands/connected-tests.sh index 2cb3a1017..41de900a7 100644 --- a/.buildkite/commands/connected-tests.sh +++ b/.buildkite/commands/connected-tests.sh @@ -6,15 +6,24 @@ SYSTEM_IMAGE="system-images;android-34;google_apis;x86_64" AVD_NAME="aztec-connected-tests" EMULATOR_LOG="build/emulator.log" -export PATH="$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools:$PATH" +BUILD_SDK="$ANDROID_HOME" +# The agent user cannot write to the image's SDK, and Gradle still needs it. +EMULATOR_SDK="$(mktemp -d)" +ln -s "$BUILD_SDK/licenses" "$EMULATOR_SDK/licenses" +ln -s "$BUILD_SDK/platform-tools" "$EMULATOR_SDK/platform-tools" +ln -s "$BUILD_SDK/platforms" "$EMULATOR_SDK/platforms" +export ANDROID_HOME="$EMULATOR_SDK" +export ANDROID_SDK_ROOT="$EMULATOR_SDK" +export PATH="$EMULATOR_SDK/emulator:$EMULATOR_SDK/platform-tools:$PATH" stop_emulator() { adb emu kill || true avdmanager delete avd --name "$AVD_NAME" || true + rm -rf "$EMULATOR_SDK" } echo "--- :package: Installing emulator and system image" -sdkmanager "emulator" "platform-tools" "$SYSTEM_IMAGE" > /dev/null +sdkmanager --sdk_root="$EMULATOR_SDK" "emulator" "$SYSTEM_IMAGE" > /dev/null echo "--- :mag: Checking hardware acceleration" ls -la /dev/kvm @@ -37,4 +46,4 @@ adb shell settings put secure long_press_timeout 1800 adb shell input keyevent 82 echo "--- :android: Running connected tests" -./gradlew --stacktrace :app:connectedDebugAndroidTest +ANDROID_HOME="$BUILD_SDK" ANDROID_SDK_ROOT="$BUILD_SDK" ./gradlew --stacktrace :app:connectedDebugAndroidTest From 9f3acf766d01b9a59a2ab9547b548dc47f240935 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 3 Nov 2026 11:23:44 +1100 Subject: [PATCH 4/7] Stop requesting storage permission on modern APIs The app declares `WRITE_EXTERNAL_STORAGE` up to API 29 and `READ_EXTERNAL_STORAGE` up to API 32. On API 34 `GrantPermissionRule` therefore fails with `READ_EXTERNAL_STORAGE cannot be granted!`, which failed nearly the whole connected suite before any test body ran. --- Generated with the help of Claude Code (Opus 5.5), https://code.claude.com --- .../kotlin/org/wordpress/aztec/demo/BaseTest.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/androidTest/kotlin/org/wordpress/aztec/demo/BaseTest.kt b/app/src/androidTest/kotlin/org/wordpress/aztec/demo/BaseTest.kt index df840aac5..0ee9d62f3 100644 --- a/app/src/androidTest/kotlin/org/wordpress/aztec/demo/BaseTest.kt +++ b/app/src/androidTest/kotlin/org/wordpress/aztec/demo/BaseTest.kt @@ -2,6 +2,7 @@ package org.wordpress.aztec.demo +import android.os.Build import android.util.Log import androidx.test.rule.GrantPermissionRule import androidx.test.runner.AndroidJUnit4 @@ -12,8 +13,11 @@ import org.junit.runner.RunWith abstract class BaseTest { @Rule @JvmField - val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant(android.Manifest.permission.CAMERA, - android.Manifest.permission.WRITE_EXTERNAL_STORAGE) + val grantPermissionRule: GrantPermissionRule = if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) { + GrantPermissionRule.grant(android.Manifest.permission.CAMERA) + } else { + GrantPermissionRule.grant(android.Manifest.permission.CAMERA, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) + } companion object { fun label(label: String) { From 0448bd116ae6ceedb4e39caecad13c718e8295e1 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 3 Nov 2026 11:27:00 +1100 Subject: [PATCH 5/7] Run `avdmanager` from the job-local SDK The system `avdmanager` failed with `Package path is not valid`, because it could not see the system image in the job-local SDK. --- Generated with the help of Claude Code (Opus 5.5), https://code.claude.com --- .buildkite/commands/connected-tests.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.buildkite/commands/connected-tests.sh b/.buildkite/commands/connected-tests.sh index 41de900a7..a6b663c19 100644 --- a/.buildkite/commands/connected-tests.sh +++ b/.buildkite/commands/connected-tests.sh @@ -14,7 +14,7 @@ ln -s "$BUILD_SDK/platform-tools" "$EMULATOR_SDK/platform-tools" ln -s "$BUILD_SDK/platforms" "$EMULATOR_SDK/platforms" export ANDROID_HOME="$EMULATOR_SDK" export ANDROID_SDK_ROOT="$EMULATOR_SDK" -export PATH="$EMULATOR_SDK/emulator:$EMULATOR_SDK/platform-tools:$PATH" +export PATH="$EMULATOR_SDK/cmdline-tools/latest/bin:$EMULATOR_SDK/emulator:$EMULATOR_SDK/platform-tools:$PATH" stop_emulator() { adb emu kill || true @@ -23,7 +23,8 @@ stop_emulator() { } echo "--- :package: Installing emulator and system image" -sdkmanager --sdk_root="$EMULATOR_SDK" "emulator" "$SYSTEM_IMAGE" > /dev/null +# `avdmanager` resolves the SDK from its own location, ignoring `ANDROID_HOME`, so it has to live in this SDK too. +sdkmanager --sdk_root="$EMULATOR_SDK" "cmdline-tools;latest" "emulator" "$SYSTEM_IMAGE" > /dev/null echo "--- :mag: Checking hardware acceleration" ls -la /dev/kvm From c2ef86a086d5dd4bfb910a5dd622327303135056 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 3 Nov 2026 11:34:44 +1100 Subject: [PATCH 6/7] Install the emulator's missing X11 library The emulator segfaulted after `Could not open libX11-xcb.so.1, give up`. Installing it in the job tells us whether it is the last blocker before changing the `android` image. --- Generated with the help of Claude Code (Opus 5.5), https://code.claude.com --- .buildkite/commands/connected-tests.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.buildkite/commands/connected-tests.sh b/.buildkite/commands/connected-tests.sh index a6b663c19..0c44fe54a 100644 --- a/.buildkite/commands/connected-tests.sh +++ b/.buildkite/commands/connected-tests.sh @@ -26,6 +26,9 @@ echo "--- :package: Installing emulator and system image" # `avdmanager` resolves the SDK from its own location, ignoring `ANDROID_HOME`, so it has to live in this SDK too. sdkmanager --sdk_root="$EMULATOR_SDK" "cmdline-tools;latest" "emulator" "$SYSTEM_IMAGE" > /dev/null +# The image lacks this library, and the emulator segfaults without it, even with `-no-window`. +sudo -n dnf install -y libX11-xcb > /dev/null + echo "--- :mag: Checking hardware acceleration" ls -la /dev/kvm emulator -accel-check @@ -35,7 +38,7 @@ avdmanager create avd --force --name "$AVD_NAME" --package "$SYSTEM_IMAGE" --dev trap stop_emulator EXIT mkdir -p "$(dirname "$EMULATOR_LOG")" -emulator -avd "$AVD_NAME" -no-window -no-audio -no-boot-anim -no-snapshot -gpu swiftshader_indirect > "$EMULATOR_LOG" 2>&1 & +emulator -avd "$AVD_NAME" -no-window -no-audio -no-boot-anim -no-snapshot -no-metrics -gpu swiftshader_indirect > "$EMULATOR_LOG" 2>&1 & timeout 300 adb wait-for-device timeout 300 bash -c 'until [[ "$(adb shell getprop sys.boot_completed 2> /dev/null | tr -d "\r")" == "1" ]]; do sleep 5; done' From 082d16cc344192ab3a7499becaca11b50f3ea8ec Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 3 Nov 2026 11:39:10 +1100 Subject: [PATCH 7/7] Unpack the X11 library without root `sudo` requires a password on `android` agents, so the job cannot install system packages. The library only needs to be loadable by the emulator process. --- Generated with the help of Claude Code (Opus 5.5), https://code.claude.com --- .buildkite/commands/connected-tests.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.buildkite/commands/connected-tests.sh b/.buildkite/commands/connected-tests.sh index 0c44fe54a..14eb1501e 100644 --- a/.buildkite/commands/connected-tests.sh +++ b/.buildkite/commands/connected-tests.sh @@ -27,7 +27,10 @@ echo "--- :package: Installing emulator and system image" sdkmanager --sdk_root="$EMULATOR_SDK" "cmdline-tools;latest" "emulator" "$SYSTEM_IMAGE" > /dev/null # The image lacks this library, and the emulator segfaults without it, even with `-no-window`. -sudo -n dnf install -y libX11-xcb > /dev/null +EMULATOR_LIBS="$EMULATOR_SDK/extra-libs" +mkdir -p "$EMULATOR_LIBS" +dnf download --destdir "$EMULATOR_LIBS" libX11-xcb > /dev/null +rpm2cpio "$EMULATOR_LIBS"/*.rpm | (cd "$EMULATOR_LIBS" && cpio -idm --quiet) echo "--- :mag: Checking hardware acceleration" ls -la /dev/kvm @@ -38,7 +41,7 @@ avdmanager create avd --force --name "$AVD_NAME" --package "$SYSTEM_IMAGE" --dev trap stop_emulator EXIT mkdir -p "$(dirname "$EMULATOR_LOG")" -emulator -avd "$AVD_NAME" -no-window -no-audio -no-boot-anim -no-snapshot -no-metrics -gpu swiftshader_indirect > "$EMULATOR_LOG" 2>&1 & +LD_LIBRARY_PATH="$EMULATOR_LIBS/usr/lib64" emulator -avd "$AVD_NAME" -no-window -no-audio -no-boot-anim -no-snapshot -no-metrics -gpu swiftshader_indirect > "$EMULATOR_LOG" 2>&1 & timeout 300 adb wait-for-device timeout 300 bash -c 'until [[ "$(adb shell getprop sys.boot_completed 2> /dev/null | tr -d "\r")" == "1" ]]; do sleep 5; done'