From a8f767d4efec0ed7531ed7b92d8672fec65869a3 Mon Sep 17 00:00:00 2001 From: spacewander Date: Wed, 30 Oct 2024 10:38:47 +0800 Subject: [PATCH] ci: test with Go 1.22 Signed-off-by: spacewander --- .github/workflows/build-and-push-dev-image.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/release-branch.yml | 2 +- .github/workflows/release-tag.yml | 2 +- .github/workflows/test.yml | 14 +++++++------- .golangci.yml | 3 ++- Makefile | 2 +- common.mk | 2 +- e2e/Makefile | 4 ++-- manifests/Makefile | 2 +- patch/apply-patch.sh | 2 +- 11 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-and-push-dev-image.yml b/.github/workflows/build-and-push-dev-image.yml index 740c334a..c29a6b80 100644 --- a/.github/workflows/build-and-push-dev-image.yml +++ b/.github/workflows/build-and-push-dev-image.yml @@ -36,7 +36,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" # The built image can be found in: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3ee734b4..f79f2184 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" - name: binary-cache diff --git a/.github/workflows/release-branch.yml b/.github/workflows/release-branch.yml index 60751e1c..a392cbc7 100644 --- a/.github/workflows/release-branch.yml +++ b/.github/workflows/release-branch.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" - name: Check helm files run: | diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 3645302c..f5e58353 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -37,7 +37,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" # The built image can be found in: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c01e46d4..d424183a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,7 +43,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" - name: Choose the Envoy API run: | @@ -112,7 +112,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" - name: Unit test @@ -138,7 +138,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" - name: Test @@ -167,7 +167,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" - name: Set up services @@ -209,7 +209,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" - name: binary cache @@ -273,7 +273,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" - name: Example @@ -297,7 +297,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' cache-dependency-path: "**/*.sum" - name: binary cache diff --git a/.golangci.yml b/.golangci.yml index 517fe085..76e0594f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,7 +7,7 @@ linters: - bodyclose - contextcheck - errcheck - - exportloopref + - exportloopref # replace it with copyloopref once we upgrade the minimal Go requirement to 1.22 - forcetypeassert - gocheckcompilerdirectives - gocritic @@ -31,6 +31,7 @@ linters-settings: - opinionated gosec: excludes: + - G115 # Ignore "integer overflow conversion int". Since we call the coversion explicitly, we know what we do. - G402 # TLS InsecureSkipVerify may be true. revive: rules: diff --git a/Makefile b/Makefile index c6b890a7..568284c1 100644 --- a/Makefile +++ b/Makefile @@ -77,7 +77,7 @@ build-dev-tools: build-dev-tools-local: docker build --network=host --build-arg GOPROXY=${GOPROXY} -t ${DEV_TOOLS_IMAGE} -f tools/Dockerfile.dev ./tools -GOLANGCI_LINT_VERSION = 1.56.1 +GOLANGCI_LINT_VERSION = 1.61.0 .PHONY: lint-go lint-go: if ! test -x $(LOCALBIN)/golangci-lint || ! $(LOCALBIN)/golangci-lint --version | grep $(GOLANGCI_LINT_VERSION) >/dev/null; then \ diff --git a/common.mk b/common.mk index b3245237..10176d8f 100644 --- a/common.mk +++ b/common.mk @@ -28,7 +28,7 @@ PROJECT_NAME = mosn.io/htnn DOCKER_MIRROR = m.daocloud.io/ # Both images use glibc 2.31. Ensure libc in the images match each other. -BUILD_IMAGE ?= $(DOCKER_MIRROR)docker.io/library/golang:1.21-bullseye +BUILD_IMAGE ?= $(DOCKER_MIRROR)docker.io/library/golang:1.22-bullseye ENVOY_API_VERSION ?= 1.31 PROXY_IMAGE ?= $(DOCKER_MIRROR)docker.io/envoyproxy/envoy:contrib-v1.31.2 # We also support other Envoy versions. See https://github.com/mosn/htnn/tree/main/site/content/en/docs/developer-guide/dataplane_support.md diff --git a/e2e/Makefile b/e2e/Makefile index 8cc358c6..dd8c4ce7 100644 --- a/e2e/Makefile +++ b/e2e/Makefile @@ -45,14 +45,14 @@ delete-cluster: kind .PHONY: e2e-prepare-controller-image e2e-prepare-controller-image: kind cd ../manifests/ && CONTROLLER_IMAGE=htnn/controller:e2e CONTROLLER_BASE_IMAGE=$(DOCKER_MIRROR)docker.io/istio/pilot:$(ISTIO_VERSION) \ - GO_BUILD_BASE_IMAGE=$(DOCKER_MIRROR)docker.io/golang:1.21 \ + GO_BUILD_BASE_IMAGE=$(BUILD_IMAGE) \ make build-controller-image $(KIND) load docker-image -n htnn htnn/controller:e2e .PHONY: e2e-prepare-data-plane-image e2e-prepare-data-plane-image: kind cd ../manifests/ && PROXY_BASE_IMAGE=$(DOCKER_MIRROR)docker.io/istio/proxyv2:$(ISTIO_VERSION) \ - GO_BUILD_BASE_IMAGE=$(DOCKER_MIRROR)docker.io/golang:1.21 \ + GO_BUILD_BASE_IMAGE=$(BUILD_IMAGE) \ PROXY_IMAGE=htnn/gateway:e2e make build-proxy-image $(KIND) load docker-image htnn/gateway:e2e --name htnn diff --git a/manifests/Makefile b/manifests/Makefile index 760d2519..82f7f4a3 100644 --- a/manifests/Makefile +++ b/manifests/Makefile @@ -24,7 +24,7 @@ PROXY_IMAGE ?= htnn/proxy:latest PROXY_BASE_IMAGE ?= istio/proxyv2:$(ISTIO_VERSION) CONTROLLER_IMAGE ?= htnn/controller:latest CONTROLLER_BASE_IMAGE ?= docker.io/istio/pilot:$(ISTIO_VERSION) -GO_BUILD_BASE_IMAGE ?= golang:1.21 +GO_BUILD_BASE_IMAGE ?= golang:1.22 .PHONY: build-proxy-image build-proxy-image: diff --git a/patch/apply-patch.sh b/patch/apply-patch.sh index 753cd219..6ce0cae7 100755 --- a/patch/apply-patch.sh +++ b/patch/apply-patch.sh @@ -25,6 +25,6 @@ done pushd "$TARGET_ISTIO_DIR" go mod tidy -go install golang.org/x/tools/cmd/goimports@v0.24.0 # required by codegen. Version higher than 0.24.0 doesn't support Go 1.21. +go install golang.org/x/tools/cmd/goimports@v0.26.0 go run pkg/config/schema/codegen/tools/collections.main.go popd