-
Notifications
You must be signed in to change notification settings - Fork 509
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
Github Actions templates cache doesn't hit due to hashing bug #799
Comments
Has this issue been reported and confirmed upstream? Because |
I've tested it (using debug) and saw the list... |
I mean that doesn't answer the question... I would think there is a reason GitHub used Before saying "x is wrong, downstream should change" it would be good to hear what the upstream authors think. This is far from the only repo that uses that pattern given it is the official pattern |
Ok, I will try to approach them as well. |
I haven't done much test and just quoted @felixmosh in the blog post, which means I assume actions/cache will not hit due to the glob. As for the reason for using glob, in my opinion, is in case of mono repo which contains multiple lock files. Besides, |
I can't say I know much about JS monorepos, but it seems like they actually don't have multiple lock files per #778 / lerna/lerna#2105 / yarnpkg/yarn#5428 They also use that pattern for all other languages too, even though monorepos are by far most common in JS because of the available tooling.
|
You should commit your lock files, the question is if it is published to the npm repo. From my experience, I've debugged the github action, and saw the differences. https://npm.community/t/yarn-lock-not-published-by-npm-publish-anymore/7855/4 |
Yes, that's what I was talking about. The NPM link I added says they cannot be published, so the inclusion of lockfiles in publishes is specific to Yarn |
@agilgur5 You are right. But monorepo is the only case I can think of. Maybe lock file in example/test project makes sense?
I don't know why, but I am getting |
I've migrated the templates to use I'm still interested in seeing what the GitHub folks have to say upstream in actions/cache#400 though, but they unfortunately haven't responded in over a month 😕 |
Huh, checked
That's a possibility, though neither |
@allcontributors please add @felixmosh for bug |
I've put up a pull request to add @felixmosh! 🎉 |
Current Behavior
Due to the fact that this line has a glob, it will create a wrong key!
Explanation, when the workflow starts it doesn't have any node_modules, therefore
hashFiles('**/yarn.lock')
will use only the package'syarn.lock
(as expected), but at the end of the flow, node_modules are installed,hashFiles('**/yarn.lock')
will contain allyarn.lock
files from node_modules as well, therforehashFiles('**/yarn.lock')
will save the cache on a different key.Expected behavior
It should relay only on the package's
yarn.lock
file.Suggested solution(s)
Remove the glob from this line https://github.com/formium/tsdx/blob/master/templates/basic/.github/workflows/main.yml#L20.
Additional context
Based on the research that @AllanChain did, AllanChain/blog#98
Your environment
The text was updated successfully, but these errors were encountered: