-
Notifications
You must be signed in to change notification settings - Fork 20
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
Properly save and restore the Go build cache in our CI #552
Conversation
- id: setup-go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can parametrize the go version and keep this as a default.
go-version:
description: "Go version to install"
required: false
default: "1.21"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes but I don't want to have to change it in multiple places, which is why I "hard-coded" it here 😄
@@ -187,9 +227,9 @@ jobs: | |||
fetch-depth: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need all git data in this job?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do in order to compute the version (we need tags + amount of commits since the tag)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aha, I missed that part
This PR is the second in a series to address #328.
It introduces a composite action to setup Go with caching. It centralizes the logic and creates a different prefixed key per job for the Go build cache. This cache is fairly small once compressed (under 100MB currently) and saves a lot of computation time. We explicitly omit the Go module cache as it is big (~1GB compressed currently) and network-bound, which means that it would raise our cache quota without any benefits compared to downloading again from the Go proxy.
The various Go tools get cached based on the Makefile
install-tools
target content. Only the built binaries are cached (under 40MB currently) and we explicitly omit the Go build and module caches that are comparatively huge and unnecessary.The integration tests run within Docker containers and thus saving and restoring the Go build cache is a bit more complex. The high-level logic is however the same as with the other Go-based jobs.
Caches for
golangci-lint
, the Docker images, and the Python tests will be improved in subsequent PRs.