chore(react-native-example): upgrade example app & fix detox tests #476
Workflow file for this run
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: ci-detox-android | |
on: | |
pull_request: | |
branches: | |
- master | |
jobs: | |
java-wrapper: | |
name: Build Java Wrapper | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./wrappers/react-native | |
steps: | |
- name: Checkout | |
uses: actions/checkout@83b7061638ee4956cf7545a6f7efe594e5ad0247 # pin@v3.5.1 | |
- name: Setup rust toolchain | |
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # pin@v1.0.6 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: "11" | |
distribution: "adopt" | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build Libraries for Android | |
run: yarn build:android | |
- name: Cleanup Gradle Cache | |
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | |
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -f ~/.gradle/caches/modules-2/gc.properties | |
- name: Archive build artifacts | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ci-detox-android-artifacts-libs-${{ github.sha }} | |
path: wrappers/react-native/android/lib | |
retention-days: 1 | |
android: | |
name: Detox Android E2E Testing | |
needs: [java-wrapper] | |
runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# runners: [[self-hosted, macos, general, ARM64]] | |
# concurrency: | |
# group: ci-detox-android-${{ matrix.runners }}-${{ github.head_ref || github.run_id}} | |
# cancel-in-progress: true | |
# timeout-minutes: 60 | |
env: | |
NODE_OPTIONS: "--max-old-space-size=5120" | |
defaults: | |
run: | |
working-directory: wrappers/react-native | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# https://github.com/ReactiveCircus/android-emulator-runner/blob/main/README.md#running-hardware-accelerated-emulators-on-linux-runners | |
- 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: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org | |
- name: Download Android Libraries | |
uses: actions/download-artifact@v3 | |
with: | |
name: ci-detox-android-artifacts-libs-${{ github.sha }} | |
path: wrappers/react-native/android/lib | |
- name: Inspect Android Libraries | |
run: ls -R android/lib | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile | |
- name: Example App Install Dependencies | |
working-directory: wrappers/react-native/example | |
run: yarn install --frozen-lockfile | |
# - name: Set up Java 17 Required Android SDK manager | |
# uses: actions/setup-java@v3 | |
# with: | |
# java-version: "17" | |
# distribution: "temurin" | |
# - name: Set up Android SDK | |
# uses: android-actions/setup-android@v2 | |
# with: | |
# api-level: 33 | |
# build-tools: "33.0.0" | |
# ndk: "22.1.7171670" | |
# - name: Verify Android tools | |
# run: sdkmanager --list | |
# Use Java 11 still has LTS | |
# - name: Set up Java 11 to build and test | |
# uses: actions/setup-java@v3 | |
# with: | |
# # Compatible with Android SDK | |
# java-version: "11" | |
# distribution: "temurin" | |
# - name: Inspect Linked Libraries | |
# run: ls -R android/src/main/jniLibs | |
- name: Start Android Emulator | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
target: google_apis | |
api-level: 31 | |
ram-size: 4096M | |
channel: stable | |
arch: x86_64 | |
emulator-port: 5556 | |
profile: pixel_xl | |
avd-name: Pixel_XL_API_31 | |
force-avd-creation: true # https://github.com/ReactiveCircus/android-emulator-runner/issues/385#issuecomment-2339191348 | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
emulator-boot-timeout: 12000 | |
disable-animations: true | |
working-directory: wrappers/react-native | |
script: yarn detox:android:ci | |
- name: Terminate Emulator Gracefully | |
if: always() | |
run: adb -s emulator-5556 emu kill || true | |
# - name: Detox E2E Test | |
# working-directory: wrappers/react-native | |
#run: yarn detox:android:ci | |
#- name: Archive detox failed test results | |
# if: failure() | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: detox-artifacts-${{ github.sha }} | |
# path: wrappers/react-native/example/detox-artifacts | |
# retention-days: 1 |