-
-
Notifications
You must be signed in to change notification settings - Fork 360
447 lines (383 loc) · 15.9 KB
/
sample-application.yml
File metadata and controls
447 lines (383 loc) · 15.9 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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
name: Sample Application
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
MAESTRO_VERSION: '2.3.0'
MAESTRO_DRIVER_STARTUP_TIMEOUT: 180000 # Increase timeout from default 30s to 180s for CI stability
RN_SENTRY_POD_NAME: RNSentry
IOS_APP_ARCHIVE_PATH: sentry-react-native-sample.app.zip
ANDROID_APP_ARCHIVE_PATH: sentry-react-native-sample.apk.zip
REACT_NATIVE_SAMPLE_PATH: samples/react-native
IOS_DEVICE: 'iPhone 16'
IOS_VERSION: '>=18.0'
ANDROID_API_LEVEL: '30'
jobs:
ready-to-merge-gate:
name: Ready-to-merge gate
uses: ./.github/workflows/ready-to-merge-workflow.yml
with:
is-pr: ${{ github.event_name == 'pull_request' }}
labels: ${{ toJson(github.event.pull_request.labels) }}
diff_check:
needs: [ready-to-merge-gate]
uses: ./.github/workflows/skip-ci.yml
detect-changes:
needs: [ready-to-merge-gate]
uses: ./.github/workflows/detect-changes.yml
with:
caller_event_name: ${{ github.event_name }}
caller_ref: ${{ github.ref }}
build-ios:
name: Build ${{ matrix.rn-architecture }} ios ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks }}
runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2.0", "runner_group_id:10"]
needs: [diff_check, detect-changes]
if: >-
${{
needs.diff_check.outputs.skip_ci != 'true'
&& needs.detect-changes.outputs.needs_sample_react_native == 'true'
&& (needs.detect-changes.outputs.sample_react_native == 'true' || needs.detect-changes.outputs.needs_ios == 'true')
}}
env:
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
strategy:
fail-fast: false
matrix:
rn-architecture: ['new']
ios-use-frameworks: ['no-frameworks']
build-type: ['dev', 'production']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
package-manager-cache: false
node-version: 22
cache: 'yarn'
cache-dependency-path: yarn.lock
- uses: ruby/setup-ruby@v1
with:
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
ruby-version: '3.3.0' # based on what is used in the sample
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 1 # cache the installed gems
- name: Setup Global Xcode Tools
run: which xcbeautify || brew install xcbeautify
- name: Install SDK Dependencies
run: yarn install
- name: Build SDK
run: yarn build
- name: Install App Pods
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: |
[[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
[[ "${{ matrix.rn-architecture }}" == "new" ]] && export ENABLE_NEW_ARCH=1 || export ENABLE_NEW_ARCH=0
[[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
./scripts/pod-install.sh
- name: Build iOS App
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
env:
# Fix for Xcode 26+ with MetalToolchain: use default Xcode toolchain to avoid
# missing Swift compatibility libraries (swiftCompatibility56, etc.)
# See: https://github.com/actions/runner-images/issues/13135
TOOLCHAINS: com.apple.dt.toolchain.XcodeDefault
run: |
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
./scripts/set-dsn-ios.mjs
./scripts/build-ios.sh
- name: Archive iOS App
if: ${{ matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: |
zip -r \
${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
sentryreactnativesample.app
- name: Upload iOS APP
if: ${{ matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
uses: actions/upload-artifact@v7
with:
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-ios
path: ${{ env.IOS_APP_ARCHIVE_PATH }}
retention-days: 1
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: build-sample-${{ matrix.rn-architecture }}-ios-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/*.log
build-android:
name: Build ${{ matrix.rn-architecture }} android ${{ matrix.build-type }}
runs-on: ubuntu-latest
needs: [diff_check, detect-changes]
if: >-
${{
needs.diff_check.outputs.skip_ci != 'true'
&& needs.detect-changes.outputs.needs_sample_react_native == 'true'
&& (needs.detect-changes.outputs.sample_react_native == 'true' || needs.detect-changes.outputs.needs_android == 'true')
}}
env:
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
strategy:
fail-fast: false
matrix:
rn-architecture: ['new']
build-type: ['dev', 'production']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Enable Corepack (NPM)
run: npm i -g corepack
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
package-manager-cache: false
node-version: 22
cache: 'yarn'
cache-dependency-path: yarn.lock
- uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'adopt'
- name: Gradle cache
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v3.5.0
- name: Install SDK Dependencies
run: yarn install
- name: Build SDK
run: yarn build
- name: Build Android App
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: |
export RN_ARCHITECTURE="${{ matrix.rn-architecture }}"
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'
./scripts/set-dsn-aos.mjs
./scripts/build-android.sh -PreactNativeArchitectures=x86
- name: Archive Android App
if: ${{ matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
run: |
zip -j \
${{ env.ANDROID_APP_ARCHIVE_PATH }} \
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app.apk \
${{ env.REACT_NATIVE_SAMPLE_PATH }}/app-androidTest.apk
- name: Upload Android APK
if: ${{ matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
uses: actions/upload-artifact@v7
with:
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-android
path: ${{ env.ANDROID_APP_ARCHIVE_PATH }}
retention-days: 1
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: build-sample-${{ matrix.rn-architecture }}-android-${{ matrix.build-type }}-no-frameworks-logs
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/*.log
build-macos:
name: Build legacy macos ${{ matrix.build-type }}
runs-on: ["ghcr.io/cirruslabs/macos-sequoia-xcode:16.4", "runner_group_id:10"]
needs: [diff_check, detect-changes]
if: >-
${{
needs.diff_check.outputs.skip_ci != 'true'
&& needs.detect-changes.outputs.needs_sample_react_native == 'true'
&& (needs.detect-changes.outputs.sample_react_native == 'true' || needs.detect-changes.outputs.needs_ios == 'true')
}}
env:
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
strategy:
fail-fast: false
matrix:
build-type: ['dev', 'production']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
package-manager-cache: false
node-version: 22
cache: 'yarn'
cache-dependency-path: yarn.lock
- uses: ruby/setup-ruby@v1
with:
working-directory: samples/react-native-macos
ruby-version: '3.3.0' # based on what is used in the sample
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 1 # cache the installed gems
- name: Setup Global Xcode Tools
run: which xcbeautify || brew install xcbeautify
- name: Install SDK Dependencies
run: yarn install
- name: Build SDK
run: yarn build
- name: Install App Pods
working-directory: samples/react-native-macos
run: |
[[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
export ENABLE_NEW_ARCH=0
./scripts/pod-install.sh
- name: Build macOS App
working-directory: samples/react-native-macos/macos
run: |
[[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
echo "Building $CONFIG"
mkdir -p "DerivedData"
derivedData="$(cd "DerivedData" ; pwd -P)"
set -o pipefail && xcodebuild \
-workspace sentry-react-native-sample.xcworkspace \
-configuration "$CONFIG" \
-scheme sentry-react-native-sample-macOS \
-destination 'platform=macOS' \
ONLY_ACTIVE_ARCH=yes \
-derivedDataPath "$derivedData" \
build \
| tee xcodebuild.log \
| xcbeautify --quieter --is-ci --disable-colored-output
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: build-sample-legacy-macos-${{ matrix.build-type }}-no-frameworks-logs
path: samples/react-native-macos/macos/*.log
test-ios:
name: Test ios production REV2
runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2.0", "runner_group_id:10"]
needs: [diff_check, detect-changes, build-ios]
if: >-
${{
needs.diff_check.outputs.skip_ci != 'true'
&& needs.detect-changes.outputs.needs_sample_react_native == 'true'
&& (needs.detect-changes.outputs.sample_react_native == 'true' || needs.detect-changes.outputs.needs_ios == 'true')
}}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Maestro
uses: dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # pin@v1.0.0
with:
version: ${{env.MAESTRO_VERSION}}
- name: Download iOS App Archive
uses: actions/download-artifact@v8
with:
name: sample-rn-new-production-no-frameworks-ios
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
- name: Unzip iOS App Archive
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: unzip ${{ env.IOS_APP_ARCHIVE_PATH }}
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
package-manager-cache: false
node-version: 22
cache: 'yarn'
cache-dependency-path: yarn.lock
- name: Install JS Dependencies
run: yarn install
- name: Boot ${{ env.IOS_DEVICE }} with iOS ${{ env.IOS_VERSION }}
uses: futureware-tech/simulator-action@e89aa8f93d3aec35083ff49d2854d07f7186f7f5 # pin@v5
with:
model: ${{ env.IOS_DEVICE }}
os_version: ${{ env.IOS_VERSION }}
wait_for_boot: true
erase_before_boot: false
- name: Wait for iOS simulator to be fully ready
run: |
xcrun simctl bootstatus booted -b
xcrun simctl launch booted com.apple.Preferences
sleep 5
xcrun simctl terminate booted com.apple.Preferences
- name: Warm up Maestro driver on iOS
continue-on-error: true
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: |
xcrun simctl install booted sentryreactnativesample.app
WARMUP=$(mktemp /tmp/maestro-warmup-XXXXXX.yml)
cat > "$WARMUP" << 'YML'
appId: io.sentry.reactnative.sample
---
- launchApp:
clearState: true
- extendedWaitUntil:
visible: "Sentry React Native Sample"
timeout: 120000
- killApp
YML
sed -i '' 's/^ //' "$WARMUP"
maestro test "$WARMUP" || true
rm -f "$WARMUP"
- name: Run iOS Tests
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: yarn test-ios
test-android:
name: Test android production REV2
runs-on: ubuntu-latest
needs: [diff_check, detect-changes, build-android]
if: >-
${{
needs.diff_check.outputs.skip_ci != 'true'
&& needs.detect-changes.outputs.needs_sample_react_native == 'true'
&& (needs.detect-changes.outputs.sample_react_native == 'true' || needs.detect-changes.outputs.needs_android == 'true')
}}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Maestro
uses: dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # pin@v1.0.0
with:
version: ${{env.MAESTRO_VERSION}}
- name: Download Android APK
uses: actions/download-artifact@v8
with:
name: sample-rn-new-production-android
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
- name: Unzip Android APK
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: |
unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
rm app-androidTest.apk
- name: Enable Corepack (NPM)
run: npm i -g corepack
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
package-manager-cache: false
node-version: 22
cache: 'yarn'
cache-dependency-path: yarn.lock
- name: Install JS Dependencies
run: yarn install
- uses: ./.github/actions/disk-cleanup
- name: Setup KVM
shell: bash
run: |
# check if virtualization is supported...
sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
# allow access to KVM to run the emulator
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Run Android Tests on API ${{ env.ANDROID_API_LEVEL }}
uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # pin@v2.37.0
with:
api-level: ${{ env.ANDROID_API_LEVEL }}
force-avd-creation: false
disable-animations: true
disable-spellchecker: true
target: 'aosp_atd'
channel: canary # Necessary for ATDs
disk-size: 4096M
emulator-options: >
-no-window
-no-snapshot-save
-gpu swiftshader_indirect
-noaudio
-no-boot-anim
-camera-back none
-camera-front none
-timezone US/Pacific
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
script: yarn test-android