-
Notifications
You must be signed in to change notification settings - Fork 42
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: add path to go.sum to actions/setup-go #155
Conversation
b86edba
to
649e3be
Compare
I just noticed that actions/setup-go complains about the missing go.sum file: > Restore cache failed: Dependencies file is not found in /home/runner/work/sys/sys. Supported file pattern: go.sum Apparently this happens because of two reasons: 1. actions/checkout should be run _before actions/setup-go. 2. There's no top-level go.sum file. The first problem is easy to fix. As for the second one, documentation[1] suggests using a wild card in such cases, but using neither "*/go.sum" nor "**/go.sum" works, as not all modules have go.sum, and so it fails with the following error: > Restore cache failed: Some specified paths were not resolved, unable to cache dependencies. Alas, we have to add an extra step to list the available go.sum files. The alternative would be listing them all, which is maintainers' nightmare. (The contents of these files are used as an input when calculating the cache checksum, essentially meaning if any of these files are changed, the cache will be invalidated.) [1]: https://github.com/actions/setup-go/blob/main/README.md#caching-dependency-files-and-build-outputs Signed-off-by: Kir Kolyshkin <[email protected]>
649e3be
to
1a6c912
Compare
Rebased; description updated; PTAL @tianon @thaJeztah |
I'm somewhat wondering if it's worth the extra complexity, given that it's a pretty small repository, and most tests should run in a short amount of time, even if no caching 🤔 |
I agree caching won't help much here (perhaps if we add more modules and/or dependencies it will help in the future, but not now for sure). The only immediate benefits I can think of are:
Since 1 can be solved by disabling the cache, and 2 is very rare, here is an alternative PR: #160 |
Yes, I think within context of this repository, I prefer the simpler solution. For other repositories, perhaps a more extended solution could make sense, but I think for this one we should be fine with (trying to) keep it simple. Still hoping one day these situations will become easier, and go's tooling to provide better ways for this that don't require all these workaround through makefiles etc. |
I tried to squash the same warning in my own code in docker-library/bashbrew#102 and ended up giving up (although the situation there is slightly different -- it's an action trying to use actions/setup-go as a sub-action). 😭 Having |
It took me a while to write the patch in this PR that actually works, mostly due to two things:
I agree that wildcard should just work here, but I'm surprised there's not even an issue opened. Maybe I will open one a tad later. |
Closing in favor of #160. |
I just noticed that actions/setup-go complains about the missing
go.sum file:
Apparently this happens because of two reasons:
actions/checkout should be run _before actions/setup-go.
There's no top-level go.sum file.
The first problem is easy to fix.
As for the second one, documentation1 suggests using a wild card in
such cases, but using neither "*/go.sum" nor "**/go.sum" works, as not
all modules have go.sum, and so it fails with the following error:
Alas, we have to add an extra step to list the available go.sum files.
The alternative would be listing them all, which is maintainers' nightmare.
(The contents of these files are used as an input when calculating the
cache checksum, essentially meaning if any of these files are changed,
the cache will be invalidated.)