-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
[CI] cache yarn instead of node_modules #25834
Conversation
Not sure why just "4 successful checks" show up here, clicking into the steps they show the same number of jobs… |
5dbf921
to
11678e1
Compare
Comparing: 4bf2113...e11c23d Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
Another option could be to remove arch from the cache key and run |
|
The current caching of steps of
node_modules
doesn't work reliable as is because it includesarch
in the cache key.arch
might be different across workers in the same commit.I couldn't find a way to optionally restore caches, so what this PR does is:
yarn install
, save yarn cache (fast if already exists)With this change the initial batch of jobs all race to populate the cache, but any subsequent jobs should find the existing cache. The expected downside would be slightly more worker CPU time with all the parallel jobs, but wall time might be shorter (1 step less in the critical path) and we should be more reliable as we no longer have the failure with multiple archs.
Alternative 1
Remove the
{arch}
from the cache key.Downside: this might run into weird issues with native dependencies.
Alternative 2
Somehow check if the cache was restored and only then run a yarn install.
Downside: couldn't figure out if it's possible to only restore the yarn cache if restoring the node_modules cache failed. Without that we'd either always restore both the yarn and node_modules cache or do yarn installs w/o cache which are prone to failure in the past.