Skip to content

Commit

Permalink
Test with multiple versions of Go
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed May 24, 2024
1 parent 4ae2303 commit 3a88b42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 33 deletions.
39 changes: 9 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,65 +10,45 @@ 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:
if: github.event_name == 'pull_request'
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
Expand All @@ -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
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3a88b42

Please sign in to comment.