Skip to content

Commit 522d751

Browse files
committed
Extend GHA workflow to run test app
1 parent 134f99d commit 522d751

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

0 commit comments

Comments
 (0)