Attempt to isolate GHA issue related to a hanging Android emulator action #212
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check | |
env: | |
# Version here should match the one in React Native template and packages/cmake-rn/src/cli.ts | |
NDK_VERSION: 27.1.12297006 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
runner: | |
- ubuntu-latest | |
variant: | |
- android-tests | |
name: Test (${{ matrix.variant }} on ${{ matrix.runner }}) | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/jod | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
with: | |
packages: tools platform-tools ndk;${{ env.NDK_VERSION }} | |
- run: npm ci | |
- name: Setup Android Emulator cache | |
if: matrix.variant == 'android-tests' | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: ${{ runner.os }}-avd-29 | |
# See https://github.com/marketplace/actions/android-emulator-runner#running-hardware-accelerated-emulators-on-linux-runners | |
- name: Enable KVM group perms | |
if: matrix.runner == 'ubuntu-latest' && matrix.variant == 'android-tests' | |
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: Hanging? | |
run: npm run test:android | |
- name: Run tests (Android) | |
if: matrix.variant == 'android-tests' | |
timeout-minutes: 75 | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-metrics -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
arch: ${{ runner.os == 'macOS' && 'arm64-v8a' || 'x86' }} | |
ndk: ${{ env.NDK_VERSION }} | |
cmake: 3.22.1 | |
working-directory: apps/test-app | |
script: | | |
# Setup port forwarding to Mocha Remote | |
adb reverse tcp:8090 tcp:8090 | |
# Uninstall the app if already in the snapshot (unlikely but could result in a signature mismatch failure) | |
adb uninstall com.microsoft.reacttestapp || true | |
# Build, install and run the app | |
npm run test:android |