...
1on:
2 push:
3 branches:
4 - master
5 pull_request:
6 branches:
7 - '**'
8name: Test
9jobs:
10 test:
11 strategy:
12 fail-fast: false
13 matrix:
14 go-version:
15 - '1.20.x'
16 - '1.21.x'
17 os:
18 - ubuntu-latest
19 - macos-latest
20 - windows-latest
21 runs-on: ${{ matrix.os }}
22 steps:
23 - name: Checkout code
24 uses: actions/checkout@v4
25 - name: Install Go
26 uses: actions/setup-go@v4
27 with:
28 go-version: ${{ matrix.go-version }}
29 cache: false # our tests are quick enough
30 - name: Test
31 run: |
32 go test ./...
33 go test -race ./...
34
35 - name: Tidy
36 if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.21.x' # no need to do this everywhere
37 run: |
38 go mod tidy
39
40 test -z "$(gofmt -d .)" || (gofmt -d . && false)
41 test -z "$(git status --porcelain)" || (git status; git diff && false)
View as plain text