1
+ name : React Native CI Pipeline
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - ' rel-*'
8
+ paths :
9
+ - ' !docs/**'
10
+ - ' !README.md'
11
+ - ' !CONTRIBUTING.md'
12
+ - ' !BUILD.md'
13
+ - ' !js/web/**'
14
+ - ' !onnxruntime/core/providers/js/**'
15
+ pull_request :
16
+ branches :
17
+ - main
18
+ - ' rel-*'
19
+ paths :
20
+ - ' !docs/**'
21
+ - ' !README.md'
22
+ - ' !CONTRIBUTING.md'
23
+ - ' !BUILD.md'
24
+ - ' !js/web/**'
25
+ - ' !onnxruntime/core/providers/js/**'
26
+
27
+ concurrency :
28
+ group : ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
29
+ cancel-in-progress : true
30
+
31
+ jobs :
32
+ build_android_packages :
33
+ name : Build Android AAR Packages
34
+ runs-on : ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"]
35
+ timeout-minutes : 120
36
+ outputs :
37
+ aar_path : ${{ runner.temp }}/.artifacts
38
+ steps :
39
+ - name : Checkout repository
40
+ uses : actions/checkout@v5
41
+ with :
42
+ submodules : false
43
+
44
+ - name : Get Docker Image
45
+ id : build_docker_image_step
46
+ uses :
microsoft/onnxruntime-github-actions/[email protected]
47
+ with :
48
+ dockerfile : ${{ github.workspace }}/tools/ci_build/github/linux/docker/inference/x86_64/default/cpu/Dockerfile
49
+ image-name : ghcr.io/microsoft/onnxruntime/onnxruntimecpubuildcentos8x64_packaging
50
+ push : true
51
+ azure-container-registry-name : onnxruntimebuildcache
52
+ env :
53
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
54
+
55
+ - name : Set version number variables
56
+ id : set_versions
57
+ run : |
58
+ echo "OnnxRuntimeVersion=$(head -1 VERSION_NUMBER)" >> $GITHUB_ENV
59
+ echo "OnnxRuntimeGitCommitHash=$(git rev-parse HEAD)" >> $GITHUB_ENV
60
+ echo "OnnxRuntimeGitCommitHashShort=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV
61
+
62
+ - name : Setup Android NDK
63
+ uses : ./.github/actions/setup-android-ndk
64
+ with :
65
+ ndk-version : 28.0.13004108
66
+
67
+ - name : Build Android AAR Packages
68
+ run : |
69
+ set -e -x
70
+ NDK_HOME=$(realpath $ANDROID_NDK_HOME)
71
+ mkdir -p ${{ runner.temp }}/.build_settings
72
+ cp ${{ github.workspace }}/tools/ci_build/github/js/react_native_e2e_full_aar_build_settings.json ${{ runner.temp }}/.build_settings/build_settings.json
73
+
74
+ docker run --rm \
75
+ --volume ${{ github.workspace }}:/onnxruntime_src \
76
+ --volume ${{ runner.temp }}:/build \
77
+ --volume $ANDROID_HOME:/android_home \
78
+ --volume $NDK_HOME:/ndk_home \
79
+ --volume ${{ runner.temp }}/.artifacts:/home/onnxruntimedev/.artifacts \
80
+ --volume ${{ runner.temp }}/.build_settings:/home/onnxruntimedev/.build_settings \
81
+ -e BUILD_CONFIG=Release \
82
+ -e ORT_VERSION=${{ env.OnnxRuntimeVersion }} \
83
+ -e PUBLISH_EXECUTABLES=0 \
84
+ -e PACKAGE_NAME=onnxruntime-android \
85
+ ${{ steps.build_docker_image_step.outputs.full-image-name }} \
86
+ /bin/bash /onnxruntime_src/tools/ci_build/github/android/build_aar_and_copy_artifacts.sh 0
87
+
88
+ - name : Upload Android AAR Artifact
89
+ uses : actions/upload-artifact@v4
90
+ with :
91
+ name : onnxruntime-android-full-aar
92
+ path : ${{ runner.temp }}/.artifacts
93
+
94
+ react_native_ci_android :
95
+ name : React Native CI Android
96
+ needs : build_android_packages
97
+ runs-on : ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"]
98
+ timeout-minutes : 90
99
+ env :
100
+ ANDROID_AVD_HOME : ${{ runner.temp }}
101
+ steps :
102
+ - name : Checkout repository
103
+ uses : actions/checkout@v5
104
+
105
+ - name : Use Python 3.12
106
+ uses : actions/setup-python@v6
107
+ with :
108
+ python-version : " 3.12"
109
+ architecture : " x64"
110
+
111
+ - name : Use Java 17 (Temurin)
112
+ uses : actions/setup-java@v5
113
+ with :
114
+ distribution : ' temurin'
115
+ java-version : ' 17'
116
+ architecture : x64
117
+
118
+ - name : Use Node.js 22.x
119
+ uses : actions/setup-node@v5
120
+ with :
121
+ node-version : ' 22.x'
122
+
123
+ - name : Install ninja
124
+ run : sudo apt-get update && sudo apt-get install -y ninja-build
125
+
126
+ - name : Download Android AAR artifacts
127
+ uses : actions/download-artifact@v4
128
+ with :
129
+ name : onnxruntime-android-full-aar
130
+ path : ${{ runner.temp }}/android-full-aar
131
+
132
+ - name : Copy AAR to React Native and E2E directories
133
+ run : |
134
+ mkdir -p ${{ github.workspace }}/js/react_native/android/libs
135
+ cp ${{ runner.temp }}/android-full-aar/*.aar ${{ github.workspace }}/js/react_native/android/libs
136
+ mkdir -p ${{ github.workspace }}/js/react_native/e2e/android/app/libs
137
+ cp ${{ runner.temp }}/android-full-aar/*.aar ${{ github.workspace }}/js/react_native/e2e/android/app/libs
138
+
139
+ - name : Install dependencies and bootstrap
140
+ run : |
141
+ npm install -g detox-cli
142
+ npm ci
143
+ working-directory : ${{ github.workspace }}/js
144
+ - run : npm ci
145
+ working-directory : ${{ github.workspace }}/js/common
146
+ - run : |
147
+ npm ci
148
+ npm run bootstrap-no-pods
149
+ working-directory: ${{ github.workspace }}/js/react_native
150
+
151
+ - name : Generate a debug keystore
152
+ run : |
153
+ keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android \
154
+ -keypass android -keyalg RSA -keysize 2048 -validity 999999 -dname "CN=Android Debug,O=Android,C=US"
155
+ working-directory : ${{ github.workspace }}/js/react_native/e2e/android
156
+
157
+ - name : Build React Native Detox Android e2e Tests
158
+ run : detox build --configuration android.emu.release
159
+ working-directory : ${{ github.workspace }}/js/react_native/e2e
160
+
161
+ - name : Setup Android Emulator
162
+ uses : ./.github/actions/setup-android-ndk
163
+ with :
164
+ ndk-version : 28.0.13004108
165
+
166
+ - name : Start Android Emulator
167
+ run : |
168
+ if test -f ./emulator.pid; then
169
+ echo "Emulator PID file was not expected to exist but does and has pid: $(cat ./emulator.pid)"
170
+ exit 1
171
+ fi
172
+ python3 tools/python/run_android_emulator.py \
173
+ --android-sdk-root "${ANDROID_SDK_ROOT}" \
174
+ --start --emulator-extra-args="-partition-size 2047" \
175
+ --emulator-pid-file ./emulator.pid
176
+ echo "Emulator PID: $(cat ./emulator.pid)"
177
+
178
+ - name : Run React Native Android Instrumented Tests
179
+ run : ./gradlew connectedDebugAndroidTest --stacktrace
180
+ working-directory : ${{ github.workspace }}/js/react_native/android
181
+
182
+ - name : Run React Native Detox Android e2e Tests
183
+ run : |
184
+ JEST_JUNIT_OUTPUT_FILE=${{ github.workspace }}/js/react_native/e2e/android-test-results.xml \
185
+ detox test --record-logs all \
186
+ --configuration android.emu.release \
187
+ --loglevel trace \
188
+ --take-screenshots failing
189
+ working-directory : ${{ github.workspace }}/js/react_native/e2e
190
+
191
+ - name : Install psutil and Stop Android Emulator
192
+ if : always()
193
+ run : |
194
+ python3 -m pip install psutil
195
+ if test -f ./emulator.pid; then
196
+ echo "Emulator PID: $(cat ./emulator.pid)"
197
+ python3 tools/python/run_android_emulator.py \
198
+ --android-sdk-root "${ANDROID_SDK_ROOT}" \
199
+ --stop \
200
+ --emulator-pid-file ./emulator.pid
201
+ rm ./emulator.pid
202
+ else
203
+ echo "Emulator PID file was expected to exist but does not."
204
+ fi
205
+
206
+ react_native_ci_ios_build :
207
+ name : React Native CI iOS Build
208
+ runs-on : macos-14
209
+ timeout-minutes : 120
210
+ steps :
211
+ - name : Checkout repository
212
+ uses : actions/checkout@v5
213
+
214
+ - name : Use Xcode 15.3.0
215
+ run : sudo xcode-select --switch /Applications/Xcode_15.3.0.app/Contents/Developer
216
+
217
+ - name : Use Python 3.12
218
+ uses : actions/setup-python@v6
219
+ with :
220
+ python-version : " 3.12"
221
+ architecture : " x64"
222
+
223
+ - name : Install Python requirements
224
+ run : pip install -r tools/ci_build/github/apple/ios_packaging/requirements.txt
225
+
226
+ - name : Build iOS package and assemble pods
227
+ run : |
228
+ set -e -x
229
+ python ${{ github.workspace }}/tools/ci_build/github/apple/build_and_assemble_apple_pods.py \
230
+ --build-dir "${{ runner.temp }}/ios_framework_full" \
231
+ --staging-dir "${{ runner.temp }}/ios_pod" \
232
+ --build-settings-file ${{ github.workspace }}/tools/ci_build/github/js/react_native_e2e_full_ios_framework_build_settings.json
233
+
234
+ - name : Upload iOS Pod Artifact
235
+ uses : actions/upload-artifact@v4
236
+ with :
237
+ name : ios_pod
238
+ path : ${{ runner.temp }}/ios_pod
239
+
240
+ react_native_ci_ios_unit_tests :
241
+ name : React Native CI iOS Unit Tests
242
+ needs : react_native_ci_ios_build
243
+ runs-on : macos-14
244
+ timeout-minutes : 90
245
+ steps :
246
+ - name : Checkout repository
247
+ uses : actions/checkout@v5
248
+
249
+ - name : Download iOS pod artifact
250
+ uses : actions/download-artifact@v4
251
+ with :
252
+ name : ios_pod
253
+ path : ${{ runner.temp }}/ios_pod
254
+
255
+ - name : Use Xcode 15.3.0
256
+ run : sudo xcode-select --switch /Applications/Xcode_15.3.0.app/Contents/Developer
257
+
258
+ - name : Use Node.js 22.x
259
+ uses : actions/setup-node@v5
260
+ with :
261
+ node-version : ' 22.x'
262
+
263
+ - name : Install dependencies and bootstrap
264
+ run : |
265
+ npm ci
266
+ working-directory : ${{ github.workspace }}/js
267
+ - run : npm ci
268
+ working-directory : ${{ github.workspace }}/js/common
269
+ - run : |
270
+ npm ci
271
+ npm run bootstrap-no-pods
272
+ working-directory: ${{ github.workspace }}/js/react_native
273
+
274
+ - name : Pod install
275
+ run : |
276
+ ORT_C_LOCAL_POD_PATH=${{ runner.temp }}/ios_pod/onnxruntime-c \
277
+ pod install
278
+ working-directory : ${{ github.workspace }}/js/react_native/ios
279
+
280
+ - name : Run React Native iOS Instrumented Tests
281
+ run : |
282
+ set -o pipefail && xcodebuild test \
283
+ -workspace OnnxruntimeModule.xcworkspace \
284
+ -scheme OnnxruntimeModuleTest \
285
+ -sdk iphonesimulator \
286
+ -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.4' \
287
+ | xcpretty --report junit --output build/reports/test-results.xml
288
+ working-directory : ${{ github.workspace }}/js/react_native/ios
289
+
290
+ react_native_ci_ios_e2e_tests :
291
+ name : React Native CI iOS E2E Tests
292
+ needs : react_native_ci_ios_build
293
+ runs-on : macos-14
294
+ timeout-minutes : 90
295
+ steps :
296
+ - name : Checkout repository
297
+ uses : actions/checkout@v5
298
+
299
+ - name : Download iOS pod artifact
300
+ uses : actions/download-artifact@v4
301
+ with :
302
+ name : ios_pod
303
+ path : ${{ runner.temp }}/ios_pod
304
+
305
+ - name : Use Xcode 15.3.0
306
+ run : sudo xcode-select --switch /Applications/Xcode_15.3.0.app/Contents/Developer
307
+
308
+ - name : Use Node.js 22.x
309
+ uses : actions/setup-node@v5
310
+ with :
311
+ node-version : ' 22.x'
312
+
313
+ - name : Install dependencies and bootstrap
314
+ run : |
315
+ npm install -g detox-cli
316
+ brew tap wix/brew
317
+ brew install applesimutils
318
+ npm ci
319
+ working-directory : ${{ github.workspace }}/js
320
+ - run : npm ci
321
+ working-directory : ${{ github.workspace }}/js/common
322
+ - run : |
323
+ npm ci
324
+ npm run bootstrap-no-pods
325
+ working-directory: ${{ github.workspace }}/js/react_native
326
+
327
+ - name : Pod install for e2e tests
328
+ run : |
329
+ ORT_C_LOCAL_POD_PATH=${{ runner.temp }}/ios_pod/onnxruntime-c \
330
+ pod install
331
+ working-directory : ${{ github.workspace }}/js/react_native/e2e/ios
332
+
333
+ - name : Build and Run Detox iOS e2e Tests
334
+ run : |
335
+ detox build --configuration ios.sim.release
336
+ JEST_JUNIT_OUTPUT_FILE=${{ github.workspace }}/js/react_native/e2e/ios-test-results.xml \
337
+ detox test --record-logs all \
338
+ --configuration ios.sim.release \
339
+ --loglevel verbose \
340
+ --take-screenshots failing
341
+ working-directory : ${{ github.workspace }}/js/react_native/e2e
0 commit comments