Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/mobile-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ on:

jobs:
e2e-android:
if: false # Temporarily disable Android E2E until emulator disk issue resolved
concurrency:
group: ${{ github.workflow }}-android-${{ github.ref }}
cancel-in-progress: true
timeout-minutes: 45
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -87,6 +86,8 @@ jobs:
java-version: ${{ env.JAVA_VERSION }}
- name: Cache Gradle packages
uses: ./.github/actions/cache-gradle
with:
cache-version: ${{ env.GH_CACHE_VERSION }}-${{ hashFiles('app/android/gradle.properties') }}
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
Expand All @@ -102,16 +103,19 @@ jobs:
run: |
echo "Building Android APK..."
chmod +x app/android/gradlew
(cd app/android && ./gradlew assembleDebug --quiet --parallel --build-cache --no-configuration-cache) || { echo "❌ Android build failed"; exit 1; }
(cd app/android && ./gradlew assembleDebug --quiet --parallel --build-cache) || { echo "❌ Android build failed"; exit 1; }
echo "✅ Android build succeeded"
- name: Clean Android caches
run: |
rm -rf ~/.android/avd/* ~/.gradle/caches/*
- name: Install and Test on Android
Comment on lines +108 to 111
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.

uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_API_LEVEL }}
arch: x86_64
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.

disable-animations: true
script: |
echo "Installing app on emulator..."
Expand Down
7 changes: 7 additions & 0 deletions app/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ android.jetifier.ignorelist=bcprov-jdk18on
# Additional Gradle optimizations for better build performance
org.gradle.caching=true
org.gradle.configureondemand=true
# Configuration cache disabled due to React Native external process conflicts
# Issues: @react-native-community/netinfo, react-native-keychain start external Node processes
# Re-enable once React Native and dependencies support configuration cache fully
# org.gradle.configuration-cache=true

# Suppress configuration cache warnings for third-party libraries
org.gradle.configuration-cache.problems=warn

# Better dependency caching and offline support
org.gradle.dependency.verification=off
Expand Down
3 changes: 2 additions & 1 deletion app/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -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.

plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex ->
ex.autolinkLibrariesFromCommand(['yarn','exec','react-native','config'])
// Use direct autolinking instead of external yarn command to support configuration cache
ex.autolinkLibrariesFromCommand()
}
rootProject.name = 'OpenPassport'
include ':app'
Expand Down
Loading