Repository navigation
ci(app): upload the debug APK and run Android JVM tests in parallel - #14330
Merged
Merged
Conversation
The APK build stays android-arm64 on every event, matching main since c8f3506. Extra ABIs still OOM ubuntu-latest. Co-authored-by: Cursor <[email protected]>
CI wiring lives in MOBILE_VERIFY.md so app/AGENTS.md stays inside its lean budget. Co-authored-by: Cursor <[email protected]>
Comment on lines
+413
to
+492
| name: Android JVM Unit Tests | ||
| runs-on: ubuntu-latest | ||
| needs: changes | ||
| if: needs.changes.outputs.has_app_compile_smoke == 'true' | ||
| timeout-minutes: 25 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Setup Flutter | ||
| uses: subosito/flutter-action@v2 | ||
| with: | ||
| channel: stable | ||
| flutter-version: 3.44.5 | ||
| cache: true | ||
|
|
||
| - name: Cache build_runner state | ||
| uses: actions/cache@v6 | ||
| with: | ||
| path: app/.dart_tool/build | ||
| key: ${{ runner.os }}-flutter-buildrunner-${{ hashFiles('app/pubspec.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-flutter-buildrunner-${{ hashFiles('app/pubspec.lock') }}- | ||
| ${{ runner.os }}-flutter-buildrunner- | ||
|
|
||
| - name: Resolve Flutter dependencies | ||
| working-directory: app | ||
| run: flutter pub get | ||
|
|
||
| - name: Prepare Flutter dev compile inputs | ||
| working-directory: app | ||
| run: | | ||
| flutter build apk --debug --flavor dev --target-platform android-arm64 | ||
| cd android | ||
| # Tests run on the JVM; their Flutter compilation dependency must keep | ||
| # the APK's target selection to reuse its outputs instead of rebuilding all ABIs. | ||
| ./gradlew :app:testDevDebugUnitTest -Ptarget-platform=android-arm64 | ||
| mkdir -p android/app/src/dev/ android/app/src/prod/ | ||
| cp lib/firebase_options_local.dart lib/firebase_options_dev.dart | ||
| cp lib/firebase_options_local.dart lib/firebase_options_prod.dart | ||
| cp setup/prebuilt/google-services-local.json android/app/src/dev/google-services.json | ||
| cp setup/prebuilt/google-services-local.json android/app/src/prod/google-services.json | ||
| cp setup/prebuilt/key.properties android/key.properties | ||
| { | ||
| echo "API_BASE_URL=" | ||
| echo "USE_WEB_AUTH=true" | ||
| echo "USE_AUTH_CUSTOM_TOKEN=true" | ||
| echo "STAGING_API_URL=" | ||
| } > .dev.env | ||
| : > .env | ||
|
|
||
| - name: Generate Flutter code for JVM unit tests | ||
| working-directory: app | ||
| run: dart run build_runner build --delete-conflicting-outputs | ||
|
|
||
| - name: Enable Gradle configuration cache | ||
| working-directory: app/android | ||
| run: | | ||
| { | ||
| echo "org.gradle.configuration-cache=true" | ||
| echo "org.gradle.configuration-cache.problems=warn" | ||
| } >> gradle.properties | ||
|
|
||
| - name: Setup Gradle for Android JVM unit tests | ||
| uses: gradle/actions/setup-gradle@v6 | ||
| with: | ||
| cache-read-only: ${{ github.ref != 'refs/heads/main' }} | ||
| cache-cleanup: on-success | ||
| gradle-home-cache-includes: | | ||
| caches | ||
| notifications | ||
| wrapper | ||
|
|
||
| - name: Run Android JVM unit tests | ||
| working-directory: app/android | ||
| env: | ||
| CM_KEYSTORE_PATH: ${{ github.workspace }}/app/setup/prebuilt/debug.keystore | ||
| CM_KEYSTORE_PASSWORD: android | ||
| CM_KEY_ALIAS: androiddebugkey | ||
| CM_KEY_PASSWORD: android | ||
| # Same target-platform as the APK job so a shared Gradle cache hit | ||
| # does not rebuild every ABI. This job does not wait for the APK. | ||
| run: ./gradlew :app:testDevDebugUnitTest -Ptarget-platform=android-arm64 |
Warn mode does not downgrade a cache-state serialization failure of builtInKotlinServices. Generate the gitignored wrapper with --config-only so the parallel JVM job can run without an APK compile. Failure-Class: none Co-authored-by: Cursor <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Mobile App Checks threw away the debug APK after a ~14-minute Android Compile Smoke job that also ran
:app:testDevDebugUnitTestserially (baseline run 35174763226, 14.3 min). This PR uploads that APK as a short-lived, head-SHA-named artifact, moves the JVM tests onto a parallel job, and caches the Gradle User Home (build cache + wrapper dist) viasetup-gradle@v6.The APK build stays
--target-platform android-arm64on every event, matchingorigin/mainsincec8f35061fc. This PR does not change which ABIs are compiled.Timezone second-pass (
TZ=Pacific/Kiritimati bash app/test.shand Pago_Pago) is not in this PR. It lives on stackedtask/msd-ci-tz-second-passuntil harness Z1 (PR #14313) merges.First CI run broke the build (35207698338)
The first version of this PR failed on GitHub Actions. Local checks could not see it:
actionlintand the workflow-shape contracts do not execute Gradle, and the Harness lane doctor has no Android SDK, so the sameflutter build apk/./gradlewinvocation was never run here (and was not installed).Android Compile Smoke (
Build Flutter Android dev debug APK) failed with:Configuration cache state could not be cached: field builtInKotlinServices$delegate of com.android.build.gradle.internal.services.ProjectServices ... error writing value of type 'kotlin.SynchronizedLazyImpl'That came from appending
org.gradle.configuration-cache=trueandproblems=warntogradle.propertieson the runner. This project is AGP 8.11.1, Kotlin 2.2.20, Gradle 8.14.2. Warn mode does not downgrade a serialization failure of the cache state itself. Configuration cache is removed. The real savings are the Gradle User Home cache (setup-gradle,cache-read-onlyoffmain) and running the JVM tests in parallel.Android JVM Unit Tests (
Run Android JVM unit tests) never reached that Gradle error:./gradlew: No such file or directory(exit 127).gradlew,gradle-wrapper.jar, andlocal.propertiesare gitignored; onmainthey were created byflutter build apkin the same job before:app:testDevDebugUnitTest. The parallel job never builds an APK, so it now runsflutter build apk --debug --flavor dev --target-platform android-arm64 --config-onlyfirst (generate files, do not compile).Dart Analyze & Tests failed on
app/test/unit/capture_recovery_replay_scenarios_test.dartprocess kill mid-capture(Expected length 1, Actual []). That is a pre-existing load-sensitive flake; the Harness lane root-caused and fixed it in open PR #14331. This PR does not touch that test.Known gap, unchanged by this PR
arm64-only since c8f3506: extra ABIs OOM'd ubuntu-latest during stripDebugSymbols. Does not compile the JNI opus shim for armeabi-v7a or x86_64.
The hosted Linux Android emulator is x86_64. When that lane is designed, this job will not have caught a non-arm64 native compile break.
Product invariants affected
none
How it was verified
actionlint -shellcheck "" .github/workflows/mobile-app-checks.yml— exit 0uv run --python 3.11.15 --with pytest pytest --noconftest backend/tests/unit/test_workflow_contracts.py— 28 passedOMI_PR_BODY_FILE=.local/pr-body-v5.md make preflight—PR preflight passed: 33 checks in 273.44sCould not verify: the hosted-runner Gradle/AGP path (no Android SDK on this host). The next push's own CI run is the verification.
app/AGENTS.mdwas left atorigin/mainbecause it is already at the 11,500-byte lean budget (170 lines / 11,495 bytes).Fork PRs / secrets / cache poison
Measured from the job YAML (enforced by
test_mobile_android_compile_smoke_uploads_debug_apk_and_runs_jvm_tests_in_parallel):android-compile-smokeandandroid-unit-testscontain no${{ secrets.references.actions/upload-artifact@v7ofapp/build/app/outputs/flutter-apk/app-dev-debug.apk; no signing, no publish, no credentials.app/setup/prebuilt/debug.keystorewith passwordandroid(not a GitHub secret).CI=truemakes Gradle readCM_KEYSTORE_*; those env vars point at that file.gradle/actions/setup-gradle@v6usescache-read-only: ${{ github.ref != 'refs/heads/main' }}on both jobs, so pull requests (including forks) read the Gradle User Home cache thatmainwrites and cannot write/poison it. No configuration-cache encryption key.Expected new critical path
Detect Changes+ max(Generated Files,Dart Analyze & Tests,Android Compile SmokeAPK-only,Android JVM Unit Testswith--config-onlythen Gradle,Seeded Journeys (hermetic))The remaining long pole should be APK-only compile smoke, helped on PRs by reading the Gradle User Home cache that main writes. I do not claim a sub-10-minute median. Configuration cache is not part of that path.
Measurement the coordinator should take on this PR's own CI run
On the
Mobile App Checksrun for the exact head SHA:run_started_at→ last jobcompleted_at.Detect Changes,Android Compile Smoke,Android JVM Unit Tests,Dart Analyze & Tests,Seeded Journeys (hermetic),Generated Files.needsthe other).app-dev-debug-<pull_request.head.sha>exists, 5-day retention, no signing/publish/secrets.--target-platform android-arm64.org.gradle.configuration-cache.mainhas seeded the Gradle cache — not this first PR run.Tests
Workflow-shape contracts in
backend/tests/unit/test_workflow_contracts.py:action_count == pin_count, floor 5)android-compile-smokestill namedAndroid Compile Smoke, buildsflutter build apk --debug --flavor dev --target-platform android-arm64, uploadsapp-dev-debug-<head-sha>, no longer runs:app:testDevDebugUnitTestandroid-unit-testsruns--config-onlythen:app:testDevDebugUnitTestin parallel (needs: changesonly, samehas_app_compile_smokegate)${{ secrets., in-repo debug keystore,cache-read-onlyoffmain, noorg.gradle.configuration-cachejourneys-hermeticis untouched.Failure class (fixes)
Failure-Class: none