Skip to content

Commit 08850cb

Browse files
committed
build: update yarn to v1.16.0
Currently our version of Yarn is installed through the "angular/ngcontainer" docker image. This is problematic because in order to be able to update Yarn, we always need to update the docker image to a version that comes with the desired Yarn version. Sometimes there is no docker image with the desired latest Yarn version, and therefore we cannot easily update the Yarn version. Additionally the latest Yarn versions contain various fixes for debugging timeout issues and also have improved logic for restoring existing `node_modules`. This is **essential** to take advantage of the CircleCI caching mechanism.
1 parent c1e07ad commit 08850cb

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

.circleci/config.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,29 +56,33 @@ var_8: &gcp_decrypt_token "angular"
5656
var_9: &yarn_install
5757
run: yarn install --frozen-lockfile --non-interactive
5858

59+
# Anchor that can be used to download and install Yarn globally in the bash environment.
60+
var_10: &yarn_download
61+
run: curl -o- -L https://yarnpkg.com/install.sh | PROFILE=$BASH_ENV bash -s -- --version "1.16.0"
62+
5963
# Copies the Bazel config which is specifically for CircleCI to a location where Bazel picks it
6064
# up and merges it with the project-wide bazel configuration (tools/bazel.rc)
61-
var_10: &copy_bazel_config
65+
var_11: &copy_bazel_config
6266
# Set up the CircleCI specific bazel configuration.
6367
run: sudo cp ./.circleci/bazel.rc /etc/bazel.bazelrc
6468

6569
# Sets up a different Docker image that includes a moe recent Firefox version which
6670
# is needed for headless testing.
67-
var_11: &docker-firefox-image
71+
var_12: &docker-firefox-image
6872
# TODO(devversion): Temporarily use a image that includes Firefox 62 because the
6973
# ngcontainer image does include an old Firefox version that does not support headless.
7074
- image: circleci/node:11.4.0-browsers
7175

7276
# Attaches the release output which has been stored in the workspace to the current job.
7377
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
74-
var_12: &attach_release_output
78+
var_13: &attach_release_output
7579
attach_workspace:
7680
at: dist/
7781

7882
# Branch filter that we can specify for jobs that should only run on publish branches. This filter
7983
# is used to ensure that not all upstream branches will be published as Github builds
8084
# (e.g. revert branches, feature branches)
81-
var_13: &publish_branches_filter
85+
var_14: &publish_branches_filter
8286
branches:
8387
only:
8488
- master
@@ -92,15 +96,15 @@ var_13: &publish_branches_filter
9296
# In order to reduce duplication we use a YAML anchor that just always excludes the "_presubmit"
9397
# branch. We don't want to run Circle for the temporary "_presubmit" branch which is reserved
9498
# for the caretaker.
95-
var_14: &ignore_presubmit_branch_filter
99+
var_15: &ignore_presubmit_branch_filter
96100
branches:
97101
ignore:
98102
- "_presubmit"
99103
- "ivy-2019"
100104

101105
# Runs a script that sets up the Bazel remote execution. This will be used by jobs that run
102106
# Bazel primarily and should benefit from remote caching and execution.
103-
var_15: &setup_bazel_remote_execution
107+
var_16: &setup_bazel_remote_execution
104108
run:
105109
name: "Setup bazel RBE remote execution"
106110
command: ./scripts/circleci/bazel/setup-remote-execution.sh
@@ -180,6 +184,7 @@ jobs:
180184
steps:
181185
- *checkout_code
182186
- *restore_cache
187+
- *yarn_download
183188
- *yarn_install
184189

185190
- run: ./scripts/circleci/run-local-browser-tests.sh
@@ -197,6 +202,7 @@ jobs:
197202
steps:
198203
- *checkout_code
199204
- *restore_cache
205+
- *yarn_download
200206
- *yarn_install
201207

202208
- run: ./scripts/circleci/run-browserstack-tests.sh
@@ -217,6 +223,7 @@ jobs:
217223
steps:
218224
- *checkout_code
219225
- *restore_cache
226+
- *yarn_download
220227
- *yarn_install
221228

222229
- run: ./scripts/circleci/run-saucelabs-tests.sh
@@ -230,6 +237,7 @@ jobs:
230237
steps:
231238
- *checkout_code
232239
- *restore_cache
240+
- *yarn_download
233241
- *yarn_install
234242
- *attach_release_output
235243

@@ -244,6 +252,7 @@ jobs:
244252
steps:
245253
- *checkout_code
246254
- *restore_cache
255+
- *yarn_download
247256
- *yarn_install
248257

249258
- run: yarn gulp ci:prerender
@@ -256,6 +265,7 @@ jobs:
256265
steps:
257266
- *checkout_code
258267
- *restore_cache
268+
- *yarn_download
259269
- *yarn_install
260270

261271
- run: ./scripts/circleci/lint-bazel-files.sh
@@ -271,6 +281,7 @@ jobs:
271281
steps:
272282
- *checkout_code
273283
- *restore_cache
284+
- *yarn_download
274285
- *yarn_install
275286

276287
- run: yarn gulp ci:build-release-packages
@@ -342,6 +353,7 @@ jobs:
342353
steps:
343354
- *checkout_code
344355
- *restore_cache
356+
- *yarn_download
345357
- *yarn_install
346358

347359
- run: node ./scripts/circleci/setup-angular-snapshots.js
@@ -362,6 +374,7 @@ jobs:
362374
- *restore_cache
363375
- *copy_bazel_config
364376
- *setup_bazel_remote_execution
377+
- *yarn_download
365378
- *yarn_install
366379

367380
# Setup Angular ivy snapshots built with ngtsc but locked to a specific tag. We
@@ -392,6 +405,7 @@ jobs:
392405
- *restore_cache
393406
- *copy_bazel_config
394407
- *setup_bazel_remote_execution
408+
- *yarn_download
395409
- *yarn_install
396410

397411
# Setup Angular ivy snapshots built with ngtsc.

WORKSPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ yarn_install(
3838
],
3939
package_json = "//:package.json",
4040
yarn_lock = "//:yarn.lock",
41+
yarn_repositories = {
42+
"1.16.0": ("yarn-v1.16.0.tar.gz", "yarn-v1.16.0", "df202627d9a70cf09ef2fb11cb298cb619db1b958590959d6f6e571b50656029"),
43+
},
44+
yarn_version = "1.16.0",
4145
)
4246

4347
# Install all bazel dependencies of the @ngdeps npm packages

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
},
1010
"license": "MIT",
1111
"engines": {
12-
"node": ">= 5.4.1"
12+
"node": ">= 5.4.1",
13+
"yarn": ">= 1.13.0"
1314
},
1415
"scripts": {
1516
"postinstall": "ngc -p angular-tsconfig.json",

0 commit comments

Comments
 (0)