Skip to content

Commit

Permalink
go: Install and use legacy packages for upgrade tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peternose committed Aug 25, 2023
1 parent 2a45502 commit 3ce917b
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .buildkite/go/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ pushd go
popd

pushd tests/upgrade
make all
OASIS_GO=go1.20.2 make all
popd
8 changes: 5 additions & 3 deletions .buildkite/go/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pushd go
make lint
popd

pushd tests/upgrade
make lint
popd
# Lint doesn't work.
# See: https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions
#pushd tests/upgrade
# make lint
#popd
5 changes: 0 additions & 5 deletions .buildkite/scripts/test_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions docker/oasis-core-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ ARG RUST_NIGHTLY_VERSION=2023-01-16
ARG JEMALLOC_VERSION=5.2.1
ARG JEMALLOC_CHECKSUM=34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6

# Legacy package versions (upgrade tests).
ARG LEGACY_GO_VERSION=1.20.2

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq && apt-get upgrade -qq && apt-get install -qq \
Expand Down Expand Up @@ -57,6 +60,10 @@ 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 version.
go install golang.org/dl/go${LEGACY_GO_VERSION}@latest && \
go${LEGACY_GO_VERSION} download && \
# 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} && \
Expand Down
2 changes: 1 addition & 1 deletion go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
2 changes: 1 addition & 1 deletion tests/upgrade/post/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
2 changes: 1 addition & 1 deletion tests/upgrade/pre/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down

0 comments on commit 3ce917b

Please sign in to comment.