...
1on:
2 push:
3 branches: [main]
4 pull_request:
5name: Test
6permissions:
7 contents: read
8jobs:
9 test:
10 strategy:
11 matrix:
12 go-version: [1.19.x, 1.20.x, 1.21.x]
13 platform: [ubuntu-latest, macos-latest, windows-latest]
14 runs-on: ${{ matrix.platform }}
15 steps:
16 - name: Install Go
17 uses: actions/setup-go@v4
18 with:
19 go-version: ${{ matrix.go-version }}
20 - name: Install staticcheck
21 if: matrix.go-version == '1.21.x'
22 run: go install honnef.co/go/tools/cmd/staticcheck@latest
23 shell: bash
24 - name: Update PATH
25 run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
26 shell: bash
27 - name: Checkout code
28 uses: actions/checkout@v3
29 - name: Fmt
30 if: matrix.platform != 'windows-latest' # :(
31 run: "diff <(gofmt -d .) <(printf '')"
32 shell: bash
33 - name: Vet
34 run: go vet ./...
35 - name: Staticcheck
36 if: matrix.go-version == '1.21.x'
37 run: staticcheck ./...
38 - name: Test
39 run: go test -race ./...
View as plain text