-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathconfig.yml
More file actions
464 lines (442 loc) · 13.7 KB
/
Copy pathconfig.yml
File metadata and controls
464 lines (442 loc) · 13.7 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
version: 2.1
orbs:
rn: react-native-community/react-native@8.0.1
android: circleci/android@3.1.0
revenuecat: revenuecat/sdks-common-config@3.16.0
aliases:
release-tags: &release-tags
filters:
tags:
ignore: /^.*-SNAPSHOT/
branches:
ignore: /.*/
release-branches: &release-branches
filters:
tags:
ignore: /.*/
branches:
only: /^release\/.*/
only-main-branch: &only-main-branch
filters:
tags:
ignore: /.*/
branches:
only: main
base-mac-job: &base-mac-job
executor:
name: rn/macos
resource_class: m4pro.medium
xcode_version: '15.4'
base-mac-job-xcode-16: &base-mac-job-xcode-16
executor:
name: rn/macos
resource_class: m4pro.medium
xcode_version: '16.4'
parameters:
action:
type: enum
enum: [build, upgrade-hybrid-common, bump]
default: build
version:
type: string
default: ''
automatic:
type: boolean
default: false
commands:
# rn/ios_build depends on a specific cache key, so we need to create a custom step to install dependencies
# we could use rn/yarn_install but that's not compatible with yarn 2
install-dependencies-ios-build:
steps:
- run:
name: Create cache checksum file
command: |
mkdir -p ~/.tmp/checksumfiles
find . -type f -name 'package.json' -not -path "*node_modules*" -exec cat {} + >> ~/.tmp/checksumfiles/package.json
find . -type f -name 'yarn.lock' -not -path "*node_modules*" -exec cat {} + >> ~/.tmp/checksumfiles/yarn.lock
- restore_cache:
keys:
- yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}-{{ .Environment.CACHE_VERSION }}
- run:
name: Yarn Install
command: yarn
- save_cache:
key: yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}-{{ .Environment.CACHE_VERSION }}
paths:
- .yarn/cache
install-dependencies:
parameters:
machine:
type: string
steps:
- restore_cache:
keys:
- yarn-v2-<<parameters.machine>>-{{ checksum "yarn.lock" }}
- run:
name: Yarn Install
command: yarn
- save_cache:
key: yarn-v2-<<parameters.machine>>-{{ checksum "yarn.lock" }}
paths:
- .yarn/cache
copy-npm-rc:
steps:
- run:
name: Copy npmrc sample file to final location
command: cp .npmrc.SAMPLE .npmrc
install-ruby-3-2-0:
steps:
- run:
name: Set Ruby 3.2.0
command: |
eval "$(rbenv init -)"
rbenv install -s 3.2.0
rbenv global 3.2.0
rbenv rehash
jobs:
analyse_js:
executor:
name: rn/linux_js
node_version: '18.2'
steps:
- checkout
- install-dependencies:
machine: "unix"
- run:
name: Prepare package
command: yarn prepare
- run:
name: Prepare UI package
working_directory: react-native-purchases-ui
command: yarn prepare
- run:
name: Tests
command: yarn test
- run:
name: API Tests
command: yarn tsc -p apitesters
- run:
name: UI API Tests
command: yarn workspace react-native-purchases-ui apitest
- run:
name: UI Tests
command: yarn workspace react-native-purchases-ui test
- run:
name: Linter
command: yarn run tslint
expo_ios:
<<: *base-mac-job-xcode-16
steps:
- checkout
- rn/ios_simulator_start:
device: iPhone 16
- install-dependencies-ios-build
- run:
name: Install Expo CLI
command: npm install -g expo-cli
- run:
name: Prepare packages for Expo
command: yarn prepare-expo
- run:
name: Install dependencies for Expo app
working_directory: examples/purchaseTesterExpo
command: yarn install
- run:
name: Generate iOS project
working_directory: examples/purchaseTesterExpo
command: npx expo prebuild --platform ios --no-install
- revenuecat/install-gem-mac-dependencies:
cache-version: expo-v2
working_directory: examples/purchaseTesterExpo
- rn/pod_install:
cache: false
pod_install_directory: examples/purchaseTesterExpo/ios
pod_install_command: pod install --repo-update
- run:
name: Build iOS Expo app
working_directory: examples/purchaseTesterExpo
command: |
xcodebuild -workspace ios/purchaseTesterExpo.xcworkspace -scheme purchaseTesterExpo -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 16' -derivedDataPath ~/DerivedData -UseModernBuildSystem=YES
expo_android:
executor:
name: rn/linux_android
resource_class: xlarge
build_image_version: latest
steps:
- checkout
- install-dependencies:
machine: "unix"
- run:
name: Install Expo CLI
command: npm install -g expo-cli
- run:
name: Prepare packages for Expo
command: yarn prepare-expo
- run:
name: Install dependencies for Expo app
working_directory: examples/purchaseTesterExpo
command: yarn install
- run:
name: Prebuild Android Expo app
working_directory: examples/purchaseTesterExpo
command: |
npx expo prebuild --platform android --no-install
- run:
name: Build Android Expo app
working_directory: examples/purchaseTesterExpo/android
command: |
export GRADLE_OPTS="-Xmx4096m -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=\"-Xmx4096m\""
./gradlew assembleDebug
expo_web:
executor:
name: rn/linux_js
node_version: '22.14.0'
steps:
- checkout
- install-dependencies:
machine: "unix"
- run:
name: Install Expo CLI
command: npm install -g expo-cli
- run:
name: Prepare packages for Expo
command: yarn prepare-expo
- run:
name: Install dependencies for Expo app
working_directory: examples/purchaseTesterExpo
command: yarn install
- run:
name: Build Web Expo app
working_directory: examples/purchaseTesterExpo
command: |
npx expo export --platform web
docs-deploy:
<<: *base-mac-job
steps:
- checkout
- install-ruby-3-2-0
- install-dependencies:
machine: "macos"
- revenuecat/install-gem-mac-dependencies:
cache-version: v2
- revenuecat/setup-git-credentials
- run:
name: Build docs
command: bundle exec fastlane generate_docs
android:
executor:
name: rn/linux_android
# These are the default options in the orb, but with more memory because we were getting out of memory errors
gradle_options: >-
-Xmx4096m -Dorg.gradle.daemon=false
-Dorg.gradle.jvmargs="-XX:+UnlockExperimentalVMOptions
-XX:+HeapDumpOnOutOfMemoryError"
-Dorg.gradle.jvmargs="-Xmx4096m -XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport"
resource_class: xlarge
build_image_version: latest
steps:
- checkout
- install-dependencies:
machine: "unix"
- rn/android_build:
project_path: examples/purchaseTesterTypescript/android
ios:
<<: *base-mac-job
steps:
- checkout
- rn/ios_simulator_start:
device: iPhone 15
- install-ruby-3-2-0
- install-dependencies-ios-build
- revenuecat/trust-github-key
- revenuecat/setup-git-credentials
- revenuecat/install-gem-mac-dependencies:
cache-version: v2
- run:
name: Pod Install
command: bundle exec fastlane pod_install_and_update_if_needed
- run:
name: Build iOS
# Using command directly instead of rn/ios_build to avoid the using xcpretty which is not installed by default.
command: |
export RCT_NO_LAUNCH_PACKAGER=true \
&& xcodebuild -workspace examples/purchaseTesterTypescript/ios/PurchaseTester.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 15' -scheme 'PurchaseTester' -parallelizeTargets -configuration Release -derivedDataPath ~/DerivedData -UseModernBuildSystem=YES
make-release:
description: "Publishes the new version and creates a github release"
<<: *base-mac-job
steps:
- checkout
- install-ruby-3-2-0
- install-dependencies:
machine: "macos"
- revenuecat/install-gem-mac-dependencies:
cache-version: v2
- revenuecat/trust-github-key
- copy-npm-rc
- run:
name: release
command: bundle exec fastlane release
run-maestro-e2e-tests-ios:
executor:
name: rn/macos
resource_class: m4pro.medium
xcode_version: '26.3'
steps:
- checkout
- install-ruby-3-2-0
- install-dependencies:
machine: "macos"
- revenuecat/install-gem-mac-dependencies:
cache-version: v2
- revenuecat/install-maestro
- run:
name: Boot iOS Simulator
command: |
xcrun simctl boot "iPhone 17" || true
xcrun simctl bootstatus "iPhone 17" -b
- run:
name: Run Maestro E2E Tests (iOS)
command: bundle exec fastlane run_maestro_e2e_tests_ios
no_output_timeout: 15m
- store_test_results:
path: fastlane/test_output
- store_artifacts:
path: fastlane/test_output
run-maestro-e2e-tests-android:
machine:
image: android:2024.11.1
resource_class: xlarge
steps:
- checkout
- run:
name: Install Ruby and Bundler
command: |
gem install bundler
bundle install
- install-dependencies:
machine: "unix"
- run:
name: Build Maestro app (Android)
command: bundle exec fastlane build_maestro_app_android
no_output_timeout: 15m
- android/create_avd:
avd_name: test-e2e
system_image: system-images;android-34;google_apis;x86_64
install: true
- android/start_emulator:
avd_name: test-e2e
post_emulator_launch_assemble_command: ""
- revenuecat/install-maestro
- run:
name: Run Maestro E2E Tests (Android)
command: bundle exec fastlane run_maestro_e2e_tests_android
no_output_timeout: 15m
- store_test_results:
path: fastlane/test_output
- store_artifacts:
path: fastlane/test_output
update-hybrid-common-versions:
description: "Creates a PR updating purchases-hybrid-common to latest release"
<<: *base-mac-job
steps:
- checkout
- install-ruby-3-2-0
- revenuecat/install-gem-mac-dependencies:
cache-version: v2
- revenuecat/trust-github-key
- revenuecat/setup-git-credentials
- run:
name: Updating to next version of phc
command: |
bundle exec fastlane update_hybrid_common \
version:<< pipeline.parameters.version >> \
open_pr:true \
automatic_release:<< pipeline.parameters.automatic >>
workflows:
build-test-hold-deploy:
when:
and:
- not:
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
- not:
equal: [ bump, << pipeline.parameters.action >> ]
jobs:
# Testing phase - runs on all branches
- analyse_js
- android
- ios
- expo_android
- expo_ios
- expo_web
- run-maestro-e2e-tests-ios:
context:
- maestro-e2e-tests
- e2e-tests
- run-maestro-e2e-tests-android:
context:
- maestro-e2e-tests
- e2e-tests
# Hold and deploy phase - only on release branches
- hold:
type: approval
requires:
- analyse_js
- android
- ios
<<: *release-branches
- revenuecat/tag-current-branch:
requires:
- hold
<<: *release-branches
- make-release:
<<: *release-tags
- docs-deploy:
<<: *release-tags
requires:
- make-release
- revenuecat/merge-release-pr:
repo_name: react-native-purchases
requires:
- docs-deploy
<<: *release-tags
danger:
when:
not:
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
jobs:
- revenuecat/danger
weekly-run-workflow:
when:
and:
- equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
- equal: [ "release-train", << pipeline.schedule.name >> ]
jobs:
- revenuecat/automatic-bump
manual-trigger-bump:
when:
equal: [ bump, << pipeline.parameters.action >> ]
jobs:
- revenuecat/automatic-bump
maestro-e2e-tests-ios:
when:
or:
- equal: ["maestro_e2e_tests", << pipeline.schedule.name >>]
jobs:
- run-maestro-e2e-tests-ios:
context:
- maestro-e2e-tests
- e2e-tests
maestro-e2e-tests-android:
when:
or:
- equal: ["maestro_e2e_tests", << pipeline.schedule.name >>]
jobs:
- run-maestro-e2e-tests-android:
context:
- maestro-e2e-tests
- e2e-tests
update-hybrid-common-versions:
when:
equal: [ upgrade-hybrid-common, << pipeline.parameters.action >> ]
jobs:
- update-hybrid-common-versions