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 Go Module Cache For Tests in CI #1875

Merged
merged 1 commit into from
Jun 26, 2023
Merged

Use Go Module Cache For Tests in CI #1875

merged 1 commit into from
Jun 26, 2023

Conversation

pavelbrm
Copy link
Contributor

@pavelbrm pavelbrm commented Jun 23, 2023

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

  • Product feature
  • Bug fix
  • Performance improvement
  • Refactor
  • Other

Tested Environments

  • Development
  • Staging
  • Production

Before submitting this PR:

  • Does your code build cleanly without any errors or warnings?
  • Have you used auto closing keywords?
  • Have you added tests for new functionality?
  • Have validated query efficiency for new database queries?
  • Have documented new functionality in README or in comments?
  • Have you squashed all intermediate commits?
  • Is there a clear title that explains what the PR does?
  • Have you used intuitive function, variable and other naming?
  • Have you requested security / privacy review if needed
  • Have you performed a self review of this PR?

Manual Test Plan:

@pavelbrm pavelbrm self-assigned this Jun 23, 2023
@pavelbrm pavelbrm changed the title Experiment With Caching For Modules in CI Use Go Module Cache For Tests in CI Jun 23, 2023
RUN apk add build-base
RUN apk add git
RUN apk add bash
RUN apk add make build-base git bash
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Dockerfile recommendations, the fewer the layers, the better.

@pavelbrm pavelbrm marked this pull request as ready for review June 23, 2023 15:47
@husobee husobee merged commit d3ce273 into master Jun 26, 2023
@husobee husobee deleted the expriment-ci branch June 26, 2023 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants