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

ci: use the same go mod cache across test-core jobs #15006

Merged
merged 3 commits into from Oct 21, 2022
Merged

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Oct 21, 2022

This PR configures the test-core Action(?) with a new mods job on which the
other jobs depend on. The mods job just runs mod tidy and bootstrap to download
all the Go modules that will be needed and caches them. The dependent jobs then make
use of the same cache so they do not need to download / cache the near 1GB of modules
themselves.

Closes #15000

@shoenig shoenig marked this pull request as ready for review October 21, 2022 17:03
@shoenig shoenig requested review from lgfa29 and tgross October 21, 2022 17:04
@shoenig shoenig changed the title ci: use the same go mod cache for test-core jobs ci: use the same go mod cache across test-core jobs Oct 21, 2022
@@ -58,22 +72,23 @@ jobs:
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
cache-key-suffix: -compile
cache-key-suffix: -core
- name: Run make dev
env:
GOBIN: ${{env.GOROOT}}/bin # windows kludge
run: |
make bootstrap
Copy link
Member

Choose a reason for hiding this comment

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

If we're caching the results of make bootstrap in mods, do we need this anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do because GOBIN isn't part of the cache - the executables aren't cached across runners, only the GOMODCACHE and GOCACHE contents. magnetikonline/action-golang-cache#1 mentions the possibility of adding GOBIN but hasn't gotten traction. The resolution of actions/setup-go#278 might also impact what happens to the binaries.

@@ -40,13 +53,14 @@ jobs:
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not part of this work, so feel free to ignore it, but we could read the Go version from the .go-version file like the release workflow.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah we should be able to set go-version-file: go.mod instead; i'm gonna try that in a follow up pr

@shoenig shoenig merged commit dbd742d into main Oct 21, 2022
@shoenig shoenig deleted the ci-cache-once branch October 21, 2022 22:38
@shoenig shoenig added backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line labels Oct 27, 2022
shoenig added a commit that referenced this pull request Oct 27, 2022
* ci: use the same go mod cache for test-core jobs

* ci: precache go modules

* ci: add a mods precache job
shoenig added a commit that referenced this pull request Oct 27, 2022
* ci: use the same go mod cache across test-core jobs (#15006)

* ci: use the same go mod cache for test-core jobs

* ci: precache go modules

* ci: add a mods precache job

* ci: add -core suffix to mods action (#15015)

Forgot to add this line to the new mods action; without it, it
creates a cache different from the one used by the other jobs.

* ci: use groups of tests in gha (#15018)

* [no ci] use json for grouping packages for testing

* [no ci] able to get packages in group

* [no ci] able to run groups of tests

* [no ci] more

* [no ci] try disable circle unit tests

* ci: use actions/checkout@v3

* ci: rename to quick

* ci: need make dev in mods cache step

* ci: make compile step depend on checks step

* ci: bump consul and vault versions

* ci: need make dev for group tests

* ci: update ci unit testing docs

* docs: spell plumbing correctly

Co-authored-by: Tim Gross <tgross@hashicorp.com>

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* deps: run go mod tidy

Co-authored-by: Tim Gross <tgross@hashicorp.com>
shoenig added a commit that referenced this pull request Oct 27, 2022
* ci: use the same go mod cache across test-core jobs (#15006)

* ci: use the same go mod cache for test-core jobs

* ci: precache go modules

* ci: add a mods precache job

* ci: add -core suffix to mods action (#15015)

Forgot to add this line to the new mods action; without it, it
creates a cache different from the one used by the other jobs.

* ci: use groups of tests in gha (#15018)

* [no ci] use json for grouping packages for testing

* [no ci] able to get packages in group

* [no ci] able to run groups of tests

* [no ci] more

* [no ci] try disable circle unit tests

* ci: use actions/checkout@v3

* ci: rename to quick

* ci: need make dev in mods cache step

* ci: make compile step depend on checks step

* ci: bump consul and vault versions

* ci: need make dev for group tests

* ci: update ci unit testing docs

* docs: spell plumbing correctly

Co-authored-by: Tim Gross <tgross@hashicorp.com>

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* deps: run go mod tidy

Co-authored-by: Tim Gross <tgross@hashicorp.com>
shoenig added a commit that referenced this pull request Nov 3, 2022
* ci: backport of gha groups  (#15058)

* ci: use the same go mod cache across test-core jobs (#15006)

* ci: use the same go mod cache for test-core jobs

* ci: precache go modules

* ci: add a mods precache job

* ci: add -core suffix to mods action (#15015)

Forgot to add this line to the new mods action; without it, it
creates a cache different from the one used by the other jobs.

* ci: use groups of tests in gha (#15018)

* [no ci] use json for grouping packages for testing

* [no ci] able to get packages in group

* [no ci] able to run groups of tests

* [no ci] more

* [no ci] try disable circle unit tests

* ci: use actions/checkout@v3

* ci: rename to quick

* ci: need make dev in mods cache step

* ci: make compile step depend on checks step

* ci: bump consul and vault versions

* ci: need make dev for group tests

* ci: update ci unit testing docs

* docs: spell plumbing correctly

Co-authored-by: Tim Gross <tgross@hashicorp.com>

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* deps: run go mod tidy

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* build: fix makefile conflict

Co-authored-by: Tim Gross <tgross@hashicorp.com>
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ci: cut down on cache spam
3 participants