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

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jul 2, 2020

Q                       A
License MIT

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 and main.

main This PR
39.76s 6.03s

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 2, 2020

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:

Sandbox Source
condescending-antonelli-oh4yt Configuration
amazing-currying-v4wtz Configuration

@babel-bot
Copy link
Collaborator

babel-bot commented Jul 2, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/25179/

@JLHwung JLHwung force-pushed the refine-circle-ci-yarn-cache branch from 7b6c023 to 6b4d26c Compare July 2, 2020 16:05
@JLHwung JLHwung marked this pull request as ready for review July 2, 2020 16:20

- &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.

@JLHwung JLHwung added the PR: Internal 🏠 A type of pull request used for our changelog categories label Jul 2, 2020
@@ -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

@JLHwung JLHwung merged commit 0d44407 into babel:main Jul 3, 2020
@JLHwung JLHwung deleted the refine-circle-ci-yarn-cache branch July 3, 2020 11:53
@JLHwung JLHwung mentioned this pull request Aug 14, 2020
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 3, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants