Skip to content

setup-key auth instrumentation test#178

Draft
pappz wants to merge 5 commits into
mainfrom
ci/instrumentation-setup
Draft

setup-key auth instrumentation test#178
pappz wants to merge 5 commits into
mainfrom
ci/instrumentation-setup

Conversation

@pappz
Copy link
Copy Markdown
Collaborator

@pappz pappz commented May 6, 2026

Summary

  • Adds SetupKeyAuthTest — a UiAutomator-driven instrumentation test that drives the in-app "Change server" screen end-to-end with a setup key, then waits for the success dialog.
  • Adds instrumentation-tests.yml (workflow_dispatch only) that builds the debug AAR via the existing build-android composite action, then runs the test on an x86_64 emulator with reactivecircus/android-emulator-runner.

Required repository config

  • Secret: INSTRUMENTATION_NB_SETUP_KEY (UUID setup key, ideally reusable + ephemeral)
  • Variable (optional): INSTRUMENTATION_NB_MANAGEMENT_URL (defaults to https://api.netbird.io)

Test plan

  • Trigger via Actions UI on this branch: Actions → "instrumentation tests" → Run workflow → branch ci/instrumentation-setup.
  • Confirm emulator boots, login flow runs, success dialog detected.
  • Inspect uploaded setup-key-auth-test-results artifact for the JUnit/HTML reports.

Draft because we want to validate the workflow on this branch before merging into main.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 61c313eb-d92d-42bc-905e-382474675ae7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/instrumentation-setup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pappz pappz force-pushed the ci/instrumentation-setup branch 3 times, most recently from b0e92ca to c27d5c4 Compare May 6, 2026 08:43
@pappz pappz had a problem deploying to instrumentation-test-secrets May 6, 2026 08:49 — with GitHub Actions Failure
@pappz pappz force-pushed the ci/instrumentation-setup branch from c27d5c4 to 693794e Compare May 6, 2026 09:26
@pappz pappz changed the title ci: setup-key auth instrumentation test setup-key auth instrumentation test May 6, 2026
@pappz pappz had a problem deploying to instrumentation-test-secrets May 6, 2026 09:31 — with GitHub Actions Failure
@pappz pappz force-pushed the ci/instrumentation-setup branch from 693794e to 51de4b7 Compare May 6, 2026 09:38
@pappz pappz had a problem deploying to instrumentation-test-secrets May 6, 2026 09:44 — with GitHub Actions Failure
Adds SetupKeyAuthTest, a UiAutomator-driven instrumentation test that
drives the in-app "Change server" screen end-to-end with a setup key
and waits for the success dialog. The test taps "Use NetBird", so the
management URL is the one hard-coded in the app (Preferences.defaultServer()).
The setup key comes from an instrumentation runner argument so CI can
inject it as a secret without baking it into the APK.

Wires it into the existing build-debug workflow as a workflow_dispatch-only
job that reuses the netbird-aar artifact, so PR builds are unaffected
and the AAR is built only once per run.

Required repo config:
- Secret: INSTRUMENTATION_NB_SETUP_KEY (UUID, ideally reusable + ephemeral)
@pappz pappz force-pushed the ci/instrumentation-setup branch from 51de4b7 to ff01cea Compare May 6, 2026 10:06
@pappz pappz had a problem deploying to instrumentation-test-secrets May 6, 2026 10:12 — with GitHub Actions Failure
@pappz pappz had a problem deploying to instrumentation-test-secrets May 10, 2026 19:32 — with GitHub Actions Failure
@pappz pappz deployed to instrumentation-test-secrets May 10, 2026 19:40 — with GitHub Actions Active
Run adb screenrecord in a background loop (180s segments) for the full
duration of connectedDebugAndroidTest, then upload the segments as an
artifact. Helps diagnose UiAutomator failures that only repro in CI.
@pappz pappz had a problem deploying to instrumentation-test-secrets May 10, 2026 19:52 — with GitHub Actions Failure
- setup-go: point cache-dependency-path to netbird/go.sum so the Go
  module cache actually restores (build-android-lib.sh shaves ~1-2 min).
- Cache the NDK install dir and the gomobile binary by pinned version,
  skipping the corresponding install step on cache hit.
- Cache the AVD plus the API 30 google_apis x86_64 system image, add a
  warm-up step that boots once to capture a snapshot, and run tests with
  force-avd-creation=false plus -no-snapshot-save so subsequent jobs
  load the cached snapshot without overwriting it.
- Move the screenrecord/gradle/pull pipeline to
  .github/scripts/run-instrumented-tests.sh because the emulator-runner
  action executes each line of the inline script as a separate sh -c,
  which broke the multi-line subshell loop.
@pappz pappz had a problem deploying to instrumentation-test-secrets May 10, 2026 20:03 — with GitHub Actions Failure
The ${{ env.ANDROID_HOME }} expression resolves against workflow-level
env, not the runner's process environment, so the NDK and AVD system-
image cache paths came out empty-prefixed and the saves were dropped
with "Path Validation Error". Hardcode the ubuntu-latest sdk path
(/usr/local/lib/android/sdk) for both.

Also fix the screen recording: touch the sentinel file BEFORE launching
the background loop, otherwise the loop sees no file on its first
iteration and exits immediately, producing zero recordings.
@pappz pappz had a problem deploying to instrumentation-test-secrets May 10, 2026 20:15 — with GitHub Actions Failure
Save threadtime-format logcat to screen-recordings/logcat.log in the
background, in parallel with the screenrecord loop, and stop it after
the test exits. The existing screen-recordings/ artifact upload picks
it up automatically.
@pappz pappz had a problem deploying to instrumentation-test-secrets May 10, 2026 20:25 — with GitHub Actions Failure
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.

1 participant