-
Notifications
You must be signed in to change notification settings - Fork 1.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
Can node_modules
be cached if a Node.js version is supplied?
#406
Comments
Hello @joneshf. Thank you for your report. For now we're not planing to change caching behaviour for the setup-node action. If you need to cache different path, the recommended solution will be using the actions/cache action. |
Understood. Thanks for the explanation. |
May I know if that has changed and if not, what is the reason? |
* fix: re-stage files after pulling This should fix an issue that prevented changes from being committed when `git pull --rebase --autostash` used. Issue actions#406 * chore: mark pre-commit hook as executable * fix: detect conflicts after pull
@dmitry-shibanov would also love to see this built in as an option to the (more discussion about |
Description:
As I understand the documentation about caching both in this repo and in the upstream
actions/cache
repo, the reasonnode_modules
is not recommended to cache is because dependencies can break across versions of Node.js.If the Node.js version changing is the only reason not to cache
node_modules
can this action take into account thenode-version-file
(or maybe even thenode-version
)? If it doesn't exist, don't cache thenode_modules
directory. If it does exist, cache thenode_modules
directory but use the value as part of theprimaryKey
:setup-node/src/cache-restore.ts
Line 39 in f099707
Maybe as like:
If the Node.js version changes, the cache should be invalidated and everything rebuilt. Which seems to address the concern the
actions/cache
repo points out (as I understand it).Justification:
The current caching strategy doesn't provide a noticeable improvement for non-trivial projects. It'll shave a couple seconds off of a multiple minute build due to needing to download all of the
node_modules
directory. Ideally, by cachingnode_modules
when it appears safe to do so, the download ofnode_modules
shouldn't need to happen as frequently and caching can save minutes.Are you willing to submit a PR?
Yes!
The text was updated successfully, but these errors were encountered: