Skip to content

Commit a64f03b

Browse files
filipesilvavikerman
authored andcommitted
ci: use var to hold workspace location
1 parent f8f48a4 commit a64f03b

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

.circleci/config.yml

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ var_2: &cache_key_fallback angular_devkit-0.11.0
2121
var_1_win: &cache_key_win angular_devkit-win-0.11.0-{{ checksum "yarn.lock" }}
2222
var_2_win: &cache_key_fallback_win angular_devkit-win-0.11.0
2323
var_3: &default_nodeversion "12.9"
24-
var_4: &attach_options
25-
at: .
24+
# Workspace initially persisted by the `setup` job, and then enhanced by `setup-and-build-win`.
25+
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
26+
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
27+
var_4: &workspace_location .
28+
# Filter to ignore pull requests on a given job.
2629
var_5: &ignore_pull_requests
2730
filters:
2831
branches:
@@ -63,6 +66,11 @@ executors:
6366
# Command Definitions
6467
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
6568
commands:
69+
custom_attach_workspace:
70+
description: Attach workspace at a predefined location
71+
steps:
72+
- attach_workspace:
73+
at: *workspace_location
6674
setup_windows:
6775
steps:
6876
- run:
@@ -123,7 +131,7 @@ jobs:
123131
- *cache_key_fallback
124132
- run: yarn install --frozen-lockfile
125133
- persist_to_workspace:
126-
root: .
134+
root: *workspace_location
127135
paths:
128136
- ./*
129137
- save_cache:
@@ -134,7 +142,7 @@ jobs:
134142
lint:
135143
executor: action-executor
136144
steps:
137-
- attach_workspace: *attach_options
145+
- custom_attach_workspace
138146
- run: yarn lint
139147
- run: 'yarn bazel:format -mode=check ||
140148
(echo "BUILD files not formatted. Please run ''yarn bazel:format''" ; exit 1)'
@@ -145,13 +153,13 @@ jobs:
145153
validate:
146154
executor: action-executor
147155
steps:
148-
- attach_workspace: *attach_options
156+
- custom_attach_workspace
149157
- run: yarn validate --ci
150158

151159
test:
152160
executor: action-executor
153161
steps:
154-
- attach_workspace: *attach_options
162+
- custom_attach_workspace
155163
- run: yarn test --full
156164

157165
test-large:
@@ -166,7 +174,7 @@ jobs:
166174
resource_class: large
167175
parallelism: 4
168176
steps:
169-
- attach_workspace: *attach_options
177+
- custom_attach_workspace
170178
- run: yarn webdriver-update
171179
- run: yarn test-large --full <<# parameters.ve >>--ve<</ parameters.ve >> <<# parameters.glob >>--glob="<< parameters.glob >>"<</ parameters.glob >> --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX}
172180

@@ -181,7 +189,7 @@ jobs:
181189
executor: test-executor
182190
parallelism: 4
183191
steps:
184-
- attach_workspace: *attach_options
192+
- custom_attach_workspace
185193
- run:
186194
name: Initialize Environment
187195
command: ./.circleci/env.sh
@@ -195,7 +203,7 @@ jobs:
195203
nodeversion: "10.16"
196204
parallelism: 4
197205
steps:
198-
- attach_workspace: *attach_options
206+
- custom_attach_workspace
199207
- run:
200208
name: Initialize Environment
201209
command: |
@@ -210,7 +218,7 @@ jobs:
210218
environment:
211219
E2E_BROWSERS: true
212220
steps:
213-
- attach_workspace: *attach_options
221+
- custom_attach_workspace
214222
- run:
215223
name: Initialize Environment
216224
command: ./.circleci/env.sh
@@ -231,7 +239,7 @@ jobs:
231239
build:
232240
executor: action-executor
233241
steps:
234-
- attach_workspace: *attach_options
242+
- custom_attach_workspace
235243
- run: yarn build
236244

237245
# This is where we put all the misbehaving and flaky tests so we can fine-tune their conditions
@@ -240,7 +248,7 @@ jobs:
240248
executor: test-executor
241249
resource_class: medium
242250
steps:
243-
- attach_workspace: *attach_options
251+
- custom_attach_workspace
244252
- run: yarn webdriver-update
245253
- run: yarn test-large --full --flakey
246254
- run: yarn test-large --full --flakey --ve=true
@@ -249,15 +257,15 @@ jobs:
249257
executor: action-executor
250258
resource_class: xlarge
251259
steps:
252-
- attach_workspace: *attach_options
260+
- custom_attach_workspace
253261
- setup_bazel_rbe
254262
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
255263
- run: yarn bazel:test
256264

257265
snapshot_publish:
258266
executor: action-executor
259267
steps:
260-
- attach_workspace: *attach_options
268+
- custom_attach_workspace
261269
- run:
262270
name: Decrypt Credentials
263271
# Note: when changing the image, you might have to re-encrypt the credentials with a
@@ -273,7 +281,7 @@ jobs:
273281
publish:
274282
executor: action-executor
275283
steps:
276-
- attach_workspace: *attach_options
284+
- custom_attach_workspace
277285
- run:
278286
name: Decrypt Credentials
279287
command: |
@@ -289,7 +297,7 @@ jobs:
289297
setup-and-build-win:
290298
executor: windows-executor
291299
steps:
292-
- attach_workspace: *attach_options
300+
- custom_attach_workspace
293301
- setup_windows
294302
- restore_cache:
295303
keys:
@@ -305,14 +313,14 @@ jobs:
305313
# Only jobs downstream from this one will see the updated workspace
306314
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
307315
- persist_to_workspace:
308-
root: .
316+
root: *workspace_location
309317
paths:
310318
- ./*
311319

312320
test-win:
313321
executor: windows-executor
314322
steps:
315-
- attach_workspace: *attach_options
323+
- custom_attach_workspace
316324
- setup_windows
317325
- run: yarn test --full
318326
# Run partial e2e suite on PRs only. Master will run the full e2e suite with sharding.

0 commit comments

Comments
 (0)