@@ -14,6 +14,12 @@ concurrency:
14
14
env :
15
15
SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_AUTH_TOKEN }}
16
16
RN_SENTRY_POD_NAME : RNSentry
17
+ IOS_APP_ARCHIVE_PATH : sentry-react-native-sample.app.zip
18
+ ANDROID_APP_ARCHIVE_PATH : sentry-react-native-sample.apk.zip
19
+ REACT_NATIVE_SAMPLE_PATH : samples/react-native
20
+ IOS_DEVICE : ' iPhone 16'
21
+ IOS_VERSION : ' 18.1'
22
+ ANDROID_API_LEVEL : ' 30'
17
23
18
24
jobs :
19
25
diff_check :
66
72
- uses : ruby/setup-ruby@v1
67
73
if : ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
68
74
with :
69
- working-directory : ${{ matrix.platform == 'ios' && ' samples/react-native' || ' samples/react-native-macos' }}
75
+ working-directory : ${{ matrix.platform == 'ios' && env.REACT_NATIVE_SAMPLE_PATH || ' samples/react-native-macos' }}
70
76
ruby-version : ' 3.3.0' # based on what is used in the sample
71
77
bundler-cache : true # runs 'bundle install' and caches installed gems automatically
72
78
cache-version : 1 # cache the installed gems
@@ -106,8 +112,10 @@ jobs:
106
112
107
113
- name : Build Android App
108
114
if : ${{ matrix.platform == 'android' }}
109
- working-directory : samples/react-native /android
115
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} /android
110
116
run : |
117
+ ../scripts/set-aos-dsn.mjs
118
+
111
119
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
112
120
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
113
121
echo 'New Architecture enabled'
@@ -119,12 +127,17 @@ jobs:
119
127
fi
120
128
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
121
129
echo "Building $CONFIG"
122
- ./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
130
+ [[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
131
+ echo "Building $TEST_TYPE"
132
+
133
+ ./gradlew ":app:assemble$CONFIG" app:assembleAndroidTest -DtestBuildType=$TEST_TYPE -PreactNativeArchitectures=x86
123
134
124
135
- name : Build iOS App
125
136
if : ${{ matrix.platform == 'ios' }}
126
- working-directory : samples/react-native /ios
137
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} /ios
127
138
run : |
139
+ ../scripts/set-ios-dsn.mjs
140
+
128
141
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
129
142
echo "Building $CONFIG"
130
143
mkdir -p "DerivedData"
@@ -160,9 +173,162 @@ jobs:
160
173
| tee xcodebuild.log \
161
174
| xcbeautify --quieter --is-ci --disable-colored-output
162
175
176
+ - name : Archive iOS App
177
+ if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
178
+ run : |
179
+ cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
180
+ zip -r \
181
+ ${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
182
+ sentryreactnativesample.app
183
+
184
+ - name : Archive Android App
185
+ if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
186
+ run : |
187
+ mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
188
+ mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk app-androidTest.apk
189
+ zip -j \
190
+ ${{ env.ANDROID_APP_ARCHIVE_PATH }} \
191
+ app.apk \
192
+ app-androidTest.apk
193
+
194
+ - name : Upload iOS APP
195
+ if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
196
+ uses : actions/upload-artifact@v4
197
+ with :
198
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
199
+ path : ${{ env.IOS_APP_ARCHIVE_PATH }}
200
+ retention-days : 1
201
+
202
+ - name : Upload Android APK
203
+ if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
204
+ uses : actions/upload-artifact@v4
205
+ with :
206
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
207
+ path : ${{ env.ANDROID_APP_ARCHIVE_PATH }}
208
+ retention-days : 1
209
+
163
210
- name : Upload logs
164
211
if : ${{ always() }}
165
212
uses : actions/upload-artifact@v4
166
213
with :
167
214
name : build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
168
- path : samples/react-native/${{ matrix.platform }}/*.log
215
+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
216
+
217
+ test :
218
+ name : Test ${{ matrix.platform }} ${{ matrix.build-type }}
219
+ runs-on : ${{ matrix.runs-on }}
220
+ needs : [diff_check, build]
221
+ if : ${{ needs.diff_check.outputs.skip_ci != 'true' }}
222
+ strategy :
223
+ # we want that the matrix keeps running, default is to cancel them if it fails.
224
+ fail-fast : false
225
+ matrix :
226
+ include :
227
+ - platform : ios
228
+ runs-on : macos-15
229
+ rn-architecture : ' new'
230
+ ios-use-frameworks : ' no-frameworks'
231
+ build-type : ' production'
232
+
233
+ - platform : android
234
+ runs-on : ubuntu-latest
235
+ rn-architecture : ' new'
236
+ build-type : ' production'
237
+
238
+ steps :
239
+ - uses : actions/checkout@v4
240
+
241
+ - name : Download iOS App Archive
242
+ if : ${{ matrix.platform == 'ios' }}
243
+ uses : actions/download-artifact@v4
244
+ with :
245
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
246
+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
247
+
248
+ - name : Download Android APK
249
+ if : ${{ matrix.platform == 'android' }}
250
+ uses : actions/download-artifact@v4
251
+ with :
252
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
253
+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
254
+
255
+ - name : Unzip iOS App Archive
256
+ if : ${{ matrix.platform == 'ios' }}
257
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
258
+ run : unzip ${{ env.IOS_APP_ARCHIVE_PATH }}
259
+
260
+ - name : Unzip Android APK
261
+ if : ${{ matrix.platform == 'android' }}
262
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
263
+ run : unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
264
+
265
+ - name : Enable Corepack
266
+ run : |
267
+ npm install -g corepack@0.29.4
268
+ corepack enable
269
+ - uses : actions/setup-node@v4
270
+ with :
271
+ node-version : 18
272
+ cache : ' yarn'
273
+ cache-dependency-path : yarn.lock
274
+
275
+ - name : Install JS Dependencies
276
+ run : yarn install
277
+
278
+ - name : Install Detox
279
+ run : npm install -g detox-cli@20.0.0
280
+
281
+ - name : Install Apple Simulator Utilities
282
+ if : ${{ matrix.platform == 'ios' }}
283
+ run : |
284
+ brew tap wix/brew
285
+ brew install applesimutils
286
+
287
+ - name : Setup KVM
288
+ if : ${{ matrix.platform == 'android' }}
289
+ shell : bash
290
+ run : |
291
+ # check if virtualization is supported...
292
+ sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
293
+ # allow access to KVM to run the emulator
294
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
295
+ | sudo tee /etc/udev/rules.d/99-kvm4all.rules
296
+ sudo udevadm control --reload-rules
297
+ sudo udevadm trigger --name-match=kvm
298
+
299
+ - uses : futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
300
+ if : ${{ matrix.platform == 'ios' }}
301
+ with :
302
+ # the same envs are used by Detox ci.sim configuration
303
+ model : ${{ env.IOS_DEVICE }}
304
+ os_version : ${{ env.IOS_VERSION }}
305
+
306
+ - name : Run Detox iOS Tests
307
+ if : ${{ matrix.platform == 'ios' }}
308
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
309
+ run : detox test --configuration ci.sim
310
+
311
+ - name : Run tests on Android
312
+ if : ${{ matrix.platform == 'android' }}
313
+ env :
314
+ # used by Detox ci.android configuration
315
+ ANDROID_AVD_NAME : ' test' # test is default reactivecircus/android-emulator-runner name
316
+ uses : reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # pin@v2.33.0
317
+ with :
318
+ api-level : ${{ env.ANDROID_API_LEVEL }}
319
+ force-avd-creation : false
320
+ disable-animations : true
321
+ disable-spellchecker : true
322
+ target : ' aosp_atd'
323
+ channel : canary # Necessary for ATDs
324
+ emulator-options : >
325
+ -no-window
326
+ -no-snapshot-save
327
+ -gpu swiftshader_indirect
328
+ -noaudio
329
+ -no-boot-anim
330
+ -camera-back none
331
+ -camera-front none
332
+ -timezone US/Pacific
333
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
334
+ script : detox test --configuration ci.android
0 commit comments