Skip to content

ci: run Android instrumented tests on the mac-metal queue#471

Merged
jkmassel merged 6 commits intotrunkfrom
jkmassel/mac-metal-instrumented
Apr 24, 2026
Merged

ci: run Android instrumented tests on the mac-metal queue#471
jkmassel merged 6 commits intotrunkfrom
jkmassel/mac-metal-instrumented

Conversation

@jkmassel
Copy link
Copy Markdown
Contributor

@jkmassel jkmassel commented Apr 23, 2026

What?

Adds a new Buildkite step that runs :app:connectedDebugAndroidTest on the mac-metal queue, booting an ephemeral AVD via the start-android-emulator helper.

Why?

The Android instrumented tests in android/app/src/androidTest/ haven't had a CI job — they've only run locally. The new mac-metal agents can boot real Android emulators (something the virtualized mac queue can't do), so we can finally wire these tests into the pipeline.

How?

  • Downloads the dist.tar.gz artifact produced by Build React App so the editor assets are available.
  • Calls start-android-emulator with system-images;android-34;google_apis;arm64-v8a (pre-installed on the agent, matches our targetSdk = 34) and a pixel_5 device profile.
  • Runs make test-android-e2e. ENSURE_ANDROID_DEVICE detects the already-booted emulator via adb and skips its fallback boot path, so the existing Makefile target works unchanged.
  • AVD cleanup is handled by the agent's pre-exit hook — no extra teardown needed here.

Test plan

  • CI runs the new :android: Test Android E2E step on this PR against the mac-metal queue and the step succeeds.
  • EditorInteractionTest tests (testEditorWebViewBecomesVisible, testUndoRedoAfterTyping) pass on CI.
  • Other pipeline steps (iOS E2E, Test Android Library, etc.) are unaffected.

Runs :app:connectedDebugAndroidTest against an ephemeral AVD booted
via the start-android-emulator helper on the mac-metal agent. See:
https://appsinfrap2.wordpress.com/2025/10/10/using-the-mac-metal-queue-for-android-instrumented-tests/
@github-actions github-actions Bot added the [Type] Build Tooling Issues or PRs related to build tooling label Apr 23, 2026
These were lost during a merge conflict resolution in #339 and the gap
was invisible until the mac-metal CI step started exercising the
androidTest sources. Re-adds espresso-web, compose-ui-test-junit4, and
compose-ui-test-manifest to the version catalog and wires them into
the app module so EditorInteractionTest compiles.
Registers the stock InstrumentedTestCollector as a test listener when
BUILDKITE_ANALYTICS_TOKEN_ANDROID is present in the environment. The
listener is only attached when the token is set, so local runs and
unauthenticated CI stay fully inert.

The Android Test Engine suite + agent secret need to be set up
separately for data to start flowing.
…_ANDROID_E2E

Matches the env var name already provisioned on Automattic agents rather
than inventing a new one.
@jkmassel jkmassel requested a review from iangmaia April 24, 2026 14:50
Comment thread .buildkite/pipeline.yml
make test-ios-e2e
plugins: *plugins

- label: ':android: Test Android E2E'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker as this is just the initial setup to get it going, but maybe for the long run it might be worth it to add artifact_paths to debug test results (stuff from logcat, test reports, etc).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure – added in d9329d2, thanks!

Copy link
Copy Markdown

@iangmaia iangmaia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 :shipit:

Image

System.getenv("BUILDKITE_ANALYTICS_TOKEN_ANDROID_E2E")?.takeIf { it.isNotBlank() }?.let { token ->
testInstrumentationRunnerArguments["listener"] =
"com.buildkite.test.collector.android.InstrumentedTestCollector"
testInstrumentationRunnerArguments["BUILDKITE_ANALYTICS_TOKEN"] = token
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, it's probably also interesting to set these for Buildkite's test collector https://github.com/buildkite/test-collector-android/blob/main/CI_CONFIGURATION.md#buildkite

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice – addressed by 9b4809f

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Pass BUILDKITE_BUILD_ID/URL/BRANCH/COMMIT/BUILD_NUMBER/JOB_ID/MESSAGE
through to the collector so uploaded test results link back to the
Buildkite job. Per buildkite/test-collector-android CI_CONFIGURATION.md.
Pick up Gradle's JUnit XML, HTML reports, and any additional emulator
outputs (logcat captures, screenshots) from connectedDebugAndroidTest.
Artifacts upload on both success and failure, so the reports are
available directly from the Buildkite UI when a test run goes wrong.
@jkmassel jkmassel merged commit 5819d62 into trunk Apr 24, 2026
18 checks passed
@jkmassel jkmassel deleted the jkmassel/mac-metal-instrumented branch April 24, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants