From 3a88b42c9b1ddeaa9e76ee5383e34578584b6243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20Crespo?= Date: Fri, 24 May 2024 06:21:11 +0000 Subject: [PATCH] Test with multiple versions of Go --- .github/workflows/test.yml | 39 +++++++++----------------------------- go.mod | 4 +--- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 163d992..99f3bd5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,57 +10,37 @@ on: jobs: test: strategy: + # Don't abort the entire matrix if one element fails. fail-fast: false matrix: + gover: ["1.20.x", "1.21.x", "1.22.x"] include: - - goarch: amd64 - - goarch: amd64 + - gover: "stable" testflags: "-race" runs-on: ubuntu-22.04 steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v4 with: - go-version: stable - - name: Restore cache - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod/cache - key: ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.testflags }}-go-${{ hashFiles('**/go.sum') }}-${{ github.run_id }} - restore-keys: | - ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.testflags }}-go-${{ hashFiles('**/go.sum') }} - ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.testflags }}-go- + go-version: ${{ matrix.gover }} - name: Test all - run: go test ${{matrix.testflags}} ./... + run: go test ${{ matrix.testflags }} ./... env: GOARCH: ${{ matrix.goarch }} apidiff: runs-on: ubuntu-22.04 if: (github.event.action && 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change')) - steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Go uses: actions/setup-go@v4 with: go-version: stable - - name: Restore cache - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod/cache - key: ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.testflags }}-go-${{ hashFiles('**/go.sum') }}-${{ github.run_id }} - restore-keys: | - ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.testflags }}-go-${{ hashFiles('**/go.sum') }} - ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.testflags }}-go- - name: Run api-diff uses: joelanford/go-apidiff@main lint: @@ -68,7 +48,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Go @@ -77,7 +57,6 @@ jobs: cache: false go-version: stable - name: Run golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: install-mode: "binary" - args: --timeout=10m diff --git a/go.mod b/go.mod index 9593960..b8c7fbc 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,5 @@ module go.artefactual.dev/tools -// We follow the upstream release policy: https://go.dev/doc/devel/release#policy go 1.20 require ( @@ -20,8 +19,6 @@ require ( gotest.tools/v3 v3.5.1 ) -require golang.org/x/sync v0.6.0 // indirect - require ( github.com/aws/aws-sdk-go v1.50.36 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect @@ -60,6 +57,7 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.24.0 // indirect + golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect