Files
LensApp/.github/workflows/e2e-android.yml
Rakshit Kumar Singh e61ca8a629 enulator test (#1)
* enulator test

* enulator fix

* fix adb name

* fix path for detox

* fix bundeling

* fix api

* fix path

* fix path

* path

* path

* path

* path

* fix: start Metro before emulator-runner to avoid pipe block

* add bare-minimum e2e workflow using release build (no Metro)

* fix: use debug instrumentation APK against release app build

* fix: add Detox androidTest dep and testInstrumentationRunner, use debug build

* fix: add version to detox androidTestImplementation

* fix: add Detox local Maven repo to allprojects

* fix: remove androidTestImplementation detox, not needed with auto-linking

* fix: add androidx.test:runner to provide AndroidJUnitRunner in test APK

* fix: add proper Detox test class and dependency with exclusiveContent

* fix: correct Detox maven coordinate to com.wix:detox

* fix: override Detox minSdk 24 requirement for androidTest

* remove viewer.e2e.ts, requires launch args bridge not yet wired up

* cleanup: remove E2E from build-android workflow, revert release detox config

* update github action

* enable ABI splits for smaller per-arch release APKs

* fix: move abiCodes into closure scope

* fix: only split release builds, keep universal debug APK for E2E
2026-04-18 22:32:40 +05:30

121 lines
3.8 KiB
YAML

name: E2E Android (Detox)
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
jobs:
e2e:
name: Detox E2E (debug)
runs-on: ubuntu-latest
env:
ANDROID_HOME: /home/runner/android-sdk
ANDROID_SDK_ROOT: /home/runner/android-sdk
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
- uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Cache Android SDK
id: cache-sdk
uses: actions/cache@v5
with:
path: /home/runner/android-sdk
key: android-sdk-${{ hashFiles('android/build.gradle') }}
- name: Install Android SDK
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: |
mkdir -p $ANDROID_HOME/cmdline-tools
curl -sSL https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -o cmdline-tools.zip
unzip -q cmdline-tools.zip -d $ANDROID_HOME/cmdline-tools
mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_HOME \
"platforms;android-35" "build-tools;35.0.0" "platform-tools"
- name: Cache Gradle
uses: actions/cache@v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
android/.gradle
key: gradle-${{ hashFiles('android/gradle/wrapper/gradle-wrapper.properties', 'android/**/*.gradle') }}
restore-keys: gradle-
- name: chmod gradlew
run: chmod +x android/gradlew
# debuggableVariants=[] in build.gradle means JS is bundled into debug APK too,
# so no Metro server is needed at runtime.
- name: Build APKs
working-directory: android
run: ./gradlew assembleDebug assembleAndroidTest --no-daemon
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
# Cache the AVD snapshot to speed up subsequent runs
- name: Cache AVD snapshot
uses: actions/cache@v5
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-34-x86_64-google_apis
- name: Create AVD snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
profile: pixel_6
avd-name: Pixel_6_API_34
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "AVD snapshot ready"
- name: Run Detox E2E
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
profile: pixel_6
avd-name: Pixel_6_API_34
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: npx detox test --configuration android.emu.debug --headless --record-logs failing
- name: Upload Detox logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: detox-logs-${{ github.run_number }}
path: artifacts/
retention-days: 7