From db7bca5279d8e2c95fd129f8c2814f513d24ea35 Mon Sep 17 00:00:00 2001 From: Antoine Eddi <5222525+aeddi@users.noreply.github.com> Date: Sat, 7 Dec 2024 22:23:10 +0100 Subject: [PATCH] ci: use go.mod to determine go version (#3279) Related to https://github.com/gnolang/gno/pull/3229#discussion_r1862370753 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.
Contributors' checklist... - [ ] 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
Co-authored-by: Morgan --- .github/workflows/benchmark-master-push.yml | 2 +- .github/workflows/dependabot-tidy.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/genesis-verify.yml | 2 +- .github/workflows/gh-pages.yml | 2 +- .github/workflows/releaser-master.yml | 2 +- .github/workflows/releaser-nightly.yml | 2 +- .github/workflows/releaser.yml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/benchmark-master-push.yml b/.github/workflows/benchmark-master-push.yml index bde6e623a88..622baefc0de 100644 --- a/.github/workflows/benchmark-master-push.yml +++ b/.github/workflows/benchmark-master-push.yml @@ -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; diff --git a/.github/workflows/dependabot-tidy.yml b/.github/workflows/dependabot-tidy.yml index 59e9e1c8146..39fed8b0172 100644 --- a/.github/workflows/dependabot-tidy.yml +++ b/.github/workflows/dependabot-tidy.yml @@ -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: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 262b341276c..c9d9af0fb6f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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 diff --git a/.github/workflows/genesis-verify.yml b/.github/workflows/genesis-verify.yml index f870cd0658c..1288d588100 100644 --- a/.github/workflows/genesis-verify.yml +++ b/.github/workflows/genesis-verify.yml @@ -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 diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index a8407f57291..1b955b52cd0 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -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 diff --git a/.github/workflows/releaser-master.yml b/.github/workflows/releaser-master.yml index 36a709a242a..3d194e2cb4c 100644 --- a/.github/workflows/releaser-master.yml +++ b/.github/workflows/releaser-master.yml @@ -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/cosign-installer@v3.7.0 diff --git a/.github/workflows/releaser-nightly.yml b/.github/workflows/releaser-nightly.yml index e9a5c15a22d..4308f1c4a7d 100644 --- a/.github/workflows/releaser-nightly.yml +++ b/.github/workflows/releaser-nightly.yml @@ -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/cosign-installer@v3.7.0 diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index d33432bd16d..309664bdcce 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -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/cosign-installer@v3.7.0