Skip to content

Commit 1a53f85

Browse files
committed
Extend GHA workflow to run test app
1 parent a24c872 commit 1a53f85

File tree

1 file changed

+70
-5
lines changed

1 file changed

+70
-5
lines changed

.github/workflows/check.yml

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

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

0 commit comments

Comments
 (0)