From e8d15b1b7ea092433db77e6fdc7283f46f7c02f6 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 22 Feb 2022 19:37:27 +0300 Subject: [PATCH] workflows: upgrade supported go version --- .circleci/config.yml | 52 +++++++++++-------- .github/workflows/build.yml | 16 +++++- .github/workflows/publish_to_dockerhub.yml | 4 +- .github/workflows/run_tests.yml | 12 +++-- Dockerfile | 6 ++- Dockerfile.wsc | 58 ++++++++++++++++++++-- 6 files changed, 114 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f3d4a4bd..be6323488 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,11 +1,6 @@ version: 2.1 executors: - go1_15: - docker: - - image: cimg/go:1.15 - environment: - GO111MODULE: "on" go1_16: docker: - image: cimg/go:1.16 @@ -14,6 +9,9 @@ executors: go1_17: docker: - image: cimg/go:1.17 + go1_18: + docker: + - image: cimg/go:1.18 commands: gomod: @@ -30,7 +28,7 @@ commands: jobs: lint: working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go - executor: go1_17 + executor: go1_18 steps: - checkout - gomod @@ -40,16 +38,6 @@ jobs: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.1 make lint - test_1_15: - working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go - executor: go1_15 - steps: - - checkout - - run: git submodule sync - - run: git submodule update --init - - gomod - - run: go test -v -race ./... - test_1_16: working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go executor: go1_16 @@ -60,9 +48,29 @@ jobs: - gomod - run: go test -v -race ./... - build_cli: + test_1_17: working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go executor: go1_17 + steps: + - checkout + - run: git submodule sync + - run: git submodule update --init + - gomod + - run: go test -v -race ./... + + test_1_18: + working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go + executor: go1_18 + steps: + - checkout + - run: git submodule sync + - run: git submodule update --init + - gomod + - run: go test -v -race ./... + + build_cli: + working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go + executor: go1_18 steps: - checkout - gomod @@ -73,7 +81,7 @@ jobs: build_image: working_directory: /home/circleci/go/src/github.com/nspcc-dev/neo-go - executor: go1_17 + executor: go1_18 docker: - image: golang:1-alpine steps: @@ -101,11 +109,15 @@ workflows: filters: tags: only: v/[0-9]+\.[0-9]+\.[0-9]+/ - - test_1_15: + - test_1_16: filters: tags: only: v/[0-9]+\.[0-9]+\.[0-9]+/ - - test_1_16: + - test_1_17: + filters: + tags: + only: v/[0-9]+\.[0-9]+\.[0-9]+/ + - test_1_18: filters: tags: only: v/[0-9]+\.[0-9]+\.[0-9]+/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d85936fdd..03d655908 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,7 +33,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore Go modules from cache uses: actions/cache@v2 @@ -67,7 +67,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore Go modules from cache uses: actions/cache@v2 @@ -99,6 +99,12 @@ jobs: ref: ${{ github.event.inputs.ref }} fetch-depth: 0 + # For proper `deps` make target execution. + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - name: Build Docker image run: make image @@ -113,5 +119,11 @@ jobs: ref: ${{ github.event.inputs.ref }} fetch-depth: 0 + # For proper `deps` make target execution. + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - name: Build Docker image run: make image-wsc diff --git a/.github/workflows/publish_to_dockerhub.yml b/.github/workflows/publish_to_dockerhub.yml index 724a10599..8266c5693 100644 --- a/.github/workflows/publish_to_dockerhub.yml +++ b/.github/workflows/publish_to_dockerhub.yml @@ -48,7 +48,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore go modules from cache uses: actions/cache@v2 @@ -113,7 +113,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore go modules from cache uses: actions/cache@v2 diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 22bf1f610..250d9882a 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -56,7 +56,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.18 - name: Restore Go modules from cache uses: actions/cache@v2 @@ -83,14 +83,16 @@ jobs: strategy: matrix: os: [ubuntu-20.04, windows-2022] - go_versions: [ '1.15', '1.16', '1.17' ] + go_versions: [ '1.16', '1.17', '1.18' ] exclude: - - os: windows-2022 - go_versions: '1.15' + # Only latest Go version for Windows. - os: windows-2022 go_versions: '1.16' - - os: ubuntu-20.04 + - os: windows-2022 go_versions: '1.17' + # Exclude latest Go version for Ubuntu as Coverage uses it. + - os: ubuntu-20.04 + go_versions: '1.18' fail-fast: false steps: - uses: actions/checkout@v2 diff --git a/Dockerfile b/Dockerfile index e2c4747fc..d85508db2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ # Builder image -FROM golang:1-alpine as builder +# Keep go version in sync with Build GA job. +FROM golang:1.18-alpine as builder + +# Display go version for information purposes. +RUN go version RUN set -x \ && apk add --no-cache git make \ diff --git a/Dockerfile.wsc b/Dockerfile.wsc index 0ffcabfeb..4ea7887f9 100644 --- a/Dockerfile.wsc +++ b/Dockerfile.wsc @@ -11,15 +11,65 @@ ENV GIT_DOWNLOAD_URL=https://github.com/git-for-windows/git/releases/download/v2 ENV GIT_DOWNLOAD_SHA256=8f65208f92c0b4c3ae4c0cf02d4b5f6791d539cd1a07b2df62b7116467724735 -RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { Write-Host 'FAILED!'; exit 1; }; Write-Host 'Expanding ...'; Expand-Archive -Path git.zip -DestinationPath C:\git\.; Write-Host 'Removing ...'; Remove-Item git.zip -Force; Write-Host 'Updating PATH ...'; $env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); Write-Host 'Verifying install ("git version") ...'; git version; Write-Host 'Complete.'; +RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; \ + \ + Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \ + if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host 'Expanding ...'; \ + Expand-Archive -Path git.zip -DestinationPath C:\git\.; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item git.zip -Force; \ + \ + Write-Host 'Updating PATH ...'; \ + $env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ("git version") ...'; \ + git version; \ + \ + Write-Host 'Complete.'; ENV GOPATH=C:\\go -RUN $newPath = ('{0}\bin;C:\Program Files\Go\bin;{1}' -f $env:GOPATH, $env:PATH); Write-Host ('Updating PATH: {0}' -f $newPath); [Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); +RUN $newPath = ('{0}\bin;C:\Program Files\Go\bin;{1}' -f $env:GOPATH, $env:PATH); \ + Write-Host ('Updating PATH: {0}' -f $newPath); \ + [Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); -ENV GOLANG_VERSION=1.17.6 +# Keep go version in sync with Build GA job. +ENV GOLANG_VERSION=1.18 -RUN $url = 'https://dl.google.com/go/go1.17.6.windows-amd64.zip'; Write-Host ('Downloading {0} ...' -f $url); [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri $url -OutFile 'go.zip'; $sha256 = '5bf8f87aec7edfc08e6bc845f1c30dba6de32b863f89ae46553ff4bbcc1d4954'; Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { Write-Host 'FAILED!'; exit 1; }; Write-Host 'Expanding ...'; Expand-Archive go.zip -DestinationPath C:\; Write-Host 'Moving ...'; Move-Item -Path C:\go -Destination 'C:\Program Files\Go'; Write-Host 'Removing ...'; Remove-Item go.zip -Force; Write-Host 'Verifying install ("go version") ...'; go version; Write-Host 'Complete.'; +RUN $url = 'https://dl.google.com/go/go1.18.windows-amd64.zip'; \ + Write-Host ('Downloading {0} ...' -f $url); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $url -OutFile 'go.zip'; \ + \ + $sha256 = '65c5c0c709a7ca1b357091b10b795b439d8b50e579d3893edab4c7e9b384f435'; \ + Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \ + if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host 'Expanding ...'; \ + Expand-Archive go.zip -DestinationPath C:\; \ + \ + Write-Host 'Moving ...'; \ + Move-Item -Path C:\go -Destination 'C:\Program Files\Go'; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item go.zip -Force; \ + \ + Write-Host 'Verifying install ("go version") ...'; \ + go version; \ + \ + Write-Host 'Complete.'; COPY . /neo-go