-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacked-orb.yml
1264 lines (1264 loc) · 46.8 KB
/
packed-orb.yml
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
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
commands:
android_build:
description: Builds the Android app at the given path with the given build types. This should be run only after installing dependencies.
parameters:
build_type:
default: release
description: The build type to build. This is normally either "debug" or "release" but you may have custom build types configured for your app.
type: string
bundle_type:
default: aab
description: The type of app to bundle, either 'aab' (Android App Bundles) or 'apk'. Google's recommendation is aab, which is the default.
enum:
- aab
- apk
type: enum
project_path:
default: ./android
description: The path to the root of the Android project you want to build, relative to the root of the repository.
type: string
steps:
- run:
command: |
mkdir -p ~/.tmp/checksumfiles
find . -type f -name 'build.gradle' -not -path "*node_modules*" -exec cat {} + >> ~/.tmp/checksumfiles/build.gradle
find . -type f -name 'settings.gradle' -not -path "*node_modules*" -exec cat {} + >> ~/.tmp/checksumfiles/settings.gradle
name: Create cache checksum files
- restore_cache:
keys:
- gradle-wrapper-{{ arch }}-{{ checksum "<<parameters.project_path>>/gradle/wrapper/gradle-wrapper.properties" }}-{{ .Environment.CACHE_VERSION }}
- restore_cache:
keys:
- gradle-home-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/build.gradle" }}-{{ checksum "~/.tmp/checksumfiles/settings.gradle" }}-{{ .Environment.CACHE_VERSION }}
- restore_cache:
keys:
- gradle-build-cache-{{ .Revision }}
name: Restoring Gradle Build caches
- run:
command: |
[ -d ~/gradle-build-caches ] &&
[ -n "$(ls -A ~/gradle-build-caches)" ] &&
rm -rf ~/.gradle/caches/build-cache-* &&
mkdir -p ~/.gradle/caches/ &&
mv ~/gradle-build-caches/* ~/.gradle/caches/ || true
name: Dispersing Gradle Build caches for restoring
- run:
command: |
cd <<parameters.project_path>>
chmod +x gradlew
./gradlew --max-workers 2 downloadDependencies
name: Downloading Gradle Dependencies
- save_cache:
key: gradle-wrapper-{{ arch }}-{{ checksum "<<parameters.project_path>>/gradle/wrapper/gradle-wrapper.properties" }}-{{ .Environment.CACHE_VERSION }}
name: Saving Gradle wrapper cache
paths:
- ~/.gradle/wrapper/
- save_cache:
key: gradle-home-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/build.gradle" }}-{{ checksum "~/.tmp/checksumfiles/settings.gradle" }}-{{ .Environment.CACHE_VERSION }}
name: Saving Gradle home cache
paths:
- ~/.gradle/caches/
- run:
background: true
command: npx react-native start
name: Start Metro Bundler (background)
- run:
command: |
mkdir -p android/app/build/generated/assets/react/release
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/build/generated/assets/react/release/index.android.bundle --assets-dest android/app/src/main/res
name: Bundle JS
- run:
command: rm -rf android/app/src/main/res/drawable-*
name: Clean drawable folders
- when:
condition:
equal:
- aab
- <<parameters.bundle_type>>
steps:
- bundle_android_app:
build_type: <<parameters.build_type>>
bundle_type: bundle
project_path: <<parameters.project_path>>
- when:
condition:
equal:
- apk
- <<parameters.bundle_type>>
steps:
- bundle_android_app:
build_type: <<parameters.build_type>>
bundle_type: assemble
project_path: <<parameters.project_path>>
- run:
command: |
mkdir -p ~/gradle-build-caches
[ -d ~/.gradle/caches ] &&
[ -n "$(ls -Ad ~/.gradle/caches/build-cache-* 2>/dev/null)" ] &&
rm -rf ~/gradle-build-caches/* &&
mv ~/.gradle/caches/build-cache-* ~/gradle-build-caches || true
name: Collecting Gradle Build caches for saving
when: always
- save_cache:
key: gradle-debug-build-cache-{{ .Revision }}
name: Saving Gradle Build caches
paths:
- ~/gradle-build-caches
when: always
android_emulator_start:
description: Installs and starts an Android emulator with the given version and name.
parameters:
build_tools_version:
default: 29.0.3
description: The version of the Android build tools to install.
type: string
device_name:
default: TestingAVD
description: The name of the AVD. You use this name to tell which device to run tests on.
type: string
logcat_grep:
default: com.verypossible
description: ADB logs will be shown in the "Start Android Emulator" commands, but we filter it using grep to avoid noise. You can specify additional strings to grep for. Make sure you escape special characters.
type: string
platform_version:
default: android-30
description: The version of android to run on the emulator. Usually in the form of "android-30".
type: string
steps:
- run:
command: |
yes | sdkmanager "platform-tools" "tools" >/dev/null
yes | sdkmanager "platforms;<<parameters.platform_version>>" "system-images;<<parameters.platform_version>>;default;x86_64" >/dev/null
yes | sdkmanager "emulator" --channel=3 >/dev/null
yes | sdkmanager "build-tools;<<parameters.build_tools_version>>" >/dev/null
yes | sdkmanager --licenses >/dev/null
yes | sdkmanager --list
name: Install Android Emulator
shell: /bin/bash -e
- run:
command: |
adb start-server
adb devices
adb kill-server
ls -la ~/.android
name: ADB Start Stop
- run:
command: avdmanager create avd --force --name <<parameters.device_name>> --package "system-images;<<parameters.platform_version>>;default;x86_64" --tag default --device pixel
name: Create Android Emulator
- run:
background: true
command: |
$ANDROID_HOME/emulator/emulator @<<parameters.device_name>> -version
$ANDROID_HOME/emulator/emulator @<<parameters.device_name>> -cores 1 -gpu auto -accel on -memory 1024 -no-audio -no-snapshot -no-boot-anim -no-window -logcat *:W | grep -i 'ReactNative\|<<parameters.logcat_grep>>'
name: Start Android Emulator (background)
- run:
command: |
export BOOT=""
echo "Waiting for AVD to finish booting"
export PATH=$(dirname $(dirname $(command -v android)))/platform-tools:$PATH
until [[ "$BOOT" =~ "1" ]]; do
sleep 5
export BOOT=$(adb -e shell getprop sys.boot_completed 2>&1)
done
sleep 15
adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0
echo "Android Virtual Device is now ready."
name: Wait for AVD to be ready
no_output_timeout: 5m
bundle_android_app:
description: Bundles the Android app as the given bundle type at the given path. This is meant to be run inside the android_build command, but can also be run separately. This should be run only after installing dependencies.
parameters:
build_type:
default: release
description: The build type to build. This is normally either "debug" or "release" but you may have custom build types configured for your app.
type: string
bundle_type:
default: bundle
description: The type of app to bundle. 'bundle' corresponds to 'aab' where 'assemble' corresponds to apk.
enum:
- bundle
- assemble
type: enum
project_path:
default: ./android
description: The path to the root of the Android project you want to build, relative to the root of the repository.
type: string
steps:
- command: |
cd <<parameters.project_path>>
chmod +x gradlew
./gradlew clean
name: Clean Gradle
run: null
- when:
condition:
equal:
- aab
- <<parameters.bundle_type>>
steps:
- run:
command: |
./gradlew --build-cache --continue app:bundle<<parameters.build_type>> -x bundleReleaseJsAndAssets app:assembleAndroidTest -DtestBuildType=<<parameters.build_type>> --stacktrace
name: Bundle app
- when:
condition:
equal:
- apk
- <<parameters.bundle_type>>
steps:
- run:
command: |
./gradlew --build-cache --continue app:assemble<<parameters.build_type>> -x bundleReleaseJsAndAssets app:assembleAndroidTest -DtestBuildType=<<parameters.build_type>> --stacktrace
name: Bundle app
decrypt_gpg_key:
description: Decrypt a secret key using GPG. This command can be used before build/deploy commands where you need a secret key for either task that can't be stored as an environment variable (e.g. a deployment pem key, etc.)
parameters:
input_key_path:
default: ""
description: The path of the key to decrypt relative to project root.
type: string
key_name:
default: ""
description: Name of the secret key environment variable. Should be found in your project's settings > environment variables.
type: string
output_key_path:
default: ""
description: The path to place the decrypted key relative to project root.
type: string
steps:
- run:
command: |
gpg --quiet --batch --yes --passphrase="<<parameters.key_name>>" \
--output <<parameters.output_key_path>> <<parameters.input_key_path>>
name: Decrypt secret key
detox_build:
description: Builds the app with the given Detox configuration, as specified in package.json.
parameters:
configuration:
description: The Detox configuration to build.
type: string
steps:
- run:
command: detox build -c <<parameters.configuration>>
name: Detox Build
detox_test:
description: Tests the app with the given Detox configuration, as specified in package.json.
parameters:
configuration:
description: The Detox configuration to test.
type: string
loglevel:
default: warn
description: The Detox logging level to use. Must be one of "fatal", "error", "warn", "info", "verbose", or "trace".
enum:
- fatal
- error
- warn
- info
- verbose
- trace
type: enum
steps:
- run:
command: detox test -c <<parameters.configuration>> -l <<parameters.loglevel>> --headless
name: Detox Test
fastlane:
description: Runs a Fastlane lane for a given platform.
parameters:
description:
default: ""
description: Descriptor of the Fastlane lane running
type: string
lane:
default: beta
description: The fastlane lane to run for deployment.
type: string
platform:
default: ios
description: The platform to deploy, either "android" or "ios".
enum:
- android
- ios
type: enum
steps:
- yarn_install
- when:
condition:
equal:
- ios
- <<parameters.platform>>
steps:
- install_pods
- restore_cache:
key: 1-gems-{{ checksum "Gemfile.lock" }}
- run:
command: bundle check || bundle install --path vendor/bundle
name: Install gems from Gemfile.lock
- run:
command: fastlane install_plugins
name: Install Fastlane plugins
- save_cache:
key: 1-gems-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
command: bundle exec fastlane <<parameters.platform>> <<parameters.lane>>
name: <<parameters.description>>
install_node:
description: Install node
parameters:
node_version:
default: lts
description: The version of Node to use. This can be either a major version ("8"), a major and minor ("8.4"), a fully qualified version ("8.4.1"), or the long term stable release ("lts")
type: string
steps:
- when:
condition:
equal:
- lts
- <<parameters.node_version>>
steps:
- run:
command: |
nvm install --lts
nvm alias default 'lts/*'
name: Install Node LTS
- when:
condition:
not:
equal:
- lts
- <<parameters.node_version>>
steps:
- run:
command: |
nvm install <<parameters.node_version>>
nvm alias default <<parameters.node_version>>
name: Install node@<<parameters.node_version>>
install_pods:
description: Install Cocoapods
parameters:
pod_install_directory:
default: ios
description: The location of the "ios" directory
type: string
steps:
- restore_cache:
key: cocoapods-{{ arch }}-{{ .Branch }}-{{ checksum "ios/Podfile.lock" }}
- run:
command: |
cd <<parameters.pod_install_directory>> && pod install --repo-update && cd -
name: Install CocoaPods
- save_cache:
key: cocoapods-{{ arch }}-{{ .Branch }}-{{ checksum "ios/Podfile.lock" }}
paths:
- <<parameters.pod_install_directory>>/Pods
ios_build:
description: Builds the iOS app at the given path with the given build scheme and configuration. This should be run only after installing NPM dependencies.
parameters:
build_configuration:
default: Debug
description: The build configuration to use. This is normally either "Debug" or "Release" but you may have custom build configuration configured for your app.
type: string
derived_data_path:
default: ios/build
description: The path to the directory to place the derived data, relative to the root of the repository.
type: string
device:
default: iPhone 12
description: The type of device you want to build for.
type: string
project_path:
description: The path to the Xcode project (*.xcodeproj) or the Xcode workspace (*.xcworkspace) that you want to build, relative to the root of the repository.
type: string
project_type:
default: workspace
description: If the iOS app is built using a project file (*.xcodeproj) or a workspace (*.xcworkspace).
enum:
- project
- workspace
type: enum
scheme:
description: The scheme to use.
type: string
steps:
- restore_cache:
keys:
- ios-build-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ .Environment.CACHE_VERSION }}
name: Restoring iOS Build caches
- run:
command: |
export RCT_NO_LAUNCH_PACKAGER=true
xcodebuild -<<parameters.project_type>> <<parameters.project_path>> -destination 'platform=iOS Simulator,name=<<parameters.device>>' -scheme <<parameters.scheme>> -parallelizeTargets -configuration <<parameters.build_configuration>> -derivedDataPath <<parameters.derived_data_path>> -UseModernBuildSystem=YES | xcpretty -k
name: Build iOS App
- save_cache:
key: ios-build-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ .Environment.CACHE_VERSION }}
name: Saving iOS Build Cache
paths:
- <<parameters.derived_data_path>>/Build
when: always
ios_simulator_start:
description: Starts an iOS simulator with the given name.
parameters:
device:
default: iPhone 12
description: The type of device you want to start.
type: string
steps:
- run:
background: true
command: xcrun simctl boot "<<parameters.device>>" || true
name: Start iOS simulator (background)
metro_start:
description: Starts the Metro packager.
steps:
- run:
background: true
command: react-native start
name: Start Metro Packager (Background)
setup_macos_executor:
description: Installs the required packages to build and test Android and iOS applications on the MacOS executor. You need to run this before running any other command on those executors.
parameters:
node_version:
default: lts
description: The version of Node to use. This can be either a major version ("8"), a major and minor ("8.4"), a fully qualified version ("8.4.1"), or the long term stable release ("lts")
type: string
steps:
- run:
command: |
echo 'export PATH="$PATH:/usr/local/opt/node@<<parameters.node_version>>/bin:~/.yarn/bin:~/project/node_modules/.bin:~/project/example/node_modules/.bin"' >> $BASH_ENV
echo 'export ANDROID_HOME="/usr/local/share/android-sdk"' >> $BASH_ENV
echo 'export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"' >> $BASH_ENV
echo 'export PATH="$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH"' >> $BASH_ENV
echo 'export QEMU_AUDIO_DRV=none' >> $BASH_ENV
echo 'export JAVA_HOME=$(/usr/libexec/java_home)' >> $BASH_ENV
source $BASH_ENV
name: Configure Environment Variables
- restore_cache:
key: |
brew-cache-{{ arch }}-{{ .Environment.CACHE_VERSION }}
- run:
command: |
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
echo 'export NVM_DIR=$HOME/.nvm' >> $BASH_ENV
echo 'source $NVM_DIR/nvm.sh' >> $BASH_ENV
source ~/.bashrc
command -v nvm
name: Install NVM
- install_node:
node_version: <<parameters.node_version>>
- run:
command: node --version
name: Verify node version
- run:
command: |
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/cask >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask android-sdk >/dev/null
touch .watchmanconfig
node -v
name: Configure Detox Environment
- save_cache:
key: |
brew-cache-{{ arch }}-{{ .Environment.CACHE_VERSION }}
paths:
- /usr/local/Homebrew
- ~/Library/Caches/Homebrew
yarn_install:
description: Install Javascript dependencies using Yarn. This command correctly configures the cache for any number of package.json and yarn.lock files.
parameters:
cache:
default: true
description: Save and restore the build cache? Defaults to true
type: boolean
steps:
- run:
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
name: Create cache checksum file
- restore_cache:
keys:
- yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}
- run:
command: yarn install --frozen-lockfile --cache-folder /tmp/yarn
name: Yarn Install
- save_cache:
key: |
yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}
paths:
- /tmp/yarn
description: |
Orb for building and testing React Native projects. View
this orb's source: https://github.com/verypossible-labs/rn-circleci-orb.git
examples:
full-deploy:
jobs:
analyze_js:
executor: rn/linux_js
steps:
- attach_workspace:
at: .
- rn/yarn_install
- run:
command: yarn lint
name: Run eslint
- run:
command: yarn test
name: Run unit tests
checkout_code:
executor:
name: rn/linux_js
steps:
- checkout
- persist_to_workspace:
paths: .
root: .
deploy_android_internal:
executor: rn/macos
steps:
- attach_workspace:
at: .
- rn/fastlane:
description: Deploy a beta build to the Google Play Store
lane: internal
platform: android
deploy_ios_beta:
executor: rn/macos
steps:
- attach_workspace:
at: .
- rn/fastlane:
description: Deploy beta app build to TestFlight
lane: beta
platform: ios
orbs:
rn: verypossible-labs/[email protected]
references:
attach_workspace:
attach_workspace:
at: .
persist_to_workspace:
persist_to_workspace:
paths: .
root: .
version: 2.1
workflows:
build_and_deploy:
jobs:
- checkout_code
- analyze_js:
requires:
- checkout_code
- rn/ios_build_and_test:
build_configuration: Release
device: iPhone 11 Pro
name: build_ios_release
node_version: lts
project_path: ios/MyApp.xcworkspace
project_type: workspace
requires:
- analyze_js
scheme: MyApp
- rn/android_build:
build_type: release
bundle_type: aab
name: build_android_release
requires:
- analyze_js
- rn/android_test:
device_name: MyAppAVD
name: android_e2e
platform_version: android-30
requires:
- build_android_release
- deploy_ios_beta:
requires:
- build_ios_release
- deploy_android_internal:
requires:
- build_android_release
full-deploy-branches:
jobs:
analyze_js:
executor: rn/linux_js
steps:
- attach_workspace:
at: .
- rn/yarn_install
- run:
command: yarn lint
name: Run eslint
- run:
command: yarn test
name: Run unit tests
checkout_code:
executor:
name: rn/linux_js
steps:
- checkout
- persist_to_workspace:
paths: .
root: .
deploy_android_internal:
executor: rn/macos
steps:
- attach_workspace:
at: .
- rn/fastlane:
description: Deploy a beta build to the Google Play Store
lane: internal
platform: android
deploy_android_release:
executor: rn/macos
steps:
- attach_workspace:
at: .
- rn/fastlane:
description: Deploy a beta build to the Google Play Store
lane: release
platform: android
deploy_ios_beta:
executor: rn/macos
steps:
- attach_workspace:
at: .
- rn/fastlane:
description: Deploy beta app build to TestFlight
lane: beta
platform: ios
deploy_ios_release:
executor: rn/macos
steps:
- attach_workspace:
at: .
- rn/fastlane:
description: Deploy app release build to the App Store
lane: release
platform: ios
orbs:
rn: verypossible-labs/[email protected]
references:
attach_workspace:
attach_workspace:
at: .
persist_to_workspace:
persist_to_workspace:
paths: .
root: .
version: 2.1
workflows:
build_and_deploy:
jobs:
- checkout_code
- analyze_js:
requires:
- checkout_code
- rn/ios_build_and_test:
build_configuration: Release
device: iPhone 11 Pro
filters:
branches:
ignore:
- staging
- main
name: build_ios_release
node_version: lts
project_path: ios/MyApp.xcworkspace
project_type: workspace
requires:
- analyze_js
scheme: MyApp
- rn/android_build:
build_type: release
bundle_type: aab
filters:
branches:
ignore:
- staging
- main
name: build_android_release
requires:
- analyze_js
- rn/android_test:
device_name: MyAppAVD
filters:
branches:
ignore:
- staging
- main
name: android_e2e
platform_version: android-30
requires:
- build_android_release
- deploy_ios_beta:
filters:
branches:
only:
- staging
requires:
- build_ios_release
- deploy_android_internal:
filters:
branches:
only:
- staging
requires:
- build_android_release
- deploy_ios_release:
filters:
branches:
only:
- main
requires:
- build_ios_release
- deploy_android_release:
filters:
branches:
only:
- main
requires:
- build_android_release
img: {}
simple-build:
jobs:
analyze_js:
executor: rn/linux_js
steps:
- attach_workspace:
at: .
- rn/yarn_install
- run:
command: yarn lint
name: Run eslint
- run:
command: yarn test
name: Run unit tests
checkout_code:
executor:
name: rn/linux_js
steps:
- checkout
- persist_to_workspace:
paths: .
root: .
orbs:
rn: verypossible-labs/[email protected]
references:
attach_workspace:
attach_workspace:
at: .
persist_to_workspace:
persist_to_workspace:
paths: .
root: .
version: 2.1
workflows:
build:
jobs:
- checkout_code
- analyze_js:
requires:
- checkout_code
- rn/ios_build_and_test:
build_configuration: Release
device: iPhone 11 Pro
name: build_ios_release
node_version: lts
project_path: ios/MyApp.xcworkspace
project_type: workspace
requires:
- analyze_js
scheme: MyApp
- rn/android_build:
build_type: release
bundle_type: aab
name: build_android_release
requires:
- analyze_js
simple-e2e:
jobs:
analyze_js:
executor: rn/linux_js
steps:
- attach_workspace:
at: .
- rn/yarn_install
- run:
command: yarn lint
name: Run eslint
- run:
command: yarn test
name: Run unit tests
checkout_code:
executor:
name: rn/linux_js
steps:
- checkout
- persist_to_workspace:
paths: .
root: .
orbs:
rn: verypossible-labs/[email protected]
references:
attach_workspace:
attach_workspace:
at: .
persist_to_workspace:
persist_to_workspace:
paths: .
root: .
version: 2.1
workflows:
build:
jobs:
- checkout_code
- analyze_js:
requires:
- checkout_code
- rn/ios_build_and_test:
build_configuration: Release
device: iPhone 11 Pro
name: build_ios_release
node_version: lts
project_path: ios/MyApp.xcworkspace
project_type: workspace
requires:
- analyze_js
scheme: MyApp
- rn/android_build:
build_type: release
bundle_type: aab
name: build_android_release
requires:
- analyze_js
executors:
linux_android:
docker:
- image: reactnativecommunity/react-native-android
environment:
- NODE_OPTIONS: <<parameters.node_options>>
- _JAVA_OPTIONS: <<parameters.java_options>>
- GRADLE_OPTS: <<parameters.gradle_options>>
parameters:
gradle_options:
default: -Xmx2014m -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+UnlockExperimentalVMOptions -XX:+HeapDumpOnOutOfMemoryError"
description: Gradle command options. Note that setting this will override the default options so you might need to supply those as well.
type: string
java_options:
default: -Xmx1024m -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
description: Java command options. Note that setting this will override the default options so you might need to supply those as well.
type: string
node_options:
default: --max-old-space-size=8192
description: Node command options. Typically used for increasing memory, increases to 8192 by default.
type: string
resource_class:
default: medium
description: Changes the resource class of the executor. Requires a support request to enable the resource_class parameter. See https://circleci.com/docs/2.0/configuration-reference/#resource_class
type: string
resource_class: <<parameters.resource_class>>
linux_js:
docker:
- image: cimg/node:<<parameters.node_version>>
environment:
- PATH: /opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
parameters:
node_version:
default: lts
description: The version of Node to use. This can be either a major version ("8"), a major and minor ("8.4"), or a fully qualified version ("8.4.1").
type: string
resource_class:
default: medium
description: Changes the resource class of the executor. Requires a support request to enable the resource_class parameter. See https://circleci.com/docs/2.0/configuration-reference/#resource_class
type: string
resource_class: <<parameters.resource_class>>
macos:
macos:
xcode: <<parameters.xcode_version>>
parameters:
resource_class:
default: medium
description: Changes the resource class of the executor. Requires a support request to enable the resource_class parameter. See https://circleci.com/docs/2.0/configuration-reference/#resource_class
type: string
xcode_version:
default: 12.4.0
description: The version of Xcode to use. See here for the list of supported versions https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions
type: string
resource_class: <<parameters.resource_class>>
jobs:
android_build:
description: Builds the Android app at the given path with the given build types.
executor: linux_android
parameters:
attach_workspace:
default: true
description: Boolean for whether or not to attach to an existing workspace. Default is true.
type: boolean
build_type:
default: debug
description: The build type to build. This is normally either "debug" or "release" but you may have custom build types configured for your app.
type: string
bundle_type:
default: aab
description: The type of app to bundle, either 'aab' (Android App Bundles) or 'apk'. Google's recommendation is aab, which is the default.
enum:
- aab
- apk
type: enum
checkout:
default: false
description: Boolean for whether or not to checkout as a first step. Default is false.
type: boolean
on_after_initialize:
default: ""
description: A custom command to run right after yarn install.
type: string
persist_to_workspace:
default: true
description: Should this job persist files to a workspace? Defaults to true
type: boolean
project_path:
default: ./android
description: The path to the root of the Android project you want to build, relative to the root of the repository.
type: string
store_artifacts:
default: true
description: Store this job store files as job artifacts? Defaults to true
type: boolean
workspace_root:
default: .
description: Workspace root path that is either an absolute path or a path relative to the working directory. Defaults to '.' (the working directory).
type: string
steps:
- when:
condition: <<parameters.checkout>>
steps:
- checkout
- when:
condition: <<parameters.attach_workspace>>
steps:
- attach_workspace:
at: <<parameters.workspace_root>>
- yarn_install
- when:
condition: <<parameters.on_after_initialize>>
steps:
- run:
command: <<parameters.on_after_initialize>>
name: on_after_initialize
- android_build:
build_type: <<parameters.build_type>>
bundle_type: <<parameters.bundle_type>>
project_path: <<parameters.project_path>>
- when:
condition: <<parameters.persist_to_workspace>>
steps:
- persist_to_workspace:
paths:
- <<parameters.project_path>>/app/build/outputs/<<parameters.bundle_type>>
root: .
- when:
condition: <<parameters.store_artifacts>>
steps:
- store_artifacts:
path: <<parameters.project_path>>/app/build/outputs/<<parameters.bundle_type>>
android_test:
description: Tests the Android app on the given device, with the given Detox configuration. You should have already built the correct Android APK (including the androidTest APK) and have both persisted to the worksapce.
executor: macos
parameters:
build_tools_version:
default: 28.0.3
description: The version of the Android build tools to install. Defaults to '28.0.3'.
type: string
detox_configuration:
default: android.emu.release
description: The Detox configuration to test. Defaults to 'android.emu.release'.
type: string
detox_loglevel:
default: warn
description: The Detox logging level to use. Must be one of "fatal", "error", "warn", "info", "verbose", or "trace".
enum:
- fatal
- error
- warn
- info
- verbose
- trace
type: enum
device_name:
default: TestingAVD
description: The name of the AVD. You use this name to tell which device to run tests on. Defaults to 'TestingAVD'.
type: string
logcat_grep:
default: com.reactnativecommunity
description: ADB logs will be shown in the "Start Android Emulator" commands, but we filter it using grep to avoid noise. You can specify additional strings to grep for. Make sure you escape special characters. Defaults to 'com.reactnativecommunity'.