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 02bdbd7 commit 28a4d2b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 11 deletions.
8 changes: 6 additions & 2 deletions .buildkite/go/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .buildkite/go/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ pushd go
popd

pushd tests/upgrade
make lint
OASIS_GOLANGCI_LINT=golangci-lint1.51.2 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
13 changes: 13 additions & 0 deletions docker/oasis-core-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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.
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 28a4d2b

Please sign in to comment.