Skip to content

Commit db62509

Browse files
committed
Extend GHA workflow to run test app
1 parent 379a665 commit db62509

File tree

1 file changed

+66
-4
lines changed

1 file changed

+66
-4
lines changed

.github/workflows/check.yml

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Check
22

3+
env:
4+
NDK_VERSION: 27.1.12297006
5+
36
on:
47
push:
58
branches:
@@ -25,8 +28,21 @@ jobs:
2528
strategy:
2629
fail-fast: false
2730
matrix:
28-
runner: [ubuntu-latest, windows-latest, macos-latest]
29-
name: Test (${{ matrix.runner }})
31+
runner:
32+
- ubuntu-latest
33+
- windows-latest
34+
- macos-latest
35+
variant:
36+
- unit-tests
37+
- android-tests
38+
- ios-tests
39+
exclude:
40+
- runner: ubuntu-latest
41+
variant: ios-tests
42+
- runner: windows-latest
43+
variant: ios-tests
44+
45+
name: Test (${{ matrix.variant }} on ${{ matrix.runner }})
3046
runs-on: ${{ matrix.runner }}
3147
steps:
3248
- uses: actions/checkout@v4
@@ -41,8 +57,54 @@ jobs:
4157
- name: Setup Android SDK
4258
uses: android-actions/setup-android@v3
4359
# Version here should match the one in React Native template and packages/cmake-rn/src/cli.ts
44-
- run: sdkmanager --install "ndk;27.1.12297006"
60+
- run: sdkmanager --install "ndk;${{ env.NDK_VERSION }}"
4561
- run: rustup target add x86_64-linux-android aarch64-linux-android aarch64-apple-ios-sim
4662
- run: npm ci
4763
- run: npm run bootstrap
48-
- run: npm test
64+
# Unit tests
65+
- if: matrix.variant == 'unit-tests'
66+
name: Run tests (Unit)
67+
run: npm test
68+
# Integration tests (iOS)
69+
- if: matrix.variant == 'ios-tests'
70+
run: npm run pod-install
71+
working-directory: apps/test-app
72+
- if: matrix.variant == 'ios-tests'
73+
name: Run tests (iOS)
74+
run: npm run test:ios
75+
working-directory: apps/test-app
76+
# Integration tests (Android)
77+
- if: matrix.variant == 'android-tests'
78+
run:
79+
REACT_NATIVE_OVERRIDE_HERMES_DIR=`npx react-native-node-api vendor-hermes --silent`
80+
echo "REACT_NATIVE_OVERRIDE_HERMES_DIR=$REACT_NATIVE_OVERRIDE_HERMES_DIR" >> $GITHUB_ENV
81+
working-directory: apps/test-app
82+
- name: Setup Android Emulator cache
83+
if: matrix.variant == 'android-tests'
84+
uses: actions/cache@v4
85+
id: avd-cache
86+
with:
87+
path: |
88+
~/.android/avd/*
89+
~/.android/adb*
90+
key: ${{ runner.os }}-avd-29
91+
- name: Run tests (Android)
92+
if: matrix.variant == 'android-tests'
93+
timeout-minutes: 75
94+
uses: reactivecircus/android-emulator-runner@v2
95+
with:
96+
api-level: 29
97+
force-avd-creation: false
98+
emulator-options: -no-snapshot-save -no-metrics -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
99+
disable-animations: true
100+
arch: ${{ runner.os == 'macOS' && 'arm64-v8a' || 'x86' }}
101+
ndk: ${{ env.NDK_VERSION }}
102+
cmake: 3.22.1
103+
working-directory: apps/test-app
104+
script: |
105+
# Setup port forwarding to Mocha Remote
106+
adb reverse tcp:8090 tcp:8090
107+
# Uninstall the app if already in the snapshot (unlikely but could result in a signature mismatch failure)
108+
adb uninstall com.microsoft.reacttestapp || true
109+
# Build, install and run the app
110+
npm run test:android

0 commit comments

Comments
 (0)