Skip to content

Commit

Permalink
ci: use go.mod to determine go version (#3279)
Browse files Browse the repository at this point in the history
Related to
#3229 (comment)

This PR replaces most fixed versions of Go in the CI workflows with
retrieving the version from the relevant go.mod file.

For workflows that do not have an associated go.mod file, the go.mod
file at the root of the repository is used. All `*_template.yml`
workflows seem designed to use a fixed version of go and do not allow
passing a go.mod file to the `setup-go` action. Achieving this would
require a more significant refactor.

<details><summary>Contributors' checklist...</summary>

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
</details>

Co-authored-by: Morgan <[email protected]>
  • Loading branch information
aeddi and thehowl authored Dec 7, 2024
1 parent 66c2eb6 commit ca1df86
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark-master-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
go-version-file: go.mod

- name: Run benchmark
# add more benchmarks by adding additional lines for different packages;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version-file: go.mod

- name: Tidy all Go mods
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version-file: go.mod

- name: Install dependencies
run: go mod download
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/genesis-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version-file: contribs/gnogenesis/go.mod

- name: Build gnogenesis
run: make -C contribs/gnogenesis
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
go-version-file: go.mod
- run: "cd misc/gendocs && make install gen"
- uses: actions/configure-pages@v5
id: pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releaser-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
go-version-file: go.mod
cache: true

- uses: sigstore/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releaser-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
go-version-file: go.mod
cache: true

- uses: sigstore/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
go-version-file: go.mod
cache: true

- uses: sigstore/[email protected]
Expand Down

0 comments on commit ca1df86

Please sign in to comment.