Skip to content

Commit c5dc53b

Browse files
committed
Extend GHA workflow to run test app
1 parent 33a41c8 commit c5dc53b

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

0 commit comments

Comments
 (0)