e2e-android #1
This file contains 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: e2e-android | |
on: workflow_dispatch | |
jobs: | |
e2e-android: | |
runs-on: ubuntu-latest | |
env: | |
API_LEVEL: 34 | |
ARCH: x86_64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- 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: Setup Node | |
uses: ./.github/actions/setup-node-with-cache | |
- name: Install node modules | |
run: | | |
npm ci --ignore-scripts --prefer-offline --no-audit | |
npm run bootstrap -- --scope=mobile | |
- name: Use specific Java version for the builds | |
uses: joschi/setup-jdk@v2 | |
with: | |
java-version: "17" | |
architecture: "x64" | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v3 | |
- name: AVD cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ env.API_LEVEL }} | |
- name: Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ env.API_LEVEL }} | |
arch: ${{ env.ARCH }} | |
disable-animations: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
force-avd-creation: false | |
script: echo 'Generated AVD snapshot for caching.' | |
- name: Cache Detox build | |
id: cache-detox-build | |
uses: actions/cache@v4 | |
with: | |
path: android/app/build | |
key: ${{ runner.os }}-detox-build | |
restore-keys: | | |
${{ runner.os }}-detox-build | |
- name: Detox build | |
run: yarn build:android | |
- name: Get device name | |
id: device | |
run: | | |
AVD_NAME=$(node -p "require('./apps/mobile/native/.detoxrc.js').devices.emulator.device.avdName") | |
echo "AVD_NAME=$AVD_NAME" >> $GITHUB_OUTPUT | |
- name: Detox test | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ env.API_LEVEL }} | |
arch: ${{ env.ARCH }} | |
avd-name: ${{ steps.device.outputs.AVD_NAME }} | |
disable-animations: true | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
force-avd-creation: false | |
script: > | |
yarn test:android | |
--headless | |
--record-logs failing | |
--record-videos failing | |
--take-screenshots failing | |
- name: Upload artifacts | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: detox-artifacts | |
path: artifacts | |
retention-days: 14 |