77# To validate changes, use an online parser, eg.
88# http://yaml-online-parser.appspot.com/
99
10- var_1 : &docker_image angular/ngcontainer:0.10.0
10+ var_1 : &docker_image circleci/node:10.16
11+ var_2 : &docker_bazel_image l.gcr.io/google/bazel:0.26.1
1112
1213# **Note**: When updating the beginning of the cache key, also update the cache key to match
1314# the new cache key prefix. This allows us to take advantage of CircleCI's fallback caching.
1415# Read more here: https://circleci.com/docs/2.0/caching/#restoring-cache.
15- var_2 : &cache_key v2 -ng-mat-{{ checksum "WORKSPACE" }}-{{ checksum "yarn.lock" }}
16- var_3 : &cache_fallback_key v2 -ng-mat-
16+ var_3 : &cache_key v3 -ng-mat-{{ checksum "WORKSPACE" }}-{{ checksum "yarn.lock" }}
17+ var_4 : &cache_fallback_key v3 -ng-mat-
1718
1819# Settings common to each job
19- var_4 : &job_defaults
20+ var_5 : &job_defaults
2021 working_directory : ~/ng
2122 docker :
2223 - image : *docker_image
2324
2425# Job step for checking out the source code from GitHub. This also ensures that the source code
2526# is rebased on top of master.
26- var_5 : &checkout_code
27+ var_6 : &checkout_code
2728 checkout :
2829 # After checkout, rebase on top of master. By default, PRs are not rebased on top of master,
2930 # which we want. See https://discuss.circleci.com/t/1662
3031 post : git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge"
3132
3233# Restores the cache that could be available for the current Yarn lock file. The cache usually
3334# includes the node modules and the Bazel repository cache.
34- var_6 : &restore_cache
35+ var_7 : &restore_cache
3536 restore_cache :
3637 keys :
3738 - *cache_key
3839 - *cache_fallback_key
3940
4041# Saves the cache for the current Yarn lock file. We store the node modules and the Bazel
4142# repository cache in order to make subsequent builds faster.
42- var_7 : &save_cache
43+ var_8 : &save_cache
4344 save_cache :
4445 key : *cache_key
4546 paths :
4647 - " node_modules"
4748 - " ~/bazel_repository_cache"
4849
4950# Decryption token that is used to decode the GCP credentials file in ".circleci/gcp_token".
50- var_8 : &gcp_decrypt_token "angular"
51+ var_9 : &gcp_decrypt_token "angular"
5152
5253# Job step that ensures that the node module dependencies are installed and up-to-date. We use
5354# Yarn with the frozen lockfile option in order to make sure that lock file and package.json are
5455# in sync. Unlike in Travis, we don't need to manually purge the node modules if stale because
5556# CircleCI automatically discards the cache if the checksum of the lock file has changed.
56- var_9 : &yarn_install
57+ var_10 : &yarn_install
5758 run :
5859 name : " Installing project dependencies"
5960 command : yarn install --frozen-lockfile --non-interactive
6061
6162# Anchor that can be used to download and install Yarn globally in the bash environment.
62- var_10 : &yarn_download
63+ var_11 : &yarn_download
6364 run :
6465 name : " Downloading and installing Yarn"
6566 command : |
6667 touch $BASH_ENV
6768 curl -o- -L https://yarnpkg.com/install.sh | PROFILE=$BASH_ENV bash -s -- --version "1.16.0"
6869
69- # Copies the Bazel config which is specifically for CircleCI to a location where Bazel picks it
70- # up and merges it with the project-wide bazel configuration (tools/bazel.rc)
71- var_11 : ©_bazel_config
72- # Set up the CircleCI specific bazel configuration.
73- run : sudo cp ./.circleci/bazel.rc /etc/bazel.bazelrc
70+ # Sets up the Bazel config which is specific for CircleCI builds.
71+ var_12 : &setup_bazel_ci_config
72+ run :
73+ name : " Setting up Bazel configuration for CI"
74+ command : |
75+ echo "import %workspace%/.circleci/bazel.rc" >> ./.bazelrc
7476
7577# Sets up a different Docker image that includes a moe recent Firefox version which
7678# is needed for headless testing.
77- var_12 : &docker-firefox-image
79+ var_13 : &docker-firefox-image
7880 # TODO(devversion): Temporarily use a image that includes Firefox 62 because the
7981 # ngcontainer image does include an old Firefox version that does not support headless.
8082 - image : circleci/node:11.4.0-browsers
8183
8284# Attaches the release output which has been stored in the workspace to the current job.
8385# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
84- var_13 : &attach_release_output
86+ var_14 : &attach_release_output
8587 attach_workspace :
8688 at : dist/
8789
8890# Branch filter that we can specify for jobs that should only run on publish branches. This filter
8991# is used to ensure that not all upstream branches will be published as Github builds
9092# (e.g. revert branches, feature branches)
91- var_14 : &publish_branches_filter
93+ var_15 : &publish_branches_filter
9294 branches :
9395 only :
9496 - master
@@ -102,15 +104,15 @@ var_14: &publish_branches_filter
102104# In order to reduce duplication we use a YAML anchor that just always excludes the "_presubmit"
103105# branch. We don't want to run Circle for the temporary "_presubmit" branch which is reserved
104106# for the caretaker.
105- var_15 : &ignore_presubmit_branch_filter
107+ var_16 : &ignore_presubmit_branch_filter
106108 branches :
107109 ignore :
108110 - " _presubmit"
109111 - " ivy-2019"
110112
111113# Runs a script that sets up the Bazel remote execution. This will be used by jobs that run
112114# Bazel primarily and should benefit from remote caching and execution.
113- var_16 : &setup_bazel_remote_execution
115+ var_17 : &setup_bazel_remote_execution
114116 run :
115117 name : " Setup bazel RBE remote execution"
116118 command : ./scripts/circleci/bazel/setup-remote-execution.sh
@@ -130,36 +132,34 @@ jobs:
130132 # Build and test job that uses Bazel.
131133 # -----------------------------------
132134 bazel_build_test :
133- << : *job_defaults
135+ docker :
136+ - image : *docker_bazel_image
134137 resource_class : xlarge
135138 environment :
136139 GCP_DECRYPT_TOKEN : *gcp_decrypt_token
137140 steps :
138141 - *checkout_code
139142 - *restore_cache
140- - *copy_bazel_config
143+ - *setup_bazel_ci_config
141144 - *setup_bazel_remote_execution
142145
143146 - run : bazel build src/... --build_tag_filters=-docs-package
144147 - run : bazel test src/... --build_tag_filters=-docs-package --test_tag_filters=-e2e
145148
146- # Note: We want to save the cache in this job because the workspace cache also
147- # includes the Bazel repository cache that will be updated in this job.
148- - *save_cache
149-
150149 # --------------------------------------------------------------------------------------------
151150 # Job that runs ts-api-guardian against our API goldens in "tools/public_api_guard".
152151 # This job fails whenever an API has been updated but not explicitly approved through goldens.
153152 # --------------------------------------------------------------------------------------------
154153 api_golden_checks :
155- << : *job_defaults
154+ docker :
155+ - image : *docker_bazel_image
156156 resource_class : xlarge
157157 environment :
158158 GCP_DECRYPT_TOKEN : *gcp_decrypt_token
159159 steps :
160160 - *checkout_code
161161 - *restore_cache
162- - *copy_bazel_config
162+ - *setup_bazel_ci_config
163163 - *setup_bazel_remote_execution
164164
165165 - run : bazel test tools/public_api_guard/...
@@ -168,14 +168,15 @@ jobs:
168168 # Job that runs the e2e tests with Protractor and Chromium headless
169169 # -----------------------------------------------------------------
170170 e2e_tests :
171- << : *job_defaults
171+ docker :
172+ - image : *docker_bazel_image
172173 resource_class : xlarge
173174 environment :
174175 GCP_DECRYPT_TOKEN : *gcp_decrypt_token
175176 steps :
176177 - *checkout_code
177178 - *restore_cache
178- - *copy_bazel_config
179+ - *setup_bazel_ci_config
179180 - *setup_bazel_remote_execution
180181
181182 - run : bazel test src/... --test_tag_filters=e2e
@@ -277,6 +278,8 @@ jobs:
277278 - run : ./scripts/circleci/lint-bazel-files.sh
278279 - run : yarn gulp ci:lint
279280
281+ - *save_cache
282+
280283 # -------------------------------------------------------------------------------------------
281284 # Job that builds all release packages with Gulp. The built packages can be then used in the
282285 # same workflow to publish snapshot builds or test the dev-app with the release packages.
@@ -327,15 +330,16 @@ jobs:
327330 # Job that publishes the build snapshots
328331 # ----------------------------------------
329332 publish_snapshots :
330- << : *job_defaults
333+ docker :
334+ - image : *docker_bazel_image
331335 resource_class : xlarge
332336 environment :
333337 GCP_DECRYPT_TOKEN : *gcp_decrypt_token
334338 steps :
335339 - *checkout_code
336340 - *restore_cache
337341 - *attach_release_output
338- - *copy_bazel_config
342+ - *setup_bazel_ci_config
339343 - *setup_bazel_remote_execution
340344
341345 # CircleCI has a config setting to enforce SSH for all github connections.
@@ -371,25 +375,24 @@ jobs:
371375 # specified in the project dev dependencies.
372376 # ----------------------------------------------------------------------------
373377 ivy_test :
374- << : *job_defaults
378+ docker :
379+ - image : *docker_bazel_image
375380 resource_class : xlarge
376381 environment :
377382 GCP_DECRYPT_TOKEN : *gcp_decrypt_token
378383 steps :
379384 - *checkout_code
380385 - *restore_cache
381- - *copy_bazel_config
386+ - *setup_bazel_ci_config
382387 - *setup_bazel_remote_execution
383- - *yarn_download
384- - *yarn_install
385388
386389 # Setup Angular ivy snapshots built with ngtsc but locked to a specific tag. We
387390 # cannot determine the tag automatically based on the Angular version specified in
388391 # the "package.json" because the SHA is not known for the given release. Nor can
389392 # we use ngcc to apply the ivy switches because ngcc currently does not handle the
390393 # UMD format which is used by Bazel when running tests. UMD processing is in
391394 # progress and tracked with FW-85.
392- - run : node ./scripts/circleci/setup-angular-snapshots.js --tag 8.0 .0-rc.0 -ivy-aot+bd37622
395+ - run : bazel run @nodejs//: node -- ./scripts/circleci/setup-angular-snapshots.js --tag 8.1 .0-next.1 -ivy-aot+82e0b4a
393396 # Disable type checking when building with Ivy. This is necessary because
394397 # type checking is not complete yet and can incorrectly break compilation.
395398 # Issue is tracked with FW-1004.
@@ -402,20 +405,19 @@ jobs:
402405 # Job that runs all Bazel tests against Ivy from angular/angular#master.
403406 # ----------------------------------------------------------------------------
404407 ivy_snapshot_test_cronjob :
405- << : *job_defaults
408+ docker :
409+ - image : *docker_bazel_image
406410 resource_class : xlarge
407411 environment :
408412 GCP_DECRYPT_TOKEN : *gcp_decrypt_token
409413 steps :
410414 - *checkout_code
411415 - *restore_cache
412- - *copy_bazel_config
416+ - *setup_bazel_ci_config
413417 - *setup_bazel_remote_execution
414- - *yarn_download
415- - *yarn_install
416418
417419 # Setup Angular ivy snapshots built with ngtsc.
418- - run : node ./scripts/circleci/setup-angular-snapshots.js --tag master-ivy-aot
420+ - run : bazel run @nodejs//: node -- ./scripts/circleci/setup-angular-snapshots.js --tag master-ivy-aot
419421 # Disable type checking when building with Ivy. This is necessary because
420422 # type checking is not complete yet and can incorrectly break compilation.
421423 # Issue is tracked with FW-1004.
0 commit comments