Skip to content
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

Use actions/cache for go lint actions #31266

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Jun 5, 2024

Attempt to use actions/cache for the go linters which in ideal case would save around 10 minutes of CI time per go lint run.

@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 5, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 5, 2024
@silverwind silverwind added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Jun 5, 2024
@silverwind silverwind changed the title Use cache for go lint actions Use actions/cache for go lint actions Jun 5, 2024
@silverwind
Copy link
Member Author

silverwind commented Jun 5, 2024

Results look good. Not as much as I hoped but still a ~2 minute improvement per job:

lint-go-windows: 5m 53s -> 3m 53s
lint-go-gogit: 5m 30s -> 3m 39s
lint-backend: 10m 25s -> 7m 24s

More could be done to create another cache for deps-tools later.

@silverwind
Copy link
Member Author

Now with go build cache also cached, it's quite fast. The only question is whether it is safe to cache the build cache. I assume it is but more testing will be good.

lint-go-windows: 5m 53s -> 1m 55s
lint-go-gogit: 5m 30s -> 1m 46s
lint-backend: 10m 25s -> 5m 34s

@silverwind silverwind marked this pull request as draft June 5, 2024 23:44
@silverwind
Copy link
Member Author

silverwind commented Jun 6, 2024

Will do a bit more tweaks to always cache deps-tools content, but the current results already look very promising in terms of performance. Cache size is at 464MB, which is big, but may be acceptable, but we need to keep in mind the repo is likely limited to 10GB total cache size and those three jobs would already consume 1.4GB of that.

@silverwind
Copy link
Member Author

silverwind commented Jun 6, 2024

I wonder if it's safe to retain GOCACHE between changing go versions. My intuition tells me that should be possible because that's what happens on developer machines as well, e.g. go is updated, cache remains and go correctly invalidates it.

@silverwind
Copy link
Member Author

silverwind commented Jun 11, 2024

Another question in mind is whether to remove gopls lint again. It does not seem to respect any cache and always takes 3 minutes of precious CI time. golangci-lint has a seemingly working cache and I can get it down to sub 1-minute per run with cache (5 minutes with no cache).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/internal size/M Denotes a PR that changes 30-99 lines, ignoring generated files. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants