1- # -------------------------
2- # DEFAULTS
3- # -------------------------
4- defaults : &defaults
5- working_directory : ~/react-native-image-editor
6- environment :
7- - GIT_COMMIT_DESC : git log --format=oneline -n 1 $CIRCLE_SHA1
1+ version : 2.1
82
9- # LINUX
10- linux_defaults : &linux_defaults
11- << : *defaults
12- docker :
13- - image : circleci/node:8
14- environment :
15- - PATH : " /opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
3+ orbs :
4+ rn : react-native-community/react-native@1.1.0
165
17- # ANDROID
18- android_defaults : &android_defaults
19- << : *defaults
20- docker :
21- - image : circleci/android:api-27-node8-alpha
22- resource_class : " large"
23- environment :
24- - TERM : " dumb"
25- - ADB_INSTALL_TIMEOUT : 10
26- - _JAVA_OPTIONS : " -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
27- - GRADLE_OPTS : ' -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
28- - BUILD_THREADS : 2
29-
30- # MACOS
31- macos_defaults : &macos_defaults
32- << : *defaults
33- resource_class : " large"
34- macos :
35- xcode : " 10.1.0"
36-
37- # -------------------------
38- # ALIASES
39- # -------------------------
40-
41- aliases :
42- # CACHE
43- - &restore-yarn-cache
44- keys :
45- - yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
46- - yarn-cache-{{ arch }}
47- - &save-yarn-cache
48- paths :
49- - ~/.cache/yarn
50- - ~/Library/Detox/ios
51- key : yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
52-
53- - &restore-gradle-cache
54- keys :
55- - gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}
56- - &save-gradle-cache
57- paths :
58- - ~/.gradle
59- key : gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}
60-
61- # INSTALLATION
62- - &yarn
63- name : Yarn Install
64- command : |
65- yarn install --network-concurrency 1 --non-interactive --cache-folder ~/.cache/yarn & wait
66-
67- # ANALYSE
68- - &eslint
69- name : ESLint Checks
70- command : yarn test:eslint
71-
72- - &flow
73- name : Flow Checks
74- command : yarn test:flow
75-
76- # - &jest
77- # name: Jest Unit Tests
78- # command: yarn test:jest
79-
80- # -------------------------
81- # JOBS
82- # -------------------------
83- version : 2
846jobs :
85- # Set up a Linux environment for downstream jobs
86- linux-checkout :
87- << : *linux_defaults
88- steps :
89- - checkout
90- - restore-cache : *restore-yarn-cache
91- - run : rm -rf node_modules
92- - run : yarn cache clean
93- - run : *yarn
94- - save-cache : *save-yarn-cache
95- - persist_to_workspace :
96- root : .
97- paths : .
98-
99- eslint :
100- << : *linux_defaults
101- steps :
102- - attach_workspace :
103- at : ~/react-native-image-editor
104- - run : *eslint
105-
106- flow :
107- << : *linux_defaults
108- steps :
109- - attach_workspace :
110- at : ~/react-native-image-editor
111- - run : *flow
112-
113- # jest:
114- # <<: *linux_defaults
115- # steps:
116- # - attach_workspace:
117- # at: ~/react-native-image-editor
118- # - run: *jest
119-
120- android-compile :
121- << : *android_defaults
7+ checkout_code :
8+ executor : rn/linux_js
1229 steps :
123- - attach_workspace :
124- at : ~/react-native-image-editor
125- - restore-cache : *restore-gradle-cache
126- - run :
127- name : Accept Android licences
128- command : |-
129- yes | sdkmanager --licenses || exit 0
130- yes | sdkmanager --update || exit 0
131- - run :
132- name : Build Android Example App and Library
133- command : |-
134- cd example/android
135- ./gradlew clean assembleDebug
136- - save-cache : *save-gradle-cache
137-
138- ios-checkout :
139- << : *macos_defaults
140- steps :
141- - checkout
142- - restore-cache : *restore-yarn-cache
143- - run : rm -rf node_modules
144- - run : yarn cache clean
145- - run : *yarn
146- - save-cache : *save-yarn-cache
147- - persist_to_workspace :
148- root : .
149- paths : .
150-
151- ios-compile :
152- << : *macos_defaults
10+ - checkout
11+ - persist_to_workspace :
12+ root : .
13+ paths : .
14+ analyse :
15+ executor : rn/linux_js
15316 steps :
154- - attach_workspace :
155- at : ~/react-native-image-editor
156- - run :
157- name : Build example app
158- command : |-
159- react-native run-ios --project-path example/ios
17+ - attach_workspace :
18+ at : .
19+ - rn/yarn_install
20+ - run :
21+ name : Lint JS Code (ESLint)
22+ command : yarn run test:eslint
23+ - run :
24+ name : Flow
25+ command : yarn run test:flow
26+ # TODO: uncomment after adding jest tests
27+ # - run:
28+ # name: Jest
29+ # command: yarn run test:jest
30+ - run :
31+ name : Build Android JavaScript Bundle
32+ command : yarn run test:detox:android:bundle:release
33+ - run :
34+ name : Build iOS JavaScript Bundle
35+ command : yarn run test:detox:ios:bundle:release
16036
161- # -------------------------
162- # WORKFLOWS
163- # -------------------------
16437workflows :
165- version : 2
166- Test :
38+ test :
16739 jobs :
168- - linux-checkout
169- - eslint :
170- requires :
171- - linux-checkout
172- - flow :
173- requires :
174- - linux-checkout
175- # - jest:
176- # requires:
177- # - linux-checkout
178- - android-compile :
179- requires :
180- - linux-checkout
181- # Disabled until we have macOS containers enabled
182- # - ios-checkout
183- # - ios-compile:
184- # requires:
185- # - ios-checkout
40+ - checkout_code
41+ - analyse :
42+ requires :
43+ - checkout_code
44+ - rn/android_build :
45+ name : build_android_debug
46+ project_path : " example/android"
47+ build_type : debug
48+ requires :
49+ - analyse
50+ - rn/android_build :
51+ name : build_android_release
52+ project_path : " example/android"
53+ build_type : release
54+ requires :
55+ - analyse
56+ - rn/android_test :
57+ detox_configuration : " android.emu.release"
58+ detox_loglevel : " trace"
59+ requires :
60+ - build_android_release
61+ - rn/ios_build_and_test :
62+ project_path : " example/ios/ImageEditorExample.xcodeproj"
63+ derived_data_path : " example/ios/build"
64+ device : " iPhone X"
65+ build_configuration : " Release"
66+ scheme : " ImageEditorExample"
67+ detox_configuration : " ios.sim.release"
68+ detox_loglevel : " trace"
69+ requires :
70+ - analyse
0 commit comments