Use Go Module Cache For Tests in CI #1875
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR slightly improves the tests run time in CI by utilising GitHub Actions cache for Go modules.
With this PR, the overall run time for a full CI starting from the second push to a branch with a PR is around 12 minutes (I saw a couple of runs going as low as 11:47).
Our current development and CI tooling is unnecessarily complicated – Docker is abused without strict need for it in CI. That means we can't simply benefit, for example, from caching.
However, I've managed to find a way to use cache. It does not speed things up too much, because the majority of time is spent in tests, but we at least no longer have to re-download dependencies on subsequent pushes to a branch with a PR.
One place that is still not using cached modules is the build step in the Dockerfile. Ideally, that build step has to happen outside. Thankfully, that should be achievable, and I will look at that some time in the future. That might help to cut a few more minutes.
Type of Change
Tested Environments
Before submitting this PR:
Manual Test Plan: