Skip to content

Conversation

@transphorm
Copy link
Member

@transphorm transphorm commented Sep 14, 2025

Summary

  • reenable android E2E workflow with 60m timeout
  • clean emulator caches and increase disk partition
  • enable Gradle configuration caching

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

    • Re-enabled Android end-to-end tests.
    • Extended Android E2E timeout to reduce flaky failures.
    • Updated emulator runtime options for more stable test runs.
  • Chores

    • Adjusted Gradle configuration cache settings and build invocation to avoid conflicts.
    • Tightened Android dependency caching and added automated cleanup of Android/Gradle caches.
    • Registered additional Android native modules and updated autolinking behavior.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 14, 2025

Walkthrough

Re-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

Cohort / File(s) Summary
Android E2E workflow
.github/workflows/mobile-e2e.yml
Re-enabled e2e-android job; increased job timeout to 60m; cache key now includes GH_CACHE_VERSION and hash of app/android/gradle.properties; build step changed to ./gradlew assembleDebug --quiet --parallel --build-cache (removed --no-configuration-cache); emulator flags adjusted (removed explicit resource/accel flags, kept -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none, added partition-size earlier then later removed in summary); added post-build cleanup steps removing ~/.android/avd/* and ~/.gradle/caches/*.
Android Gradle properties
app/android/gradle.properties
Commented out org.gradle.configuration-cache=true and added org.gradle.configuration-cache.problems=warn plus explanatory comments about configuration-cache conflicts with external React Native processes.
Android settings / autolinking & modules
app/android/settings.gradle
Replaced ex.autolinkLibrariesFromCommand(['yarn','exec','react-native','config']) with ex.autolinkLibrariesFromCommand(); added includeBuild('../../node_modules/@react-native/gradle-plugin'); added modules :react-native-passport-reader and :passportreader with explicit projectDir paths.

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • remicolin
  • aaronmgdr

Poem

CI wakes, the emulator sighs,
Gradle keys shift where the cache-key flies.
Modules linked, configs set to warn,
Clean the caches before the morn.
Android tests return—new flags adorn. 🚀📱

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "ci: enable android e2e and config cache" concisely captures the PR’s main intent to re-enable Android end-to-end CI and change Gradle configuration-cache handling, matching the workflow and build-script edits; however, the changes show mixed configuration-cache actions (CI removes the no-configuration-cache flag while gradle.properties comments out enabling the cache), making the "config cache" claim somewhat ambiguous.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/evaluate-and-optimize-android-e2e-workflow-wo1kj2

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 compatibility

Enabling 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=warn

Please 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 directory

Good 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 invalidations

Dropping --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

📥 Commits

Reviewing files that changed from the base of the PR and between 3d46aec and 232118b.

📒 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 runs

Fits typical Android E2E duration with AVD creation and Maestro.


118-118: Partition size 4096MB: verify runner disk headroom

Larger 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.

Comment on lines +108 to 111
- name: Clean Android caches
run: |
rm -rf ~/.android/avd/* ~/.gradle/caches/*
- name: Install and Test on Android
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Suggested change
- 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 232118b and a0e6787.

📒 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") }
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 effectiveness

This 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 fingerprint

Good 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

📥 Commits

Reviewing files that changed from the base of the PR and between a0e6787 and 2d71331.

📒 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 appropriate

60 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
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Suggested change
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.

@transphorm transphorm closed this Sep 14, 2025
@transphorm transphorm deleted the codex/evaluate-and-optimize-android-e2e-workflow-wo1kj2 branch September 27, 2025 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants