Skip to content

Commit 6ee89e8

Browse files
authored
Move CircleCI aliases to commands (#381)
1 parent 43f77af commit 6ee89e8

File tree

1 file changed

+71
-62
lines changed

1 file changed

+71
-62
lines changed

.circleci/config.yml

Lines changed: 71 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,6 @@ version: 2.1
33
aliases:
44
- &xcode-version 12.5.1
55
- &node-version '16.12'
6-
- &save-cache-yarn
7-
save_cache:
8-
key: yarn-packages-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }}
9-
paths:
10-
- ~/.cache/yarn
11-
- &restore-cache-yarn
12-
restore_cache:
13-
name: Restore Yarn Package Cache
14-
keys:
15-
- yarn-packages-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }}
16-
- &save-cache-detox-env
17-
save_cache:
18-
key: detox-env-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ .Environment.XCODE_VERSION }}-{{ .Environment.CIRCLE_WORKING_DIRECTORY }}
19-
paths:
20-
- /usr/local/Homebrew
21-
- ~/Library/Caches/Homebrew
22-
- &restore-cache-detox-env
23-
restore_cache:
24-
name: Restoring Detox Env Cache
25-
keys:
26-
- detox-env-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ .Environment.XCODE_VERSION }}-{{ .Environment.CIRCLE_WORKING_DIRECTORY }}
27-
- &save-cache-detox-app
28-
save_cache:
29-
key: detox-app-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock"}}
30-
paths:
31-
- node_modules
32-
- ios/Pods
33-
- &restore-cache-detox-app
34-
restore_cache:
35-
name: Restoring Detox App Cache
36-
keys:
37-
- detox-app-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock"}}
38-
- &save-android-build-cache
39-
save_cache:
40-
paths:
41-
- ~/.gradle/caches
42-
- ~/.gradle/wrapper
43-
- ~/.android/build-cache
44-
key: gradle-build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "yarn.lock" }}
45-
when: always # Ensures build assets are cached even on failed builds
46-
- &restore-android-build-cache
47-
restore_cache:
48-
name: Restoring Android & Gradle cache
49-
keys:
50-
- gradle-build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "yarn.lock" }}
51-
- &attach-workspace
52-
attach_workspace:
53-
at: ~/react-native-url-polyfill
546

557
orbs:
568
node: circleci/[email protected]
@@ -80,6 +32,63 @@ executors:
8032
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2'
8133

8234
commands:
35+
save-cache-yarn:
36+
steps:
37+
- save_cache:
38+
key: yarn-packages-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }}
39+
paths:
40+
- ~/.cache/yarn
41+
restore-cache-yarn:
42+
steps:
43+
- restore_cache:
44+
name: Restore Yarn Package Cache
45+
keys:
46+
- yarn-packages-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }}
47+
save-cache-detox-env:
48+
steps:
49+
- save_cache:
50+
key: detox-env-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ .Environment.XCODE_VERSION }}-{{ .Environment.CIRCLE_WORKING_DIRECTORY }}
51+
paths:
52+
- /usr/local/Homebrew
53+
- ~/Library/Caches/Homebrew
54+
restore-cache-detox-env:
55+
steps:
56+
- restore_cache:
57+
name: Restoring Detox Env Cache
58+
keys:
59+
- detox-env-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ .Environment.XCODE_VERSION }}-{{ .Environment.CIRCLE_WORKING_DIRECTORY }}
60+
save-cache-detox-app:
61+
steps:
62+
- save_cache:
63+
key: detox-app-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock"}}
64+
paths:
65+
- node_modules
66+
- ios/Pods
67+
restore-cache-detox-app:
68+
steps:
69+
- restore_cache:
70+
name: Restoring Detox App Cache
71+
keys:
72+
- detox-app-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock"}}
73+
save-android-build-cache:
74+
steps:
75+
- save_cache:
76+
paths:
77+
- ~/.gradle/caches
78+
- ~/.gradle/wrapper
79+
- ~/.android/build-cache
80+
key: gradle-build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "yarn.lock" }}
81+
when: always # Ensures build assets are cached even on failed builds
82+
restore-android-build-cache:
83+
steps:
84+
- restore_cache:
85+
name: Restoring Android & Gradle cache
86+
keys:
87+
- gradle-build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "yarn.lock" }}
88+
attach-workspace:
89+
steps:
90+
- attach_workspace:
91+
at: ~/react-native-url-polyfill
8392
install-yarn-dependencies:
8493
steps:
8594
- run:
@@ -91,7 +100,7 @@ commands:
91100
yarn install --frozen-lockfile --no-progress --non-interactive --cache-folder ~/.cache/yarn
92101
install-detox:
93102
steps:
94-
- *restore-cache-detox-env
103+
- restore-cache-detox-env
95104
- run:
96105
name: Install Detox
97106
command: |
@@ -102,7 +111,7 @@ commands:
102111
name: Clean Detox
103112
command: |
104113
detox clean-framework-cache && detox build-framework-cache
105-
- *save-cache-detox-env
114+
- save-cache-detox-env
106115
install-node:
107116
steps:
108117
- node/install:
@@ -116,23 +125,23 @@ jobs:
116125
executor: default
117126
steps:
118127
- checkout
119-
- *restore-cache-yarn
128+
- restore-cache-yarn
120129
- run:
121130
name: Yarn version
122131
command: yarn -v
123132
- run:
124133
name: Yarn Install
125134
command: |
126135
yarn install --frozen-lockfile --no-progress --non-interactive --cache-folder ~/.cache/yarn
127-
- *save-cache-yarn
136+
- save-cache-yarn
128137
- persist_to_workspace:
129138
root: .
130139
paths:
131140
- .
132141
lint:
133142
executor: default
134143
steps:
135-
- *attach-workspace
144+
- attach-workspace
136145
- run:
137146
name: Lint
138147
command: yarn lint
@@ -143,7 +152,7 @@ jobs:
143152
default: ''
144153
executor: default
145154
steps:
146-
- *attach-workspace
155+
- attach-workspace
147156
- when:
148157
condition: << parameters.react-native-version >>
149158
steps:
@@ -163,8 +172,8 @@ jobs:
163172
executor: << parameters.executor >>
164173
working_directory: ~/react-native-url-polyfill/platforms/react-native/<< parameters.react-native-version >>
165174
steps:
166-
- *attach-workspace
167-
- *restore-cache-detox-app
175+
- attach-workspace
176+
- restore-cache-detox-app
168177
- install-node
169178
- install-yarn-dependencies
170179
- install-detox
@@ -177,25 +186,25 @@ jobs:
177186
- run:
178187
name: Run Detox on iOS
179188
command: yarn e2e:ios
180-
- *save-cache-detox-app
189+
- save-cache-detox-app
181190
test-hermes-android:
182191
parameters:
183192
react-native-version:
184193
type: string
185194
executor: android
186195
working_directory: ~/react-native-url-polyfill/platforms/react-native/<< parameters.react-native-version >>
187196
steps:
188-
- *attach-workspace
197+
- attach-workspace
189198
- run:
190199
name: Enable Hermes
191200
command: sed -i "s/enableHermes:\sfalse/enableHermes:\ true/g" android/app/build.gradle
192-
- *restore-android-build-cache
201+
- restore-android-build-cache
193202
- install-node
194203
- install-yarn-dependencies
195204
- run:
196205
name: Build APK
197206
command: cd android && ./gradlew assembleRelease
198-
- *save-android-build-cache
207+
- save-android-build-cache
199208
test-hermes-ios:
200209
parameters:
201210
executor:
@@ -206,8 +215,8 @@ jobs:
206215
executor: << parameters.executor >>
207216
working_directory: ~/react-native-url-polyfill/platforms/react-native/<< parameters.react-native-version >>
208217
steps:
209-
- *attach-workspace
210-
- *restore-cache-detox-app
218+
- attach-workspace
219+
- restore-cache-detox-app
211220
- run:
212221
name: Enable Hermes
213222
command: npx shx sed -i "s/:hermes_enabled\s=>\sfalse/:hermes_enabled => true/g" ios/Podfile

0 commit comments

Comments
 (0)