From 6fbed516da9be5f1e53cb3f69511d0e8ee080031 Mon Sep 17 00:00:00 2001 From: phm07 <22707808+phm07@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:14:58 +0200 Subject: [PATCH 1/2] ci: build and test with Go 1.23 --- .github/workflows/build.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- .github/workflows/release.yml | 2 +- .gitlab-ci.yml | 8 ++++---- go.mod | 2 ++ 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11be996e..9aa60ac8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: go.mod + go-version: "1.23" - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91654d11..cea049e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: go.mod + go-version: "1.23" - name: Run gofmt run: diff -u <(echo -n) <(gofmt -d -s .) @@ -37,7 +37,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: go.mod + go-version: "1.23" - name: Run tests run: go test -coverpkg=./... -coverprofile=coverage.txt -v -race ./... @@ -59,7 +59,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: go.mod + go-version: "1.23" - name: Delete old generated files run: find . -name 'zz_*.go' -delete @@ -82,7 +82,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: go.mod + go-version: "1.23" - name: Run go mod tidy run: go mod tidy diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4760bb2..5d7fac24 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: go.mod + go-version: "1.23" - name: Setup rcodesign uses: hashicorp/action-setup-rcodesign@v1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c3e92e2..c1ad7c88 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ cache: build: stage: build - image: golang:1.21 + image: golang:1.23 script: - go env - go mod download @@ -31,21 +31,21 @@ test:lint: test:tidy: stage: test - image: golang:1.21 + image: golang:1.23 script: - go mod tidy -v - git diff --exit-code test:generate: stage: test - image: golang:1.21 + image: golang:1.23 script: - go generate ./... - git diff --exit-code test:unit: stage: test - image: golang:1.21 + image: golang:1.23 script: - go test -v -coverpkg=./... -coverprofile=coverage.txt -covermode count ./... - go get github.com/boumenot/gocover-cobertura diff --git a/go.mod b/go.mod index c0a446a1..d25358bf 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/hetznercloud/cli go 1.21 +toolchain go1.23.1 + require ( github.com/BurntSushi/toml v1.4.0 github.com/boumenot/gocover-cobertura v1.2.0 From c161152fe8178f13f2b14bf6b327f21705bb32d9 Mon Sep 17 00:00:00 2001 From: phm07 <22707808+phm07@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:59:55 +0200 Subject: [PATCH 2/2] add GOTOOLCHAIN=local to use locally installed go toolchain --- .github/workflows/build.yml | 3 +++ .github/workflows/ci.yml | 3 +++ .github/workflows/release.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9aa60ac8..1d2ca99a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,9 @@ on: branches: [main] pull_request: +env: + GOTOOLCHAIN: local + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cea049e4..f78e9a50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,9 @@ on: branches: [main] pull_request: +env: + GOTOOLCHAIN: local + jobs: lint: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d7fac24..0858067a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,9 @@ on: tags: - "v*.*.*" +env: + GOTOOLCHAIN: local + jobs: release: runs-on: ubuntu-latest