diff --git a/.buildkite/go/build.sh b/.buildkite/go/build.sh index 145b12a6431..7949438e551 100755 --- a/.buildkite/go/build.sh +++ b/.buildkite/go/build.sh @@ -29,6 +29,10 @@ pushd go make all GO_BUILD_E2E_COVERAGE=1 popd -pushd tests/upgrade - make all +pushd tests/upgrade/pre + OASIS_GO=go1.19.10 make all popd + +pushd tests/upgrade/post + OASIS_GO=go1.20.2 make all +popd \ No newline at end of file diff --git a/.buildkite/go/lint.sh b/.buildkite/go/lint.sh index 06321208b24..8894c1c9374 100755 --- a/.buildkite/go/lint.sh +++ b/.buildkite/go/lint.sh @@ -19,5 +19,5 @@ pushd go popd pushd tests/upgrade - make lint + OASIS_GOLANGCI_LINT=golangci-lint1.51.2 make lint popd diff --git a/.buildkite/scripts/test_upgrade.sh b/.buildkite/scripts/test_upgrade.sh index caa616b8fe2..956b9a2079d 100755 --- a/.buildkite/scripts/test_upgrade.sh +++ b/.buildkite/scripts/test_upgrade.sh @@ -11,11 +11,6 @@ # https://buildkite.com/docs/pipelines/writing-build-scripts set -euxo pipefail -# Install Go version needed to build the stable branch. -# See: https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions -go install golang.org/dl/go1.19.10@latest -go1.19.10 download - # Branches to test. pre_upgrade_git_branch="stable/22.2.x" post_upgrade_git_branch="master" diff --git a/common.mk b/common.mk index 3bdfaee2e92..9697ac503fb 100644 --- a/common.mk +++ b/common.mk @@ -124,6 +124,12 @@ define ENSURE_GIT_VERSION_EQUALS_PUNCH_VERSION = fi endef +# Golangci-lint binary to use for all Golangci-lint commands. +export OASIS_GOLANGCI_LINT ?= golangci-lint + +# Golangci-lint command prefix to use in all Golangci-lint commands. +GOLANGCI_LINT := env -u GOPATH $(OASIS_GOLANGCI_LINT) + # Go binary to use for all Go commands. export OASIS_GO ?= go diff --git a/docker/oasis-core-dev/Dockerfile b/docker/oasis-core-dev/Dockerfile index 89d0ecd1281..01df96b6318 100644 --- a/docker/oasis-core-dev/Dockerfile +++ b/docker/oasis-core-dev/Dockerfile @@ -14,6 +14,11 @@ ARG RUST_NIGHTLY_VERSION=2023-01-16 ARG JEMALLOC_VERSION=5.2.1 ARG JEMALLOC_CHECKSUM=34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6 +# Legacy package versions (upgrade tests). +# See: https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions +ARG LEGACY_GO_VERSIONS="1.19.10 1.20.2" +ARG LEGACY_GOLANGCILINT_VERSION=1.51.2 + ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update -qq && apt-get upgrade -qq && apt-get install -qq \ @@ -57,12 +62,20 @@ RUN curl "https://sh.rustup.rs" -sfo rustup.sh && \ RUN wget https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \ tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \ rm go${GO_VERSION}.linux-amd64.tar.gz && \ + # Install legacy Go versions. + for LEGACY_GO_VERSION in ${LEGACY_GO_VERSIONS}; do \ + go install golang.org/dl/go${LEGACY_GO_VERSION}@latest && \ + go${LEGACY_GO_VERSION} download; \ + done && \ + # Prepare folder for binaries. mkdir -p /go/bin && \ # Install a specific version of protoc-gen-go. go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GO_PROTOC_GEN_GO_VERSION} && \ # Install golangci-lint. curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /tmp/bin v${GOLANGCILINT_VERSION} && \ mv /tmp/bin/golangci-lint /go/bin && \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /tmp/bin v${LEGACY_GOLANGCILINT_VERSION} && \ + mv /tmp/bin/golangci-lint /go/bin/golangci-lint${LEGACY_GOLANGCILINT_VERSION} && \ # Install gocovmerge for e2e coverage. go install github.com/wadey/gocovmerge@${GOCOVMERGE_VERSION} && \ # Install nancy for auditing dependencies. diff --git a/go/Makefile b/go/Makefile index 133fdacf7a0..eaa1c2daacf 100644 --- a/go/Makefile +++ b/go/Makefile @@ -69,7 +69,7 @@ fmt: # Lint. lint: @$(ECHO) "$(CYAN)*** Running Go linters...$(OFF)" - @env -u GOPATH golangci-lint run --timeout 4m + @$(GOLANGCI_LINT) run --timeout 4m lint-mod-tidy: @$(ECHO) "$(CYAN)*** Checking go mod tidy...$(OFF)" diff --git a/tests/upgrade/post/Makefile b/tests/upgrade/post/Makefile index 6b49ec2af68..817b1aed1b3 100644 --- a/tests/upgrade/post/Makefile +++ b/tests/upgrade/post/Makefile @@ -27,7 +27,7 @@ fmt: # Lint. lint: @$(ECHO) "$(CYAN)*** Running Go linters...$(OFF)" - @env -u GOPATH golangci-lint run --timeout 4m + @$(GOLANGCI_LINT) run --timeout 4m lint-mod-tidy: @$(ECHO) "$(CYAN)*** Checking go mod tidy...$(OFF)" diff --git a/tests/upgrade/pre/Makefile b/tests/upgrade/pre/Makefile index dbecc44f183..d45920d4727 100644 --- a/tests/upgrade/pre/Makefile +++ b/tests/upgrade/pre/Makefile @@ -27,7 +27,7 @@ fmt: # Lint. lint: @$(ECHO) "$(CYAN)*** Running Go linters...$(OFF)" - @env -u GOPATH golangci-lint run --timeout 4m + @$(GOLANGCI_LINT) run --timeout 4m lint-mod-tidy: @$(ECHO) "$(CYAN)*** Checking go mod tidy...$(OFF)"