1
1
name : Check
2
2
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
+
3
7
on :
4
8
push :
5
9
branches :
6
10
- main
7
11
pull_request :
12
+ types : [labeled, opened, synchronize, reopened]
8
13
9
14
concurrency :
10
15
group : ${{ github.workflow }}-${{ github.ref }}
@@ -21,13 +26,66 @@ jobs:
21
26
node-version : lts/jod
22
27
- run : npm ci
23
28
- run : npm run lint
24
- test :
29
+ unit-tests :
25
30
strategy :
26
31
fail-fast : false
27
32
matrix :
28
- runner : [ubuntu-latest, windows-latest, macos-latest]
29
- name : Test (${{ matrix.runner }})
33
+ runner :
34
+ - ubuntu-latest
35
+ - windows-latest
36
+ - macos-latest
30
37
runs-on : ${{ matrix.runner }}
38
+ name : Unit tests (${{ matrix.runner }})
39
+ steps :
40
+ - uses : actions/checkout@v4
41
+ - uses : actions/setup-node@v4
42
+ with :
43
+ node-version : lts/jod
44
+ - name : Set up JDK 17
45
+ uses : actions/setup-java@v3
46
+ with :
47
+ java-version : " 17"
48
+ distribution : " temurin"
49
+ - name : Setup Android SDK
50
+ uses : android-actions/setup-android@v3
51
+ with :
52
+ packages : tools platform-tools ndk;${{ env.NDK_VERSION }}
53
+ - run : rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android aarch64-apple-ios-sim
54
+ - run : npm ci
55
+ - run : npm run bootstrap
56
+ - run : npm test
57
+ test-ios :
58
+ if : github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Apple 🍎')
59
+ name : Test app (iOS)
60
+ runs-on : macos-latest
61
+ steps :
62
+ - uses : actions/checkout@v4
63
+ - uses : actions/setup-node@v4
64
+ with :
65
+ node-version : lts/jod
66
+ - name : Set up JDK 17
67
+ uses : actions/setup-java@v3
68
+ with :
69
+ java-version : " 17"
70
+ distribution : " temurin"
71
+ - name : Setup Android SDK
72
+ uses : android-actions/setup-android@v3
73
+ with :
74
+ packages : tools platform-tools ndk;${{ env.NDK_VERSION }}
75
+ - run : rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android aarch64-apple-ios-sim
76
+ - run : npm ci
77
+ - run : npm run bootstrap
78
+ - run : npm run pod-install
79
+ working-directory : apps/test-app
80
+ - name : Run tests (iOS)
81
+ run : npm run test:ios
82
+ # TODO: Enable release mode when it works
83
+ # run: npm run test:ios -- --mode Release
84
+ working-directory : apps/test-app
85
+ test-android :
86
+ if : github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Android 🤖')
87
+ name : Test app (Android)
88
+ runs-on : ubuntu-latest
31
89
steps :
32
90
- uses : actions/checkout@v4
33
91
- uses : actions/setup-node@v4
40
98
distribution : " temurin"
41
99
- name : Setup Android SDK
42
100
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"
45
- - run : rustup target add x86_64-linux-android aarch64-linux-android aarch64-apple-ios-sim
101
+ with :
102
+ packages : tools platform-tools ndk;${{ env.NDK_VERSION }}
103
+ - run : rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android aarch64-apple-ios-sim
46
104
- run : npm ci
47
105
- run : npm run bootstrap
48
- - run : npm test
106
+ - name : Clone patched Hermes version
107
+ shell : bash
108
+ run : |
109
+ REACT_NATIVE_OVERRIDE_HERMES_DIR=$(npx react-native-node-api vendor-hermes --silent)
110
+ echo "REACT_NATIVE_OVERRIDE_HERMES_DIR=$REACT_NATIVE_OVERRIDE_HERMES_DIR" >> $GITHUB_ENV
111
+ working-directory : apps/test-app
112
+ # - name: Setup Android Emulator cache
113
+ # uses: actions/cache@v4
114
+ # id: avd-cache
115
+ # with:
116
+ # path: |
117
+ # ~/.android/avd/*
118
+ # ~/.android/adb*
119
+ # key: ${{ runner.os }}-avd-29
120
+ # See https://github.com/marketplace/actions/android-emulator-runner#running-hardware-accelerated-emulators-on-linux-runners
121
+ - name : Enable KVM group perms
122
+ run : |
123
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
124
+ sudo udevadm control --reload-rules
125
+ sudo udevadm trigger --name-match=kvm
126
+ - name : Build weak-node-api for all architectures
127
+ run : npm run build-weak-node-api -- --android
128
+ working-directory : packages/host
129
+ - name : Build ferric-example for all architectures
130
+ run : npm run build -- --android
131
+ working-directory : packages/ferric-example
132
+ - name : Run tests (Android)
133
+ timeout-minutes : 75
134
+ uses : reactivecircus/android-emulator-runner@v2
135
+ with :
136
+ api-level : 29
137
+ force-avd-creation : false
138
+ emulator-options : -no-snapshot-save -no-metrics -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
139
+ disable-animations : true
140
+ arch : x86
141
+ ndk : ${{ env.NDK_VERSION }}
142
+ cmake : 3.22.1
143
+ working-directory : apps/test-app
144
+ script : |
145
+ # Setup port forwarding to Mocha Remote
146
+ adb reverse tcp:8090 tcp:8090
147
+ # Uninstall the app if already in the snapshot (unlikely but could result in a signature mismatch failure)
148
+ adb uninstall com.microsoft.reacttestapp || true
149
+ # Build, install and run the app
150
+ npm run test:android -- --mode Release
151
+ # Wait a bit for the sub-process to terminate, before terminating the emulator
152
+ sleep 5
0 commit comments