Skip to content

fix: change runs-on to ubuntu for E2E Android #327

fix: change runs-on to ubuntu for E2E Android

fix: change runs-on to ubuntu for E2E Android #327

Workflow file for this run

name: E2E Android
on:
pull_request:
paths:
- .github/workflows/e2e-android.yml
- apps/common/example/**
- android/**
- src/**
- e2e/**
- package.json
# push:
# branches:
# - main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
WORKING_DIRECTORY: paper-example
API_LEVEL: 34
SYSTEM_IMAGES: system-images;android-34;google_apis;x86_64
AVD_NAME: rn-svg-avd
concurrency:
group: android-e2e-example-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@main
# with:
# tool-cache: true
# android: false
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: 'gradle'
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: 'yarn'
- name: Install AVD dependencies
# libxkbfile1 is removed by "Free Disk Space (Ubuntu)" step first. Here we install it again
# as it seems to be needed by the emulator.
run: |
sudo apt update
sudo apt-get install -y libpulse0 libgl1 libxkbfile1
- 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
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.API_LEVEL }}
- name: Run emulator, Metro, and E2E
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
target: default
profile: pixel_7
ram-size: '4096M'
disk-size: '5G'
disable-animations: false
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
avd-name: e2e_emulator
arch: x86_64
script: |
# Install root node dependencies
yarn install
# Install example app node dependencies
yarn --cwd apps/${{ env.WORKING_DIRECTORY }} install
# Set up ADB reverse for Metro
$ANDROID_HOME/platform-tools/adb reverse tcp:8081 tcp:8081
# Start Metro in the background
E2E=true yarn --cwd apps/${{ env.WORKING_DIRECTORY }} start &> output.log &
# # Build the Android app
# cd apps/${{ env.WORKING_DIRECTORY }}/android && ./gradlew assembleDebug
# # Install the app APK
# $ANDROID_HOME/platform-tools/adb install -r apps/${{ env.WORKING_DIRECTORY }}/android/app/build/outputs/apk/debug/app-debug.apk
# # Launch the app using bash
# bash -c 'until $ANDROID_HOME/platform-tools/adb shell monkey -p com.paperexample 1 | grep -q "Events injected: 1"; do sleep 1; echo "Retrying app launch..."; done'
# # Run E2E tests
# yarn e2e
# Kill Metro
ps -ef | grep "yarn --cwd apps/${{ env.WORKING_DIRECTORY }} start" | grep -v grep | awk '{print $2}' | xargs -r kill || true
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: report
path: |
report.html
jest-html-reporters-attach/