Skip to content

ci: run instrumented ApiDemos tests on an emulator - #2437

Merged
dkhawk merged 1 commit into
mainfrom
ci/instrumentation-tests
Sep 22, 2026
Merged

dkhawk merged 1 commit into
mainfrom
ci/instrumentation-tests

Conversation

@kikoso

@kikoso kikoso commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Problem

The androidTest sources under ApiDemos have never been executed by any workflow.

build.yml already covers assembleDebug, testDebugUnitTest and lintDebug, so JVM unit tests are fine. What has no coverage is the instrumented suite: 18 test files across java-app and kotlin-app, including CameraDemoActivityTest, CircleDemoActivityTest, GroundOverlayDemoActivityTest, IndoorDemoActivityTest, VisibleRegionDemoActivityTest and CameraClampingDemoActivityTest, plus the MapIdlingResource and Truth subjects they rely on.

This matters right now because #2426 and #2427 add 14 more androidTest files between them. Without this, that new work starts rotting the day it merges.

What this adds

.github/workflows/instrumentation-test.yml, modelled on the equivalent workflow in android-maps-compose:

  • Runs connectedDebugAndroidTest on an API 29 google_apis emulator.
  • Matrix over :ApiDemos:java-app and :ApiDemos:kotlin-app with fail-fast: false, so one failing module does not mask the other.
  • Enables KVM. Without hardware acceleration the map does not settle inside the existing MapIdlingResource timeouts.
  • Uploads test reports on failure.
  • All actions pinned by SHA, matching the convention in the other workflows here.

The prerequisite, and why this is currently a no-op

These tests render a real map, so they need a Maps API key.

The googlemaps-samples org currently exposes only SYNCED_GITHUB_TOKEN_REPO, and this repo's own secrets are SONATYPE_TOKEN, SONATYPE_TOKEN_PASSWORD and SYNCED_GPG_KEY_ARMOR. There is no Maps API key available to CI at all, unlike the googlemaps org which has ACTIONS_API_KEY and SYNCED_GOOGLE_MAPS_API_KEY_ANDROID.

So rather than adding a check that fails on every PR, the emulator job gates on ACTIONS_API_KEY and skips cleanly when the secret is absent. Secrets cannot be referenced from a job-level if, hence the small check-api-key job that resolves it into an output.

Provisioning ACTIONS_API_KEY for this repository is the actual unblocking step. Once it exists, this workflow starts enforcing with no further change. Until then it is deliberately inert, and merging it is safe.

Worth deciding separately whether the key should be an org-level secret in googlemaps-samples, which would also serve any other sample app that wants instrumented coverage later.

The androidTest sources under ApiDemos have never been executed by any
workflow. build.yml covers assembleDebug, testDebugUnitTest and lintDebug,
so 18 instrumented test files across java-app and kotlin-app (camera,
circle, ground overlay, indoor, visible region and camera clamping demos)
have been sitting unrun.

These tests drive a real map, so they need a Maps API key. This repository
has no such secret today, so the emulator job gates on ACTIONS_API_KEY and
skips when it is absent. The workflow stays a no-op until the secret is
provisioned, then starts enforcing on its own.
@dkhawk
dkhawk merged commit 6361812 into main Sep 22, 2026
18 checks passed
@dkhawk
dkhawk deleted the ci/instrumentation-tests branch September 22, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants