-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 downloaded npm dependencies #2166
Conversation
Seems the action needs |
The reasons are
|
Given the strategy matrix, caching will speed up the CI. |
Yes I like this PR but I don't like the diff noise generated by the lock file. |
I wonder if the |
The diff noise is almost reduced to zero since npm version 8. I do not think I can use the cache action directly to cache for example node_modules if there's no way to create a unique hash representing its content (package-lock.json is usually used). I need to look at it, that will allow caching without re-adding Totally unrelated to the PR, I've created some examples for multithreading ws server: https://github.com/poolifier/poolifier/tree/master/examples/typescript/websocket-server-pool |
That's even a better solution as long as long devs are OK with the switch. pnpm has a lock file with versioning but if you state that pnpm version X is required for development, the changes in ci.yml are easier and the pnpm lock file is not subject to the 'diff noise' mentioned. I'm using pnpm on several repos and I'm very happy with it. |
I was thinking about only using it in CI but it seems it is not preinstalled. Anyway the caching behavior is documented here https://github.com/actions/setup-node#caching-global-packages-data. |
I'm using https://github.com/uNetworking/uWebSockets/blob/master/benchmarks/load_test.c, but I'm not sure if it is ok for your needs. |
I see, the issue is the same: the pnpm lock file needs to be in the repo. |
Ok, thank you. |
The last commit is based on this discussion actions/setup-node#782. It is also used in other repositories, see https://github.com/search?q=cache-dependency-path%3A+.%2Fpackage.json&type=code There is also this https://github.com/bahmutov/npm-install#use-lock-file but I don't like to use another action if it works as is. |
The cache will not always be updated and reused if the dependencies is not updated in package.json. I think that can work that way for a repo without runtime dependencies at validating code changes. The dev deps can sometimes be not up2date in the CI, but I guess it's not a big deal. I would not recommend it on a repo with runtime deps. |
Yes, I understand and agree. It depends on how long the cache is valid. |
It seems 3 different caches are used, one per OS. It makes sense but in our case only one is needed. Anyway I think it is still an improvement. |
Thank you. |
No description provided.