Skip to content

fix ci

fix ci #129

Workflow file for this run

name: e2e-android
on:
pull_request:
branches:
- '**'
paths:
- '.github/workflows/e2e_android.yml'
- '.gitmodules'
- 'package.json'
- 'bun.lock'
- 'react-native-update.podspec'
- 'react-native.config.js'
- 'expo-module.config.json'
- 'src/**'
- 'scripts/**'
- 'android/**'
- 'cpp/**'
- 'Example/e2etest/**'
push:
branches:
- master
- main
paths:
- '.github/workflows/e2e_android.yml'
- '.gitmodules'
- 'package.json'
- 'bun.lock'
- 'react-native-update.podspec'
- 'react-native.config.js'
- 'expo-module.config.json'
- 'src/**'
- 'scripts/**'
- 'android/**'
- 'cpp/**'
- 'Example/e2etest/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-android:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout react-native-update
uses: actions/checkout@v6
with:
submodules: recursive
- name: Checkout react-native-update-cli
uses: actions/checkout@v6
with:
repository: reactnativecn/react-native-update-cli
path: react-native-update-cli
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache Bun dependencies
uses: actions/cache@v5
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-e2e-${{ hashFiles('Example/e2etest/bun.lock', 'react-native-update-cli/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-e2e-
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
cache: gradle
cache-dependency-path: |
Example/e2etest/bun.lock
Example/e2etest/android/*.gradle
Example/e2etest/android/**/*.gradle
Example/e2etest/android/gradle/wrapper/gradle-wrapper.properties
- 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: Install e2etest dependencies
run: cd Example/e2etest && bun install --frozen-lockfile
- name: Link local react-native-update
run: |
set -euo pipefail
export LOCAL_RNU_VERSION="$(node -p "require('./Example/e2etest/node_modules/react-native-update/package.json').version")"
LOCAL_RNU_DIR="$PWD/Example/e2etest/.e2e-artifacts/local-react-native-update"
rm -rf "$LOCAL_RNU_DIR" Example/e2etest/node_modules/react-native-update
mkdir -p "$LOCAL_RNU_DIR"
cp package.json react-native-update.podspec react-native.config.js expo-module.config.json "$LOCAL_RNU_DIR"/
rsync -a --exclude='.git' src ios android cpp scripts "$LOCAL_RNU_DIR"/
node -e "const fs = require('fs'); const file = 'Example/e2etest/.e2e-artifacts/local-react-native-update/package.json'; const pkg = JSON.parse(fs.readFileSync(file, 'utf8')); pkg.version = process.env.LOCAL_RNU_VERSION; fs.writeFileSync(file, JSON.stringify(pkg, null, 2) + '\n');"
ln -s ../.e2e-artifacts/local-react-native-update Example/e2etest/node_modules/react-native-update
- name: Install react-native-update-cli dependencies
run: cd react-native-update-cli && bun install --frozen-lockfile && bun run build
- name: Detox build (android.emu.release)
env:
DETOX_ANDROID_ARCHS: x86_64
DETOX_AVD_NAME: api34
run: cd Example/e2etest && E2E_PLATFORM=android bunx detox build --configuration android.emu.release
- name: Prepare local update artifacts
env:
E2E_PLATFORM: android
RNU_CLI_ROOT: ${{ github.workspace }}/react-native-update-cli
run: cd Example/e2etest && bun run prepare:e2e
- name: Detox test (android.emu.release)
uses: reactivecircus/android-emulator-runner@v2
env:
DETOX_ANDROID_ARCHS: x86_64
RNU_CLI_ROOT: ${{ github.workspace }}/react-native-update-cli
RNU_E2E_SKIP_PREPARE: 'true'
DETOX_AVD_NAME: api34
with:
api-level: 34
target: google_apis
arch: x86_64
avd-name: api34
emulator-boot-timeout: 900
script: cd Example/e2etest && E2E_PLATFORM=android bunx detox test --configuration android.emu.release --headless --record-logs all --retries 1
- name: Upload Detox artifacts
if: failure()
uses: actions/upload-artifact@v7.0.1
with:
name: e2e-android-detox-artifacts
path: Example/e2etest/artifacts
if-no-files-found: ignore
retention-days: 7