Skip to content

Commit 38946b6

Browse files
committed
Extend GHA workflow to run test app
1 parent 0e10a56 commit 38946b6

File tree

1 file changed

+64
-4
lines changed

1 file changed

+64
-4
lines changed

.github/workflows/check.yml

Lines changed: 64 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,52 @@ 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: echo "REACT_NATIVE_OVERRIDE_HERMES_DIR=`npx react-native-node-api vendor-hermes --silent`" >> $GITHUB_ENV
79+
working-directory: apps/test-app
80+
- name: Setup Android Emulator cache
81+
if: matrix.variant == 'android-tests'
82+
uses: actions/cache@v4
83+
id: avd-cache
84+
with:
85+
path: |
86+
~/.android/avd/*
87+
~/.android/adb*
88+
key: ${{ runner.os }}-avd-29
89+
- name: Run tests (Android)
90+
if: matrix.variant == 'android-tests'
91+
timeout-minutes: 75
92+
uses: reactivecircus/android-emulator-runner@v2
93+
with:
94+
api-level: 29
95+
force-avd-creation: false
96+
emulator-options: -no-snapshot-save -no-metrics -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
97+
disable-animations: true
98+
arch: x86
99+
ndk: ${{ env.NDK_VERSION }}
100+
cmake: 3.22.1
101+
working-directory: apps/test-app
102+
script: |
103+
# Setup port forwarding to Mocha Remote
104+
adb reverse tcp:8090 tcp:8090
105+
# Uninstall the app if already in the snapshot (unlikely but could result in a signature mismatch failure)
106+
adb uninstall com.microsoft.reacttestapp || true
107+
# Build, install and run the app
108+
npm run test:android

0 commit comments

Comments
 (0)