forked from stripe/stripe-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbitrise.yml
More file actions
599 lines (559 loc) · 17.1 KB
/
Copy pathbitrise.yml
File metadata and controls
599 lines (559 loc) · 17.1 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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
---
format_version: '11'
default_step_lib_source: 'https://github.com/bitrise-io/bitrise-steplib.git'
project_type: react-native
trigger_map:
- push_branch: 'master'
pipeline: main-trigger-pipeline
- pull_request_source_branch: '*'
pipeline: main-trigger-pipeline
app:
envs:
- NODE_VERSION: '22'
- JAVA_VERSION: '17'
- ANDROID_API_LEVEL: '33'
- MAESTRO_CLI_ANALYSIS_NOTIFICATION_DISABLED: true
- RETRY_SLEEP_FAST: 10
- RETRY_SLEEP_SLOW: 45
pipelines:
main-trigger-pipeline:
workflows:
js-tests: {}
unit-test-ios: {}
unit-test-android: {}
e2e-build-ios-old-arch: {}
e2e-tests-ios-old-arch:
depends_on: [e2e-build-ios-old-arch]
parallel: 3
e2e-build-ios-new-arch: {}
e2e-tests-ios-new-arch:
depends_on: [e2e-build-ios-new-arch]
parallel: 3
e2e-build-android-old-arch: {}
e2e-tests-android-old-arch:
depends_on: [e2e-build-android-old-arch]
parallel: 4
e2e-build-android-new-arch: {}
e2e-tests-android-new-arch:
depends_on: [e2e-build-android-new-arch]
parallel: 4
test-projects:
workflows:
expo-sdk-52: {}
expo-sdk-53: {}
expo-sdk-54: {}
rn-076: {}
rn-078: {}
rn-081: {}
rn-082: {}
workflows:
# JavaScript Tests
js-tests:
before_run:
- _prepare_js
steps:
- script@1:
title: Run TypeScript Checks
inputs:
- content: yarn typescript
- script@1:
title: Run ESLint
inputs:
- content: yarn lint
- script@1:
title: Run Jest Tests
inputs:
- content: yarn test
- script@1:
title: Run Example TypeScript Checks
inputs:
- content: cd example && yarn typescript
- deploy-to-bitrise-io@2:
inputs:
- notify_user_groups: none
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: g2.linux.medium
unit-test-ios:
envs:
- NEW_ARCH_ENABLED: true
before_run:
- _prepare_ios
steps:
- script@1:
title: Check iOS Code Formatting
inputs:
- content: |
brew install swiftlint
yarn format:ios:check
- script@1:
title: Install Pods
inputs:
- content: yarn pods
- xcode-test@4:
title: Xcode Test for iOS
inputs:
- project_path: example/ios/example.xcworkspace
- destination: platform=iOS Simulator,name=iPhone 16 Pro Max
- scheme: stripe-react-native-Unit-Tests
- log_formatter: xcbeautify
- save-cache@1:
title: Save Pods Cache
is_always_run: true
inputs:
- key: pods-{{ .Arch }}-{{ getenv "NEW_ARCH_ENABLED" }}-{{ checksum "example/ios/Podfile.lock" }}
- paths: |
example/ios/Pods
- deploy-to-bitrise-io@2:
inputs:
- notify_user_groups: none
unit-test-android:
before_run:
- _prepare_android
steps:
- script@1:
title: Check Android Code Formatting
inputs:
- content: yarn format:android:check
- script@1:
title: Check Android Lint
inputs:
- content: yarn lint:android
- android-unit-test:
inputs:
- project_location: $BITRISE_SOURCE_DIR/example/android
- module: stripe_stripe-react-native
- variant: debug
- save-gradle-cache@1:
is_always_run: true
- deploy-to-bitrise-io@2:
inputs:
- notify_user_groups: none
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: g2.linux.x-large
e2e-build-android-old-arch:
envs:
- NEW_ARCH_ENABLED: false
before_run:
- _e2e_build_android
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: g2.linux.x-large
e2e-build-android-new-arch:
envs:
- NEW_ARCH_ENABLED: true
before_run:
- _e2e_build_android
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: g2.linux.x-large
e2e-tests-android-old-arch:
envs:
- NEW_ARCH_ENABLED: false
- RCT_NEW_ARCH_ENABLED: 0
- BUILD_WORKFLOW: e2e-build-android-old-arch
- SHARD_INDEX: '${BITRISE_IO_PARALLEL_INDEX}'
- SHARD_COUNT: '${BITRISE_IO_PARALLEL_TOTAL}'
before_run:
- _e2e_tests_android
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: g2.linux.x-large
e2e-tests-android-new-arch:
envs:
- NEW_ARCH_ENABLED: true
- RCT_NEW_ARCH_ENABLED: 1
- BUILD_WORKFLOW: e2e-build-android-new-arch
- SHARD_INDEX: '${BITRISE_IO_PARALLEL_INDEX}'
- SHARD_COUNT: '${BITRISE_IO_PARALLEL_TOTAL}'
before_run:
- _e2e_tests_android
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: g2.linux.x-large
e2e-build-ios-old-arch:
envs:
- NEW_ARCH_ENABLED: false
- RCT_NEW_ARCH_ENABLED: 0
before_run:
- _e2e_build_ios
e2e-build-ios-new-arch:
envs:
- NEW_ARCH_ENABLED: true
- RCT_NEW_ARCH_ENABLED: 1
before_run:
- _e2e_build_ios
e2e-tests-ios-old-arch:
envs:
- NEW_ARCH_ENABLED: false
- RCT_NEW_ARCH_ENABLED: 0
- BUILD_WORKFLOW: e2e-build-ios-old-arch
- SHARD_INDEX: '${BITRISE_IO_PARALLEL_INDEX}'
- SHARD_COUNT: '${BITRISE_IO_PARALLEL_TOTAL}'
before_run:
- _e2e_tests_ios
e2e-tests-ios-new-arch:
envs:
- NEW_ARCH_ENABLED: true
- RCT_NEW_ARCH_ENABLED: 1
- BUILD_WORKFLOW: e2e-build-ios-new-arch
- SHARD_INDEX: '${BITRISE_IO_PARALLEL_INDEX}'
- SHARD_COUNT: '${BITRISE_IO_PARALLEL_TOTAL}'
before_run:
- _e2e_tests_ios
expo-sdk-52:
envs:
- EXPO_SDK_VERSION: '52'
before_run:
- _test_projects_base
steps:
- script@1:
title: Build Expo SDK 52 project
inputs:
- content: ./scripts/test-expo-project --sdk-version "$EXPO_SDK_VERSION"
expo-sdk-53:
envs:
- EXPO_SDK_VERSION: '53'
before_run:
- _test_projects_base
steps:
- script@1:
title: Build Expo SDK 53 project
inputs:
- content: ./scripts/test-expo-project --sdk-version "$EXPO_SDK_VERSION"
expo-sdk-54:
envs:
- EXPO_SDK_VERSION: '54'
before_run:
- _test_projects_base
steps:
- script@1:
title: Build Expo SDK 54 project
inputs:
- content: ./scripts/test-expo-project --sdk-version "$EXPO_SDK_VERSION"
rn-076:
envs:
- RN_VERSION: '0.76'
- ORG_GRADLE_JVMARGS: '-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError'
before_run:
- _test_projects_base
steps:
- script@1:
title: Build React Native 0.76 project
inputs:
- content: ./scripts/test-project --version "$RN_VERSION"
meta:
bitrise.io:
# 0.76 requires Xcode 16.4
stack: osx-xcode-16.4.x
machine_type_id: g2.mac.4large
rn-078:
envs:
- RN_VERSION: '0.78'
before_run:
- _test_projects_base
steps:
- script@1:
title: Build React Native 0.78 project
inputs:
- content: ./scripts/test-project --version "$RN_VERSION"
rn-081:
envs:
- RN_VERSION: '0.81'
before_run:
- _test_projects_base
steps:
- script@1:
title: Build React Native 0.81 project
inputs:
- content: ./scripts/test-project --version "$RN_VERSION"
rn-082:
envs:
- RN_VERSION: '0.82'
before_run:
- _test_projects_base
steps:
- script@1:
title: Build React Native 0.82 project
inputs:
- content: ./scripts/test-project --version "$RN_VERSION"
_test_projects_base:
before_run:
- _prepare_js
steps:
- set-java-version@1:
inputs:
- set_java_version: $JAVA_VERSION
_prepare_js_env:
steps:
- nvm@1:
inputs:
- node_version: $NODE_VERSION
- script@1:
title: Use Yarn v1
inputs:
- content: |
corepack disable || true
npm i -g yarn@1.22.22
YARN_CACHE_DIR="$(yarn cache dir)"
envman add --key YARN_CACHE_DIR --value "$YARN_CACHE_DIR"
- restore-cache@2:
title: Restore Yarn Cache
inputs:
- key: |
yarn-cache-{{ .OS }}-{{ .Arch }}-{{ checksum "yarn.lock" }}-{{ checksum "example/yarn.lock" }}
yarn-cache-{{ .OS }}-{{ .Arch }}-{{ checksum "yarn.lock" }}
yarn-cache-{{ .OS }}-{{ .Arch }}-
_save_js_env:
steps:
- save-cache@1:
title: Save Yarn Cache
is_always_run: true
inputs:
- key: yarn-cache-{{ .OS }}-{{ .Arch }}-{{ checksum "yarn.lock" }}-{{ checksum "example/yarn.lock" }}
- paths: |
$YARN_CACHE_DIR
_prepare_js:
before_run:
- _prepare_js_env
after_run:
- _save_js_env
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@8: {}
- yarn@0:
title: Install Dependencies (No Pods)
inputs:
- command: bootstrap-no-pods
_prepare_ios:
before_run:
- _prepare_js_env
after_run:
- _save_js_env
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@8: {}
# - restore-cache@2:
# title: Restore Pods Cache
# inputs:
# - key: pods-{{ .Arch }}-{{ getenv "NEW_ARCH_ENABLED" }}-{{ checksum "example/ios/Podfile.lock" }}
- activate-build-cache-for-xcode: {}
- yarn@0:
title: Bootstrap Project
inputs:
- command: bootstrap-no-pods
_prepare_android:
before_run:
- _prepare_js_env
after_run:
- _save_js_env
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@8: {}
- restore-gradle-cache@2: {}
- yarn@0:
title: Install Dependencies (No Pods)
inputs:
- command: bootstrap-no-pods
- set-java-version@1:
inputs:
- set_java_version: $JAVA_VERSION
_start_android_emulator:
steps:
- avd-manager@2:
inputs:
- profile: 'pixel_6'
- abi: 'x86_64'
- api_level: $ANDROID_API_LEVEL
- tag: 'google_apis'
- start_command_flags: >
-camera-back none
-camera-front none
-netdelay none
-netspeed full
-memory 8192
-no-snapshot
-no-audio
-no-window
-gpu swiftshader_indirect
-no-boot-anim
_e2e_build_android:
before_run:
- _prepare_android
steps:
- script@1:
title: Build Android App
timeout: 1200
inputs:
- content: |
cd example/android
yarn build:android
./gradlew assembleRelease -PnewArchEnabled=$NEW_ARCH_ENABLED -PreactNativeArchitectures=x86_64 --no-daemon --build-cache --no-scan
- save-gradle-cache@1:
is_always_run: true
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_SOURCE_DIR/example/android/app/build/outputs/apk/release/app-release.apk:APK'
_e2e_tests_android:
before_run:
- _start_android_emulator
after_run:
# TODO: Reenable this once we have the webhook urls on bitrise.
# - _notify_e2e_failure
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@8: {}
- pull-intermediate-files@1:
inputs:
- artifact_sources: $BUILD_WORKFLOW
- script@1:
title: Install Maestro CLI
inputs:
- content: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "${HOME}/.maestro/bin" >> $BITRISE_STEP_SOURCE_DIR/envs.txt
- wait-for-android-emulator@1:
inputs:
- boot_timeout: 600
- script@1:
title: Install APK
inputs:
- content: adb install -r "$APK"
- script@1:
title: Run E2E Tests
timeout: 2400
inputs:
- content: |
export PATH="${HOME}/.maestro/bin:$PATH"
yarn test:e2e:android --record-on-failure
- deploy-to-bitrise-io@2:
is_always_run: true
inputs:
- notify_user_groups: none
- deploy_path: e2e-artifacts
- is_compress: true
_e2e_build_ios:
before_run:
- _prepare_ios
steps:
# Note this must run before installing pods.
- script@1:
title: Build App JS Bundle
inputs:
- content: yarn example build:ios
- script@1:
title: Install Pods
inputs:
- content: yarn pods
- script@1:
title: Build iOS App (Release, Simulator)
timeout: 1800
inputs:
- content: |
set -euo pipefail
cd "$BITRISE_SOURCE_DIR/example/ios"
OUT_DIR="$BITRISE_SOURCE_DIR/xcb-out/Release-iphonesimulator"
mkdir -p "$OUT_DIR"
DERIVED_DATA_PATH="$BITRISE_SOURCE_DIR/DerivedData"
xcodebuild -workspace example.xcworkspace \
-scheme example \
-configuration Release \
-sdk iphonesimulator \
-derivedDataPath "$DERIVED_DATA_PATH" \
build | xcbeautify
APP_ROOT="$DERIVED_DATA_PATH/Build/Products/Release-iphonesimulator"
APP_DIR="$APP_ROOT/ReactTestApp.app"
ZIP_OUT="$BITRISE_SOURCE_DIR/app-release.app.zip"
mkdir -p "$(dirname "$ZIP_OUT")"
( cd "$APP_ROOT" && zip -qr "$ZIP_OUT" "$(basename "$APP_DIR")" )
- save-cache@1:
title: Save Pods Cache
is_always_run: true
inputs:
- key: pods-{{ .Arch }}-{{ getenv "NEW_ARCH_ENABLED" }}-{{ checksum "example/ios/Podfile.lock" }}
- paths: |
example/ios/Pods
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: '$BITRISE_SOURCE_DIR/app-release.app.zip:IOS_APP_ZIP'
_e2e_tests_ios:
before_run:
- _prepare_ios
after_run:
# TODO: Reenable this once we have the webhook urls on bitrise.
# - _notify_e2e_failure
steps:
- pull-intermediate-files@1:
inputs:
- artifact_sources: $BUILD_WORKFLOW
- script@1:
title: Unzip .app and Install to Simulator
inputs:
- content: |
set -euo pipefail
# Unzip app.
OUT="$BITRISE_SOURCE_DIR/ios-artifact"
mkdir -p "$OUT"
unzip -q "$IOS_APP_ZIP" -d "$OUT"
IOS_APP="$(find "$OUT" -maxdepth 2 -type d -name "*.app" | head -n 1)"
# Boot and wait for simulator.
DEVICE_UUID=$(xcrun simctl list devices "18.6" | grep "iPhone 16 Pro Max" | grep -oE '([A-F0-9-]{36})')
xcrun simctl bootstatus "$DEVICE_UUID" -b
# Install app.
xcrun simctl install booted "$IOS_APP"
- script@1:
title: Install Maestro CLI
inputs:
- content: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "${HOME}/.maestro/bin" >> $BITRISE_STEP_SOURCE_DIR/envs.txt
- script@1:
title: Run iOS E2E Tests (Maestro)
timeout: 2400
inputs:
- content: |
export PATH="${HOME}/.maestro/bin:$PATH"
yarn test:e2e:ios --record-on-failure
- deploy-to-bitrise-io@2:
is_always_run: true
inputs:
- notify_user_groups: none
- deploy_path: e2e-artifacts
- is_compress: true
_notify_e2e_failure:
steps:
- slack@3:
is_always_run: true
run_if: '{{getenv "FINANCIAL_CONNECTIONS_TESTS_FAILED" | eq "true"}}'
inputs:
- webhook_url: $SLACK_LINK_MOBILE_ALERT_CHANNEL_WEBHOOK_URL
- text: |
🚨 *Financial Connections Tests Failed*
Platform: $BITRISE_PLATFORM
Architecture: $NEW_ARCH_ENABLED
Shard: $SHARD_INDEX
Build: $BITRISE_BUILD_URL
- slack@3:
is_always_run: true
run_if: '.IsBuildFailed && {{getenv "BITRISE_GIT_BRANCH" | eq "master"}}'
inputs:
- webhook_url: $SLACK_RUN_CHANNEL_WEBHOOK_URL
- text: |
*Nightly Build Failed*
Platform: $BITRISE_PLATFORM
Build: $BITRISE_BUILD_URL
meta:
bitrise.io:
stack: osx-xcode-26.0.x
machine_type_id: g2.mac.4large