Part of our attempt to improve the CI performance. See also #6695.
Currently, we run npm ci (clean install), which always builds node_modules from scratch. Under this setup, the only cache-able folder is the ~/.npm global cache.
This PR caches ~/.npm, as well as the pnpm equivalent, which the Jetpack submodule uses.
I'd love to say that this makes a visible difference to the runtime, but it doesn't. Look at the time it takes to run npm ci in this PR build and you'll see variability between steps. Compare it with how long the non-cached steps take on trunk, and you'll find that some can be even faster.
The only reason I can think of for this variability is the network speed at which npm accesses the packages... but that is surprising because the whole premise of having an already accessible ~/.npm folder would be to get most of the packages from there.
Regardless, this change should not make the setup worse and gives us a centralized location to further invest in caching.
Testing
Ensure CI is green.
Next steps
Consider caching the i18n cache folders. However, I'm not sure how to control rebuilding them. I need to look into it / ask questions.
PR submission checklist:
[x] I have considered adding unit tests where possible. — N.A.
[x] I have considered if this change warrants user-facing release notes more info and have added them to RELEASE-NOTES.txt if necessary. — N.A.
Part of our attempt to improve the CI performance. See also #6695.
Currently, we run
npm ci
(clean install), which always buildsnode_modules
from scratch. Under this setup, the only cache-able folder is the~/.npm
global cache.This PR caches
~/.npm
, as well as the pnpm equivalent, which the Jetpack submodule uses.I'd love to say that this makes a visible difference to the runtime, but it doesn't. Look at the time it takes to run
npm ci
in this PR build and you'll see variability between steps. Compare it with how long the non-cached steps take ontrunk
, and you'll find that some can be even faster.The only reason I can think of for this variability is the network speed at which
npm
accesses the packages... but that is surprising because the whole premise of having an already accessible~/.npm
folder would be to get most of the packages from there.Regardless, this change should not make the setup worse and gives us a centralized location to further invest in caching.
Testing
Ensure CI is green.
Next steps
Consider caching the i18n cache folders. However, I'm not sure how to control rebuilding them. I need to look into it / ask questions.
PR submission checklist: