@@ -13,7 +13,14 @@ concurrency:
13
13
14
14
env :
15
15
SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_AUTH_TOKEN }}
16
+ MAESTRO_VERSION : ' 1.39.0'
16
17
RN_SENTRY_POD_NAME : RNSentry
18
+ IOS_APP_ARCHIVE_PATH : sentry-react-native-sample.app.zip
19
+ ANDROID_APP_ARCHIVE_PATH : sentry-react-native-sample.apk.zip
20
+ REACT_NATIVE_SAMPLE_PATH : samples/react-native
21
+ IOS_DEVICE : ' iPhone 16'
22
+ IOS_VERSION : ' 18.1'
23
+ ANDROID_API_LEVEL : ' 30'
17
24
18
25
jobs :
19
26
diff_check :
66
73
- uses : ruby/setup-ruby@v1
67
74
if : ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
68
75
with :
69
- working-directory : ${{ matrix.platform == 'ios' && ' samples/react-native' || ' samples/react-native-macos' }}
76
+ working-directory : ${{ matrix.platform == 'ios' && env.REACT_NATIVE_SAMPLE_PATH || ' samples/react-native-macos' }}
70
77
ruby-version : ' 3.3.0' # based on what is used in the sample
71
78
bundler-cache : true # runs 'bundle install' and caches installed gems automatically
72
79
cache-version : 1 # cache the installed gems
@@ -106,7 +113,7 @@ jobs:
106
113
107
114
- name : Build Android App
108
115
if : ${{ matrix.platform == 'android' }}
109
- working-directory : samples/react-native /android
116
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} /android
110
117
run : |
111
118
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
112
119
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
@@ -119,11 +126,14 @@ jobs:
119
126
fi
120
127
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
121
128
echo "Building $CONFIG"
129
+ [[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
130
+ echo "Building $TEST_TYPE"
131
+
122
132
./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
123
133
124
134
- name : Build iOS App
125
135
if : ${{ matrix.platform == 'ios' }}
126
- working-directory : samples/react-native /ios
136
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} /ios
127
137
run : |
128
138
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
129
139
echo "Building $CONFIG"
@@ -160,9 +170,153 @@ jobs:
160
170
| tee xcodebuild.log \
161
171
| xcbeautify --quieter --is-ci --disable-colored-output
162
172
173
+ - name : Archive iOS App
174
+ if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
175
+ run : |
176
+ cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
177
+ zip -r \
178
+ ${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
179
+ sentryreactnativesample.app
180
+
181
+ - name : Archive Android App
182
+ if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
183
+ run : |
184
+ mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
185
+ zip -j \
186
+ ${{ env.ANDROID_APP_ARCHIVE_PATH }} \
187
+ app.apk
188
+
189
+ - name : Upload iOS APP
190
+ if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
191
+ uses : actions/upload-artifact@v4
192
+ with :
193
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
194
+ path : ${{ env.IOS_APP_ARCHIVE_PATH }}
195
+ retention-days : 1
196
+
197
+ - name : Upload Android APK
198
+ if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
199
+ uses : actions/upload-artifact@v4
200
+ with :
201
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
202
+ path : ${{ env.ANDROID_APP_ARCHIVE_PATH }}
203
+ retention-days : 1
204
+
163
205
- name : Upload logs
164
206
if : ${{ always() }}
165
207
uses : actions/upload-artifact@v4
166
208
with :
167
209
name : build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
168
- path : samples/react-native/${{ matrix.platform }}/*.log
210
+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
211
+
212
+ test :
213
+ name : Test ${{ matrix.platform }} ${{ matrix.build-type }}
214
+ runs-on : ${{ matrix.runs-on }}
215
+ needs : [diff_check, build]
216
+ if : ${{ needs.diff_check.outputs.skip_ci != 'true' }}
217
+ strategy :
218
+ # we want that the matrix keeps running, default is to cancel them if it fails.
219
+ fail-fast : false
220
+ matrix :
221
+ include :
222
+ - platform : ios
223
+ runs-on : macos-15
224
+ rn-architecture : ' new'
225
+ ios-use-frameworks : ' no-frameworks'
226
+ build-type : ' production'
227
+
228
+ - platform : android
229
+ runs-on : ubuntu-latest
230
+ rn-architecture : ' new'
231
+ build-type : ' production'
232
+
233
+ steps :
234
+ - uses : actions/checkout@v4
235
+
236
+ - name : Install Maestro
237
+ uses :
dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # [email protected]
238
+ with :
239
+ version : ${{env.MAESTRO_VERSION}}
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
+
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 : Setup KVM
279
+ if : ${{ matrix.platform == 'android' }}
280
+ shell : bash
281
+ run : |
282
+ # check if virtualization is supported...
283
+ sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
284
+ # allow access to KVM to run the emulator
285
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
286
+ | sudo tee /etc/udev/rules.d/99-kvm4all.rules
287
+ sudo udevadm control --reload-rules
288
+ sudo udevadm trigger --name-match=kvm
289
+
290
+ - name : Boot ${{ env.IOS_DEVICE }} with iOS ${{ env.IOS_VERSION }}
291
+ uses : futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
292
+ if : ${{ matrix.platform == 'ios' }}
293
+ with :
294
+ model : ${{ env.IOS_DEVICE }}
295
+ os_version : ${{ env.IOS_VERSION }}
296
+
297
+ - name : Run iOS Tests
298
+ if : ${{ matrix.platform == 'ios' }}
299
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
300
+ run : yarn test-ios
301
+
302
+ - name : Run Android Tests on API ${{ env.ANDROID_API_LEVEL }}
303
+ if : ${{ matrix.platform == 'android' }}
304
+ uses :
reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # [email protected]
305
+ with :
306
+ api-level : ${{ env.ANDROID_API_LEVEL }}
307
+ force-avd-creation : false
308
+ disable-animations : true
309
+ disable-spellchecker : true
310
+ target : ' aosp_atd'
311
+ channel : canary # Necessary for ATDs
312
+ emulator-options : >
313
+ -no-window
314
+ -no-snapshot-save
315
+ -gpu swiftshader_indirect
316
+ -noaudio
317
+ -no-boot-anim
318
+ -camera-back none
319
+ -camera-front none
320
+ -timezone US/Pacific
321
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
322
+ script : yarn test-android
0 commit comments