From 17878036d8e8eb25da9cdc92e119d837d428ccd7 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 20 Mar 2022 10:54:24 +0100 Subject: [PATCH 1/8] Update tests to Go 1.18 --- .github/workflows/tests.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e11eff353..e03e57876 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,21 +15,26 @@ jobs: # list of jobs to run: include: - job_name: Windows - go: 1.17.x + go: 1.18.x os: windows-latest - job_name: macOS - go: 1.17.x + go: 1.18.x os: macOS-latest test_fuse: false - job_name: Linux - go: 1.17.x + go: 1.18.x os: ubuntu-latest test_cloud_backends: true test_fuse: true check_changelog: true + - job_name: Linux + go: 1.17.x + os: ubuntu-latest + test_fuse: true + - job_name: Linux go: 1.16.x os: ubuntu-latest From 9b57fcc6b0bcec436e1a0e8e49c2fc6559d67a19 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 20 Mar 2022 10:54:33 +0100 Subject: [PATCH 2/8] Fix build.go, minimum Go version is 1.14 --- build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.go b/build.go index aab0c1a12..18454454e 100644 --- a/build.go +++ b/build.go @@ -59,7 +59,7 @@ var config = Config{ Main: "./cmd/restic", // package name for the main package DefaultBuildTags: []string{"selfupdate"}, // specify build tags which are always used Tests: []string{"./..."}, // tests to run - MinVersion: GoVersion{Major: 1, Minor: 11, Patch: 0}, // minimum Go version supported + MinVersion: GoVersion{Major: 1, Minor: 14, Patch: 0}, // minimum Go version supported } // Config configures the build. From 18a1de0de159f69c1a119777f271413bc7c034da Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 20 Mar 2022 11:00:48 +0100 Subject: [PATCH 3/8] Use "go get" or "go install" selectively Go 1.18 dropped support for installing binaries via "go get", Go <= 1.16 does not support it. So we need to use the right verb depending on the Go version. --- .github/workflows/tests.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e03e57876..1d96f444a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,11 +17,13 @@ jobs: - job_name: Windows go: 1.18.x os: windows-latest + install_verb: install - job_name: macOS go: 1.18.x os: macOS-latest test_fuse: false + install_verb: install - job_name: Linux go: 1.18.x @@ -29,26 +31,31 @@ jobs: test_cloud_backends: true test_fuse: true check_changelog: true + install_verb: install - job_name: Linux go: 1.17.x os: ubuntu-latest test_fuse: true + install_verb: install - job_name: Linux go: 1.16.x os: ubuntu-latest test_fuse: true + install_verb: get - job_name: Linux go: 1.15.x os: ubuntu-latest test_fuse: true + install_verb: get - job_name: Linux go: 1.14.x os: ubuntu-latest test_fuse: true + install_verb: get name: ${{ matrix.job_name }} Go ${{ matrix.go }} runs-on: ${{ matrix.os }} @@ -65,7 +72,7 @@ jobs: - name: Get programs (Linux/macOS) run: | echo "build Go tools" - go get github.com/restic/rest-server/... + go ${{ matrix.install_verb }} github.com/restic/rest-server/cmd/rest-server@latest echo "install minio server" mkdir $HOME/bin @@ -97,7 +104,7 @@ jobs: $ProgressPreference = 'SilentlyContinue' echo "build Go tools" - go get github.com/restic/rest-server/... + go ${{ matrix.install_verb }} github.com/restic/rest-server/... echo "install minio server" mkdir $Env:USERPROFILE/bin @@ -187,7 +194,7 @@ jobs: - name: Check changelog files with calens run: | echo "install calens" - go get github.com/restic/calens + go ${{ matrix.install_verb }} github.com/restic/calens echo "check changelog files" calens @@ -229,7 +236,7 @@ jobs: - name: Install gox run: | - go get github.com/mitchellh/gox + go install github.com/mitchellh/gox - name: Cross-compile with gox for ${{ matrix.targets }} env: From 2e19d1921641052c0d7ff026637bb3450704333a Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 20 Mar 2022 11:10:12 +0100 Subject: [PATCH 4/8] Use latest Go version for cross-compile and lint --- .github/workflows/tests.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1d96f444a..6ac873897 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,6 +8,9 @@ on: # run tests for all pull requests pull_request: +env: + latest_go: "1.18.x" + jobs: test: strategy: @@ -218,7 +221,6 @@ jobs: solaris/amd64" env: - go: 1.16.x GOPROXY: https://proxy.golang.org runs-on: ubuntu-latest @@ -226,10 +228,10 @@ jobs: name: Cross Compile for ${{ matrix.targets }} steps: - - name: Set up Go ${{ env.go }} + - name: Set up Go ${{ env.latest_go }} uses: actions/setup-go@v2 with: - go-version: ${{ env.go }} + go-version: ${{ env.latest_go }} - name: Check out code uses: actions/checkout@v2 @@ -250,13 +252,11 @@ jobs: lint: name: lint runs-on: ubuntu-latest - env: - go: 1.16.x steps: - - name: Set up Go ${{ env.go }} + - name: Set up Go ${{ env.latest_go }} uses: actions/setup-go@v2 with: - go-version: ${{ env.go }} + go-version: ${{ env.latest_go }} - name: Check out code uses: actions/checkout@v2 From 6dee59b78959682cc2577c4398ba5bfc810ff34f Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 20 Mar 2022 11:15:07 +0100 Subject: [PATCH 5/8] Install gox before checking out code Otherwise newer Go versions complain that the hash for the installed version of gox is not in the go.mod, which we don't want anyways because the tests should use the latest version of gox. --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ac873897..0adc768ab 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -233,12 +233,12 @@ jobs: with: go-version: ${{ env.latest_go }} - - name: Check out code - uses: actions/checkout@v2 - - name: Install gox run: | - go install github.com/mitchellh/gox + go install github.com/mitchellh/gox@latest + + - name: Check out code + uses: actions/checkout@v2 - name: Cross-compile with gox for ${{ matrix.targets }} env: From a9a5acb8cebe3487303c1c13b872900beb064e29 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 20 Mar 2022 11:16:48 +0100 Subject: [PATCH 6/8] Update golangci-lint --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0adc768ab..73d60194a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -265,7 +265,7 @@ jobs: uses: golangci/golangci-lint-action@v2 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.36 + version: v1.45 # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true args: --verbose --timeout 5m From 47aa4613f74f30e9bec24b2cc6d8d16e14f8bc81 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 20 Mar 2022 11:30:01 +0100 Subject: [PATCH 7/8] Force Go to use Module Mode --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 73d60194a..1f75d60c9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,6 +10,7 @@ on: env: latest_go: "1.18.x" + GO111MODULE: on jobs: test: From b85d0359567b0661ea4d727bcbb6f22ca1bd7b65 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 20 Mar 2022 11:36:45 +0100 Subject: [PATCH 8/8] Fix calens install step --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1f75d60c9..52db14f3a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -198,7 +198,7 @@ jobs: - name: Check changelog files with calens run: | echo "install calens" - go ${{ matrix.install_verb }} github.com/restic/calens + go install github.com/restic/calens@latest echo "check changelog files" calens