-
Notifications
You must be signed in to change notification settings - Fork 184
ci: enable android e2e and config cache #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: enable android e2e and config cache #1071
Conversation
WalkthroughRe-enables the Android E2E CI job; increases its timeout; tightens Gradle cache-key; changes Gradle build invocation and Gradle properties around configuration-cache; adjusts autolinking and adds Android module includes; modifies emulator options and adds post-build Android/Gradle cache cleanup. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as GitHub Actions Trigger
participant GHA as mobile-e2e workflow
participant Cache as Gradle Cache Store
participant Gradle as ./gradlew
participant AVD as Android Emulator
participant E2E as E2E Test Runner
Dev->>GHA: push / workflow dispatch
GHA->>Cache: restore gradle cache (key includes GH_CACHE_VERSION + hash of app/android/gradle.properties)
GHA->>Gradle: ./gradlew assembleDebug --quiet --parallel --build-cache
Note over Gradle: configuration-cache behavior controlled by app/android/gradle.properties
GHA->>AVD: start emulator (no-snapshot-save, no-window, gpu swiftshader_indirect, noaudio, no-boot-anim, camera none)
GHA->>E2E: run tests against emulator
alt success
E2E-->>GHA: pass
else failure
E2E-->>GHA: fail + logs
end
GHA->>GHA: cleanup ~/.android/avd/* and ~/.gradle/caches/* (post-build)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
app/android/gradle.properties (1)
51-51: Config Cache: add problems=warn and verify RN/AGP/plugin compatibilityEnabling configuration cache is great, but a non‑compatible task will silently disable it or fail builds. Add the problems flag and verify compatibility of react-native-gradle-plugin, AGP, and any custom Gradle tasks.
org.gradle.caching=true org.gradle.configureondemand=true org.gradle.configuration-cache=true +org.gradle.configuration-cache.problems=warnPlease confirm CI logs show “Reusing configuration cache” on subsequent runs.
.github/workflows/mobile-e2e.yml (2)
89-91: Strengthen Gradle cache key and include configuration-cache directoryGood use of the shared cache-gradle action and cache-version. Also include gradle-wrapper and (if present) version catalogs in the cache-version seed, and ensure the composite action caches ~/.gradle/configuration-cache; otherwise enabling config cache won’t speed up CI.
- cache-version: ${{ env.GH_CACHE_VERSION }}-${{ hashFiles('app/android/gradle.properties') }} + cache-version: ${{ env.GH_CACHE_VERSION }}-${{ hashFiles('app/android/gradle.properties', 'app/android/gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml', 'app/android/**/build.gradle*') }}Please confirm ./.github/actions/cache-gradle includes ~/.gradle/configuration-cache in its cached paths.
106-106: Config cache only helps if persisted; pair with cache and avoid unnecessary invalidationsDropping --no-configuration-cache is good. With ephemeral runners, the benefit requires caching ~/.gradle/configuration-cache (see comment above). Also prefer scoping the task to :app:assembleDebug to avoid extra modules if any.
-(cd app/android && ./gradlew assembleDebug --quiet --parallel --build-cache) || { echo "❌ Android build failed"; exit 1; } +(cd app/android && ./gradlew :app:assembleDebug --quiet --parallel --build-cache) || { echo "❌ Android build failed"; exit 1; }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/mobile-e2e.yml(3 hunks)app/android/gradle.properties(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/android/**/*
⚙️ CodeRabbit configuration file
app/android/**/*: Review Android-specific code for:
- Platform-specific implementations
- Performance considerations
- Security best practices for mobile
Files:
app/android/gradle.properties
.github/workflows/**/*.{yml,yaml}
📄 CodeRabbit inference engine (AGENTS.md)
.github/workflows/**/*.{yml,yaml}: In GitHub Actions workflows, use shared composite caching actions from .github/actions (cache-yarn, cache-bundler, cache-gradle, cache-pods)
Do not call actions/cache directly; rely on the shared composite caching actions
When using cache actions, optionally pass cache-version (often with GH_CACHE_VERSION and tool version) for stable keys
Files:
.github/workflows/mobile-e2e.yml
🧠 Learnings (3)
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Applies to .github/workflows/**/*.{yml,yaml} : When using cache actions, optionally pass cache-version (often with GH_CACHE_VERSION and tool version) for stable keys
Applied to files:
.github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Applies to .github/workflows/**/*.{yml,yaml} : In GitHub Actions workflows, use shared composite caching actions from .github/actions (cache-yarn, cache-bundler, cache-gradle, cache-pods)
Applied to files:
.github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments
Applied to files:
.github/workflows/mobile-e2e.yml
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: build-deps
- GitHub Check: e2e-ios
- GitHub Check: e2e-android
- GitHub Check: analyze-ios
- GitHub Check: analyze-android
🔇 Additional comments (2)
.github/workflows/mobile-e2e.yml (2)
34-34: 60‑minute timeout is reasonable for cold‑boot emulator runsFits typical Android E2E duration with AVD creation and Maestro.
118-118: Partition size 4096MB: verify runner disk headroomLarger userdata improves install stability but can slow AVD creation and fail under low disk. Confirm ubuntu-latest has enough free space with system image + 4GB userdata.
| - name: Clean Android caches | ||
| run: | | ||
| rm -rf ~/.android/avd/* ~/.gradle/caches/* | ||
| - name: Install and Test on Android |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not delete ~/.gradle/caches before cache save — this neuters Gradle caching for subsequent runs
This step runs before the post‑step that saves the cache, so you end up saving an empty/cleared cache, losing most performance gains.
- - name: Clean Android caches
- run: |
- rm -rf ~/.android/avd/* ~/.gradle/caches/*
+ - name: Clean Android emulator leftovers (keep Gradle caches for CI speed)
+ run: |
+ rm -rf ~/.android/avd/*
+ # Intentionally keep ~/.gradle/caches to allow actions cache to persist it
+ # If disk pressure occurs, prefer pruning project build dirs:
+ rm -rf app/android/.gradle app/android/**/build || true📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Clean Android caches | |
| run: | | |
| rm -rf ~/.android/avd/* ~/.gradle/caches/* | |
| - name: Install and Test on Android | |
| - name: Clean Android emulator leftovers (keep Gradle caches for CI speed) | |
| run: | | |
| rm -rf ~/.android/avd/* | |
| # Intentionally keep ~/.gradle/caches to allow actions cache to persist it | |
| # If disk pressure occurs, prefer pruning project build dirs: | |
| rm -rf app/android/.gradle app/android/**/build || true | |
| - name: Install and Test on Android |
🤖 Prompt for AI Agents
In .github/workflows/mobile-e2e.yml around lines 108 to 111, the workflow
currently removes ~/.gradle/caches before the cache-save step which clears
Gradle artifacts and causes the saved cache to be empty; remove the rm -rf for
~/.gradle/caches (or restrict cleanup to only safe transient files/AVD
directories) so Gradle cache remains intact, or move any necessary Gradle cache
cleanup to a step that runs after the cache-save; ensure only non-cache
directories (e.g., ~/.android/avd/*) are deleted before testing so the cache
saved later contains Gradle artifacts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/android/settings.gradle (1)
10-13: Ensure ':passportreader' is a library module (not an application) and compatible with config cache.Including ./android-passport-reader/app suggests an application module (com.android.application). Pulling an app module into another app can break dependency resolution, AGP tasks, and config caching. If this is a library, it should live under a module that applies com.android.library; otherwise, publish/consume it or refactor to a library module.
Proposed options:
- Prefer a library module path (e.g., ./android-passport-reader/library) and include ':passportreader' from there.
- If it must remain an app for demos, exclude it from the main settings and reference it only in a separate sample project.
- Alternatively, convert the module to a composite build and depend on its published coordinates instead of project include.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/android/gradle.properties(1 hunks)app/android/settings.gradle(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- app/android/gradle.properties
🧰 Additional context used
📓 Path-based instructions (1)
app/android/**/*
⚙️ CodeRabbit configuration file
app/android/**/*: Review Android-specific code for:
- Platform-specific implementations
- Performance considerations
- Security best practices for mobile
Files:
app/android/settings.gradle
🧠 Learnings (1)
📚 Learning: 2025-07-29T01:08:28.530Z
Learnt from: transphorm
PR: selfxyz/self#795
File: app/android/app/build.gradle:157-158
Timestamp: 2025-07-29T01:08:28.530Z
Learning: For this React Native project, the team prefers build flexibility over fail-fast behavior for release builds in app/android/app/build.gradle. They intentionally allow fallback to debug signing for local development runs, relying on Google Play Console validation to catch any improperly signed releases during upload.
Applied to files:
app/android/settings.gradle
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: build-deps
- GitHub Check: e2e-android
- GitHub Check: e2e-ios
- GitHub Check: analyze-ios
- GitHub Check: analyze-android
🔇 Additional comments (1)
app/android/settings.gradle (1)
4-5: No change needed — RN 0.76.9 supports the no‑arg autolink call.Repo uses [email protected] and the corresponding Gradle plugin; the official integration template and the plugin release document the no‑arg ex.autolinkLibrariesFromCommand() usage, so keep the call as‑is. (reactnative.dev)
| @@ -1,7 +1,8 @@ | |||
| pluginManagement { includeBuild("../../node_modules/@react-native/gradle-plugin") } | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove duplicate includeBuild of @react-native/gradle-plugin.
Including the same composite build twice can cause settings-evaluation failures (“Build at … is already included”) and undermines configuration-cache stability. Keep the includeBuild only inside pluginManagement.
Apply this diff:
pluginManagement { includeBuild("../../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex ->
// Use direct autolinking instead of external yarn command to support configuration cache
ex.autolinkLibrariesFromCommand()
}
rootProject.name = 'OpenPassport'
include ':app'
-includeBuild('../../node_modules/@react-native/gradle-plugin')
include ':react-native-passport-reader'
project(':react-native-passport-reader').projectDir = new File(rootProject.projectDir, './react-native-passport-reader/android')
include ':passportreader'
project(':passportreader').projectDir = new File(rootProject.projectDir, './android-passport-reader/app')Also applies to: 9-9
🤖 Prompt for AI Agents
In app/android/settings.gradle around lines 1 and 9, there is a duplicate
includeBuild for "../../node_modules/@react-native/gradle-plugin"; keep the
includeBuild only inside the pluginManagement block (line 1) and remove the
duplicate includeBuild at line 9 to avoid "Build ... is already included" errors
and improve configuration-cache stability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.github/workflows/mobile-e2e.yml (1)
108-110: Do not delete ~/.gradle/caches before post-job cache save — wrecks Gradle cache effectivenessThis clears the Gradle cache right before the cache action’s save phase, persisting an empty cache and tanking CI performance.
- - name: Clean Android caches - run: | - rm -rf ~/.android/avd/* ~/.gradle/caches/* + - name: Clean Android emulator leftovers (keep Gradle caches for CI speed) + run: | + rm -rf ~/.android/avd/* + # Keep ~/.gradle/caches so the cache action can persist it + rm -rf app/android/.gradle app/android/**/build || true
🧹 Nitpick comments (2)
.github/workflows/mobile-e2e.yml (2)
89-90: Tighten Gradle cache key with toolchain fingerprintGood use of the shared cache-gradle action and cache-version input (per team guideline). Add Gradle wrapper + Java to the key to avoid stale caches when toolchain changes.
Apply:
- cache-version: ${{ env.GH_CACHE_VERSION }}-${{ hashFiles('app/android/gradle.properties') }} + cache-version: ${{ env.GH_CACHE_VERSION }}-java-${{ env.JAVA_VERSION }}-gw-${{ hashFiles('app/android/gradle/wrapper/gradle-wrapper.properties') }}-props-${{ hashFiles('app/android/gradle.properties') }}Note: Leveraging retrieved learnings about stable cache keys for workflows.
106-106: Ensure configuration cache is actually enabled (meets PR objective)If not set in gradle.properties, this won’t exercise config cache. Recommend explicitly enabling to surface incompatibilities early.
- (cd app/android && ./gradlew assembleDebug --quiet --parallel --build-cache) || { echo "❌ Android build failed"; exit 1; } + (cd app/android && ./gradlew assembleDebug --quiet --parallel --build-cache --configuration-cache) || { echo "❌ Android build failed"; exit 1; }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/mobile-e2e.yml(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.github/workflows/**/*.{yml,yaml}
📄 CodeRabbit inference engine (AGENTS.md)
.github/workflows/**/*.{yml,yaml}: In GitHub Actions workflows, use shared composite caching actions from .github/actions (cache-yarn, cache-bundler, cache-gradle, cache-pods)
Do not call actions/cache directly; rely on the shared composite caching actions
When using cache actions, optionally pass cache-version (often with GH_CACHE_VERSION and tool version) for stable keys
Files:
.github/workflows/mobile-e2e.yml
🧠 Learnings (3)
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Applies to .github/workflows/**/*.{yml,yaml} : When using cache actions, optionally pass cache-version (often with GH_CACHE_VERSION and tool version) for stable keys
Applied to files:
.github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Applies to .github/workflows/**/*.{yml,yaml} : In GitHub Actions workflows, use shared composite caching actions from .github/actions (cache-yarn, cache-bundler, cache-gradle, cache-pods)
Applied to files:
.github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments
Applied to files:
.github/workflows/mobile-e2e.yml
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: build-deps
- GitHub Check: e2e-ios
- GitHub Check: e2e-android
- GitHub Check: analyze-ios
- GitHub Check: analyze-android
🔇 Additional comments (1)
.github/workflows/mobile-e2e.yml (1)
34-34: Android E2E timeout bump looks appropriate60 minutes is reasonable for emulator-heavy E2E with config cache warmups.
| target: google_apis | ||
| force-avd-creation: false | ||
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none -memory 8192 -cores 4 -accel on | ||
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Increase emulator data partition to prevent INSTALL_FAILED_INSUFFICIENT_STORAGE
PR description mentions increasing disk partition, but the flag isn’t present. Low disk often breaks APK install on CI.
- emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
+ emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 4096📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 4096 |
🤖 Prompt for AI Agents
.github/workflows/mobile-e2e.yml around line 118: the emulator-options string is
missing the partition size flag which leads to
INSTALL_FAILED_INSUFFICIENT_STORAGE on CI; update the emulator-options to
include a larger data partition by appending something like "-partition-size
1024" (or a larger MB value if needed for your APK) so the emulator is created
with increased data storage for APK installation.
Summary
Testing
yarn workspaces foreach -A -p -v --topological-dev --since=HEAD run nice --if-present(fails: Invalid option schema)yarn workspace @selfxyz/mobile-app run nice(fails: write EPIPE)yarn lint(fails: exit code 129)yarn build(fails: exit code 129)yarn workspace @selfxyz/contracts build(fails: Couldn't find a script named "hardhat".)yarn types(fails: Cannot find module '@anon-aadhaar/core')yarn workspace @selfxyz/mobile-app test(fails: exit code 129)https://chatgpt.com/codex/tasks/task_b_68c60cc7b950832dbf52feb6e72a8a93
Summary by CodeRabbit
Tests
Chores