-
Notifications
You must be signed in to change notification settings - Fork 3.9k
294 lines (252 loc) · 11 KB
/
react_native.yml
File metadata and controls
294 lines (252 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
name: React Native CI Pipeline
on:
push:
branches: [main, 'rel-*']
pull_request:
branches: [main, 'rel-*']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: true
jobs:
build_android_packages:
name: Build Android AAR Packages
runs-on: [
"self-hosted",
"1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU",
"JobId=react_build_android_packages-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"
]
timeout-minutes: 120
outputs:
aar_path: ${{ runner.temp }}/.artifacts
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: false
- name: Set version number variables
id: set_versions
run: |
echo "OnnxRuntimeVersion=$(head -1 VERSION_NUMBER)" >> $GITHUB_ENV
echo "OnnxRuntimeGitCommitHash=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "OnnxRuntimeGitCommitHashShort=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV
- name: Setup Android NDK
uses: ./.github/actions/setup-android-ndk
with:
ndk-version: 28.0.13004108
- uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.9
with:
vcpkg-version: '2025.08.27'
vcpkg-hash: '9a4b32849792e13bee1d24726f073b3881acae4165206ddf1a6378e44a4ddd05b3ee93f55ff46d8e8873b3cbcd06606212989e248f0bd615a5bf365070074079'
cmake-version: '3.31.6'
cmake-hash: '42395e20b10a8e9ef3e33014f9a4eed08d46ab952e02d2c1bbc8f6133eca0d7719fb75680f9bbff6552f20fcd1b73d86860f7f39388d631f98fb6f622b37cf04'
add-cmake-to-path: 'true'
disable-terrapin: 'true'
- name: Build Android AAR Packages
run: |
set -e -x
mkdir -p ${{ runner.temp }}/.build_settings
mkdir -p ${{ runner.temp }}/artifacts
cp tools/ci_build/github/js/react_native_e2e_full_aar_build_settings.json ${{ runner.temp }}/.build_settings/build_settings.json
python3 -m pip install --user -r ${{ github.workspace }}/tools/ci_build/requirements/pybind/requirements.txt
python3 ${{ github.workspace }}/tools/ci_build/github/android/build_aar_package.py --build_dir ${{ runner.temp }} --config Release --android_sdk_path $ANDROID_SDK_ROOT --android_ndk_path $ANDROID_NDK_ROOT ${{ runner.temp }}/.build_settings/build_settings.json
# Copy the built artifacts to give folder for publishing
cp -r ${{ runner.temp }}/aar_out/Release/com ${{ runner.temp }}/artifacts
- name: Upload Android AAR Artifact
uses: actions/upload-artifact@v6
with:
name: onnxruntime-android-full-aar
path: ${{ runner.temp }}/artifacts
react_native_ci_android:
name: React Native CI Android
needs: build_android_packages
runs-on: [
"self-hosted",
"1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU",
"JobId=react_native_ci_android-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"
]
timeout-minutes: 90
steps:
- name: Set ANDROID_AVD_HOME environment variable
run: echo "ANDROID_AVD_HOME=${{ runner.temp }}/android-avd" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v6
- name: Use Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
architecture: "x64"
- name: Use Java 17 (Temurin)
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
architecture: x64
- name: Use Node.js 22.x
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Install ninja
run: sudo apt-get update && sudo apt-get install -y ninja-build
- name: Download Android AAR artifacts
uses: actions/download-artifact@v7
with:
name: onnxruntime-android-full-aar
path: ${{ runner.temp }}/android-full-aar
- name: Copy AAR to React Native and E2E directories
run: |
mkdir -p ${{ github.workspace }}/js/react_native/e2e/android/app/libs
cp -r ${{ runner.temp }}/android-full-aar/com ${{ github.workspace }}/js/react_native/e2e/android/app/libs
- name: Install dependencies and bootstrap
run: |
npm install -g detox-cli
npm ci
working-directory: ${{ github.workspace }}/js
- run: npm ci
working-directory: ${{ github.workspace }}/js/common
- run: |
npm ci
npm run bootstrap-no-pods
working-directory: ${{ github.workspace }}/js/react_native
- name: Generate a debug keystore
run: |
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android \
-keypass android -keyalg RSA -keysize 2048 -validity 999999 -dname "CN=Android Debug,O=Android,C=US"
working-directory: ${{ github.workspace }}/js/react_native/e2e/android
- name: Build React Native Detox Android e2e Tests
run: detox build --configuration android.emu.release
working-directory: ${{ github.workspace }}/js/react_native/e2e
- name: Setup Android Emulator
uses: ./.github/actions/setup-android-ndk
with:
ndk-version: 28.0.13004108
- name: Run React Native Detox Android e2e Tests
run: |
JEST_JUNIT_OUTPUT_FILE=${{ github.workspace }}/js/react_native/e2e/android-test-results.xml \
detox test --record-logs all \
--configuration android.emu.release \
--loglevel trace \
--take-screenshots failing
working-directory: ${{ github.workspace }}/js/react_native/e2e
- name: Install psutil and Stop Android Emulator
if: always()
run: |
python3 -m pip install psutil
if test -f ./emulator.pid; then
echo "Emulator PID: $(cat ./emulator.pid)"
python3 tools/python/run_android_emulator.py \
--android-sdk-root "${ANDROID_SDK_ROOT}" \
--stop \
--emulator-pid-file ./emulator.pid
rm ./emulator.pid
else
echo "Emulator PID file was expected to exist but does not."
fi
- name: Upload Android Test Results
if: always()
uses: actions/upload-artifact@v6
with:
name: android-test-results
path: |
${{ github.workspace }}/js/react_native/e2e/android-test-results.xml
${{ github.workspace }}/js/react_native/e2e/artifacts
react_native_ci_ios_build:
name: React Native CI iOS Build
runs-on: macos-14
timeout-minutes: 120
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Use Xcode 15.3.0
run: sudo xcode-select --switch /Applications/Xcode_15.3.0.app/Contents/Developer
- name: Use Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
architecture: "x64"
- name: Install Python requirements
run: pip install -r tools/ci_build/github/apple/ios_packaging/requirements.txt
- uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.9
with:
vcpkg-version: '2025.08.27'
vcpkg-hash: 9a4b32849792e13bee1d24726f073b3881acae4165206ddf1a6378e44a4ddd05b3ee93f55ff46d8e8873b3cbcd06606212989e248f0bd615a5bf365070074079
cmake-version: '3.31.8'
cmake-hash: 99cc9c63ae49f21253efb5921de2ba84ce136018abf08632c92c060ba91d552e0f6acc214e9ba8123dee0cf6d1cf089ca389e321879fd9d719a60d975bcffcc8
add-cmake-to-path: 'true'
disable-terrapin: 'true'
- name: Build iOS package and assemble pods
run: |
python ${{ github.workspace }}/tools/ci_build/github/apple/build_and_assemble_apple_pods.py \
--build-dir "${{ runner.temp }}/ios_framework_full" \
--staging-dir "${{ runner.temp }}/ios_pod" \
--build-settings-file ${{ github.workspace }}/tools/ci_build/github/js/react_native_e2e_full_ios_framework_build_settings_arm64.json
- name: Upload iOS Pod Artifact
uses: actions/upload-artifact@v6
with:
name: ios_pod
path: ${{ runner.temp }}/ios_pod
react_native_ci_ios_e2e_tests:
name: React Native CI iOS E2E Tests
needs: react_native_ci_ios_build
runs-on: macos-14
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download iOS pod artifact
uses: actions/download-artifact@v7
with:
name: ios_pod
path: ${{ runner.temp }}/ios_pod
- name: Use Xcode 15.3.0
run: sudo xcode-select --switch /Applications/Xcode_15.3.0.app/Contents/Developer
- name: Use Node.js 22.x
uses: actions/setup-node@v6
with:
node-version: '22.x'
- uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.9
with:
vcpkg-version: '2025.08.27'
vcpkg-hash: 9a4b32849792e13bee1d24726f073b3881acae4165206ddf1a6378e44a4ddd05b3ee93f55ff46d8e8873b3cbcd06606212989e248f0bd615a5bf365070074079
cmake-version: '3.31.8'
cmake-hash: 99cc9c63ae49f21253efb5921de2ba84ce136018abf08632c92c060ba91d552e0f6acc214e9ba8123dee0cf6d1cf089ca389e321879fd9d719a60d975bcffcc8
add-cmake-to-path: 'true'
disable-terrapin: 'true'
- name: Install dependencies and bootstrap
run: |
set -e -x
npm install -g detox-cli
brew tap wix/brew
brew install applesimutils
npm ci
working-directory: ${{ github.workspace }}/js
- run: npm ci
working-directory: ${{ github.workspace }}/js/common
- run: |
set -e -x
npm ci
npm run bootstrap-no-pods
working-directory: ${{ github.workspace }}/js/react_native
- name: Pod install for e2e tests
run: |
set -e -x
ls ${{ runner.temp }}/ios_pod/onnxruntime-c
ORT_C_LOCAL_POD_PATH=${{ runner.temp }}/ios_pod/onnxruntime-c pod install --verbose
working-directory: ${{ github.workspace }}/js/react_native/e2e/ios
- name: Build and Run Detox iOS e2e Tests
run: |
detox build --configuration ios.sim.release
JEST_JUNIT_OUTPUT_FILE=${{ github.workspace }}/js/react_native/e2e/ios-test-results.xml \
detox test --record-logs all \
--configuration ios.sim.release \
--loglevel verbose \
--take-screenshots failing
working-directory: ${{ github.workspace }}/js/react_native/e2e
- name: Upload iOS Test Results
if: always()
uses: actions/upload-artifact@v6
with:
name: ios-test-results
path: |
${{ github.workspace }}/js/react_native/e2e/ios-test-results.xml
${{ github.workspace }}/js/react_native/e2e/artifacts