ci: don't save node_modules directory (#41467)
Storing node_modules directory in cache causes a number of issues, such as increase in the laid out node_modules tree and also in some cases break module resolution. This is because modules are not hoisted correctly when running `yarn install`. Example of related failures https://app.circleci.com/pipelines/github/angular/angular/30441/workflows/c1a16135-f5c9-478d-a298-d720c6657d52/jobs/952138 A better cache strategy would be to save yarn cache, more information can be found in https://circleci.com/docs/2.0/caching/#yarn-node. PR Close #41467
This commit is contained in:
parent
4ae57cabd8
commit
a35758113c
|
@ -22,11 +22,11 @@ version: 2.1
|
||||||
# **NOTE 1 **: If you change the cache key prefix, also sync the cache_key_fallback to match.
|
# **NOTE 1 **: If you change the cache key prefix, also sync the cache_key_fallback to match.
|
||||||
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
|
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
|
||||||
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
|
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
|
||||||
var_3: &cache_key v1-angular-node-12-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
|
var_3: &cache_key v4-angular-node-12-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
|
||||||
# We invalidate the cache if the Bazel version changes because otherwise the `bazelisk` cache
|
# We invalidate the cache if the Bazel version changes because otherwise the `bazelisk` cache
|
||||||
# folder will contain all previously used versions and ultimately cause the cache restoring to
|
# folder will contain all previously used versions and ultimately cause the cache restoring to
|
||||||
# be slower due to its growing size.
|
# be slower due to its growing size.
|
||||||
var_4: &cache_key_fallback v1-angular-node-12-{{ checksum ".bazelversion" }}
|
var_4: &cache_key_fallback v4-angular-node-12-{{ checksum ".bazelversion" }}
|
||||||
|
|
||||||
# Cache key for the `components-repo-unit-tests` job. **Note** when updating the SHA in the
|
# Cache key for the `components-repo-unit-tests` job. **Note** when updating the SHA in the
|
||||||
# cache keys also update the SHA for the "COMPONENTS_REPO_COMMIT" environment variable.
|
# cache keys also update the SHA for the "COMPONENTS_REPO_COMMIT" environment variable.
|
||||||
|
@ -232,10 +232,10 @@ jobs:
|
||||||
- *cache_key_fallback
|
- *cache_key_fallback
|
||||||
- run:
|
- run:
|
||||||
name: Running Yarn install
|
name: Running Yarn install
|
||||||
command: yarn install --frozen-lockfile --non-interactive
|
command: yarn install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
|
||||||
# Yarn's requests sometimes take more than 10mins to complete.
|
# Yarn's requests sometimes take more than 10mins to complete.
|
||||||
no_output_timeout: 45m
|
no_output_timeout: 45m
|
||||||
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
|
- run: yarn --cwd aio install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
|
||||||
# Make the bazel directories and add a file to them if they don't exist already so that
|
# Make the bazel directories and add a file to them if they don't exist already so that
|
||||||
# persist_to_workspace does not fail.
|
# persist_to_workspace does not fail.
|
||||||
- run: |
|
- run: |
|
||||||
|
@ -424,7 +424,7 @@ jobs:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
- init_environment
|
- init_environment
|
||||||
# Install
|
# Install
|
||||||
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
|
- run: yarn --cwd aio install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
|
||||||
- run: yarn --cwd aio extract-cli-command-docs
|
- run: yarn --cwd aio extract-cli-command-docs
|
||||||
# Run tools tests
|
# Run tools tests
|
||||||
- run: yarn --cwd aio tools-test
|
- run: yarn --cwd aio tools-test
|
||||||
|
@ -444,7 +444,7 @@ jobs:
|
||||||
- init_environment
|
- init_environment
|
||||||
- install_chrome_libs
|
- install_chrome_libs
|
||||||
# Install aio
|
# Install aio
|
||||||
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
|
- run: yarn --cwd aio install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
|
||||||
# Run examples tests. The "CIRCLE_NODE_INDEX" will be set if "parallelism" is enabled.
|
# Run examples tests. The "CIRCLE_NODE_INDEX" will be set if "parallelism" is enabled.
|
||||||
# Since the parallelism is set to "5", there will be five parallel CircleCI containers.
|
# Since the parallelism is set to "5", there will be five parallel CircleCI containers.
|
||||||
# with either "0", "1", etc as node index. This can be passed to the "--shard" argument.
|
# with either "0", "1", etc as node index. This can be passed to the "--shard" argument.
|
||||||
|
@ -473,7 +473,7 @@ jobs:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
- init_environment
|
- init_environment
|
||||||
- install_chrome_libs
|
- install_chrome_libs
|
||||||
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
|
- run: yarn --cwd aio install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
|
||||||
- run:
|
- run:
|
||||||
name: Wait for preview and run tests
|
name: Wait for preview and run tests
|
||||||
command: node aio/scripts/test-preview.js $CI_PULL_REQUEST $CI_COMMIT $CI_AIO_MIN_PWA_SCORE
|
command: node aio/scripts/test-preview.js $CI_PULL_REQUEST $CI_COMMIT $CI_AIO_MIN_PWA_SCORE
|
||||||
|
@ -508,10 +508,9 @@ jobs:
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: *cache_key
|
key: *cache_key
|
||||||
paths:
|
paths:
|
||||||
- "node_modules"
|
- ~/.cache/yarn
|
||||||
- "aio/node_modules"
|
- ~/bazel_repository_cache
|
||||||
- "~/bazel_repository_cache"
|
- ~/.cache/bazelisk
|
||||||
- "~/.cache/bazelisk"
|
|
||||||
|
|
||||||
# Build the ivy npm packages.
|
# Build the ivy npm packages.
|
||||||
build-ivy-npm-packages:
|
build-ivy-npm-packages:
|
||||||
|
@ -716,7 +715,7 @@ jobs:
|
||||||
# We temporarily ignore the "engines" because the Angular components repository has
|
# We temporarily ignore the "engines" because the Angular components repository has
|
||||||
# minimum dependency on NodeJS v12 and Yarn 1.19.1, but the framework repository uses
|
# minimum dependency on NodeJS v12 and Yarn 1.19.1, but the framework repository uses
|
||||||
# older versions.
|
# older versions.
|
||||||
command: yarn --ignore-engines --cwd ${COMPONENTS_REPO_TMP_DIR} install --frozen-lockfile --non-interactive
|
command: yarn --ignore-engines --cwd ${COMPONENTS_REPO_TMP_DIR} install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: *components_repo_unit_tests_cache_key
|
key: *components_repo_unit_tests_cache_key
|
||||||
paths:
|
paths:
|
||||||
|
@ -743,7 +742,7 @@ jobs:
|
||||||
- init_environment
|
- init_environment
|
||||||
- install_java
|
- install_java
|
||||||
# Install
|
# Install
|
||||||
- run: yarn --cwd packages/zone.js install --frozen-lockfile --non-interactive
|
- run: yarn --cwd packages/zone.js install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
|
||||||
# Run zone.js tools tests
|
# Run zone.js tools tests
|
||||||
- run: yarn --cwd packages/zone.js promisetest
|
- run: yarn --cwd packages/zone.js promisetest
|
||||||
- run: yarn --cwd packages/zone.js promisefinallytest
|
- run: yarn --cwd packages/zone.js promisefinallytest
|
||||||
|
@ -755,7 +754,7 @@ jobs:
|
||||||
- run: yarn --cwd packages/zone.js jest:nodetest
|
- run: yarn --cwd packages/zone.js jest:nodetest
|
||||||
- run: yarn --cwd packages/zone.js electrontest
|
- run: yarn --cwd packages/zone.js electrontest
|
||||||
- run: yarn --cwd packages/zone.js closuretest
|
- run: yarn --cwd packages/zone.js closuretest
|
||||||
- run: yarn --cwd packages/zone.js/test/typings install --frozen-lockfile --non-interactive
|
- run: yarn --cwd packages/zone.js/test/typings install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
|
||||||
- run: yarn --cwd packages/zone.js/test/typings test
|
- run: yarn --cwd packages/zone.js/test/typings test
|
||||||
|
|
||||||
# Windows jobs
|
# Windows jobs
|
||||||
|
|
Loading…
Reference in New Issue