Skip to content

test: migrate Maestro e2e to the e2e runner (stable) #494

test: migrate Maestro e2e to the e2e runner (stable)

test: migrate Maestro e2e to the e2e runner (stable) #494

Workflow file for this run

name: Android Build
on:
pull_request:
branches:
- master
paths:
- '.github/workflows/android.yml'
- 'android/**'
- 'src/**'
- 'example/android/**'
- 'example/src/**'
- 'e2e/**'
push:
branches:
- master
permissions:
contents: read
pull-requests: write
jobs:
android-build:
runs-on: ubuntu-latest
timeout-minutes: 75
concurrency:
group: ${{ github.ref }}-android
cancel-in-progress: true
steps:
- uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install dependencies
shell: bash
run: bun install
- name: Install example dependencies
shell: bash
run: bun install
working-directory: example
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
- name: Bundle app
run: bun run build:android
working-directory: example
# Built before the emulator exists: Gradle competing with a swiftshader
# emulator for the runner's cores ANRs System UI, and the dialog then
# blocks every test.
- name: Build release APK
run: ./gradlew :app:assembleRelease -PreactNativeArchitectures=x86_64
working-directory: example/android
- name: AVD cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-35-google-x86_64
- name: Enable KVM group perms
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
ls /dev/kvm
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0
with:
api-level: 35
target: google_apis
arch: x86_64
ram-size: 4096M
profile: pixel
avd-name: pager-view-api-35-google
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-boot-timeout: 12000
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Install e2e dependencies
run: bun install
working-directory: e2e
- name: Run e2e tests
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
api-level: 35
target: google_apis
arch: x86_64
profile: pixel
avd-name: pager-view-api-35-google
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-boot-timeout: 12000
disable-animations: false
script: |
adb shell settings put global hide_error_dialogs 1
adb install -r example/android/app/build/outputs/apk/release/app-release.apk
bun run e2e:test:android
- name: Upload e2e report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: e2e-report-android
path: |
e2e/.e2e/report.json
e2e/.e2e/artifacts
if-no-files-found: warn
retention-days: 7