Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refine yarn cache config #11782

Merged
merged 4 commits into from Jul 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions .circleci/config.yml
Expand Up @@ -4,10 +4,12 @@ aliases:
- &restore-node-modules-cache
keys:
- v1-yarn-deps-{{ checksum "yarn.lock" }}
- v1-yarn-deps-
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this key without the hash?

Copy link
Contributor Author

@JLHwung JLHwung Jul 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question!

It is intended to fetch the latest cache generated successfully by any branch if the yarn.lock is changed. Chances are that there could be some cache contents that can still be reused by yarn, i.e. some libraries that are still resolved by the changed lock file.

See also https://circleci.com/docs/2.0/caching/#restoring-cache


- &restore-yarn-cache
keys:
- v1-yarn-cache
- v1-1-yarn-cache-{{ checksum "yarn.lock" }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v2- has been used as prefix in Babel 8. So we resort to v1-1.

- v1-1-yarn-cache-

- &save-node-modules-cache
paths:
Expand All @@ -16,8 +18,8 @@ aliases:

- &save-yarn-cache
paths:
- ~/.yarn-cache
key: v1-yarn-cache
- ~/.cache/yarn
key: v1-1-yarn-cache-{{ checksum "yarn.lock" }}

- &artifact_babel
path: ~/babel/packages/babel-standalone/babel.js
Expand Down Expand Up @@ -119,13 +121,13 @@ jobs:
cat ~/diff.tap | $(npm bin)/tap-merge | $(npm bin)/tap-mocha-reporter xunit | tee ~/test-results/test262/results.xml
<<: *test262_workdir
- store_test_results: *artifact_test262_xunit
- save_cache: *save-node-modules-cache
- save_cache: *save-yarn-cache

publish-verdaccio:
executor: node-executor
steps:
- checkout
- restore_cache: *restore-yarn-cache
- restore_cache: *restore-node-modules-cache
- run: yarn install
- run: ./scripts/integration-tests/publish-local.sh
- persist_to_workspace:
Expand Down Expand Up @@ -216,4 +218,3 @@ workflows:
- e2e-vue-cli:
requires:
- publish-verdaccio