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
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7173491:
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/25179/ |
7b6c023
to
6b4d26c
Compare
|
||
- &restore-yarn-cache | ||
keys: | ||
- v1-yarn-cache | ||
- v1-1-yarn-cache-{{ checksum "yarn.lock" }} |
There was a problem hiding this comment.
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
.
@@ -4,10 +4,12 @@ aliases: | |||
- &restore-node-modules-cache | |||
keys: | |||
- v1-yarn-deps-{{ checksum "yarn.lock" }} | |||
- v1-yarn-deps- |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
The Yarn Cache is not working properly because the cache directory of Yarn 1 is not
~/.yarn-cache
, as we can see from this job log, the cache is only 32B.Ideally we should run
yarn cache dir
and use this value as the paths that we should cache. However Circle-CI does not support template on cache paths.Here is comparison of
yarn install
time between this PR andmain
.