|
1 | | -name: test |
2 | | -on: [push] |
| 1 | +name: 'test' |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + paths: ['**.go', 'go.mod', '.github/workflows/*'] |
| 5 | + push: |
| 6 | + branches: ['main'] |
3 | 7 | jobs: |
4 | 8 | test: |
5 | 9 | strategy: |
6 | 10 | fail-fast: false |
7 | 11 | matrix: |
8 | | - os: |
9 | | - - macos-10.15 |
10 | | - - macos-latest |
11 | | - go: |
12 | | - - '1.18.0-beta1' |
13 | | - - '1.17' |
14 | | - - '1.16' |
15 | | - runs-on: ${{ matrix.os }} |
| 12 | + os: ['macos-12', 'macos-latest'] |
| 13 | + go: ['1.17', '1.22'] |
| 14 | + runs-on: '${{ matrix.os }}' |
16 | 15 | steps: |
17 | | - - name: setup Go |
18 | | - uses: actions/setup-go@v2 |
| 16 | + - uses: 'actions/checkout@v4' |
| 17 | + - uses: 'actions/setup-go@v5' |
19 | 18 | with: |
20 | | - stable: 'false' |
21 | | - go-version: ${{ matrix.go }} |
| 19 | + go-version: '${{ matrix.go }}' |
| 20 | + - name: 'test' |
| 21 | + run: 'go test --race ./...' |
22 | 22 |
|
23 | | - - name: checkout |
24 | | - uses: actions/checkout@v2 |
25 | | - |
26 | | - - name: test |
27 | | - run: | |
28 | | - go test --race ./... |
29 | | -
|
30 | | - lint: |
31 | | - runs-on: macos-latest |
| 23 | + staticcheck: |
| 24 | + name: 'staticcheck' |
| 25 | + runs-on: 'macos-latest' |
32 | 26 | steps: |
33 | | - - name: setup Go |
34 | | - uses: actions/setup-go@v2 |
35 | | - with: |
36 | | - go-version: '1.17' |
37 | | - |
38 | | - - name: checkout |
39 | | - uses: actions/checkout@v2 |
40 | | - |
41 | | - - name: gofmt |
42 | | - run: | |
43 | | - test -z "$(gofmt -s -d . | tee /dev/stderr)" |
44 | | -
|
45 | | - - name: vet |
46 | | - run: | |
47 | | - go vet ./... |
48 | | -
|
49 | | - - name: golangci-lint |
50 | | - uses: golangci/golangci-lint-action@v2 |
51 | | - continue-on-error: true |
| 27 | + - uses: 'actions/checkout@v4' |
| 28 | + - uses: 'actions/setup-go@v5' |
52 | 29 | with: |
53 | | - version: latest |
54 | | - skip-go-installation: true |
55 | | - |
| 30 | + go-version: '1.22' |
| 31 | + - uses: 'actions/cache@v4' |
| 32 | + with: |
| 33 | + key: '${{ runner.os }}-staticcheck' |
| 34 | + path: | |
| 35 | + ${{ runner.temp }}/staticcheck |
| 36 | + ${{ steps.install_go.outputs.GOCACHE || '' }} |
| 37 | +
|
| 38 | + - run: | |
| 39 | + export STATICCHECK_CACHE="${{ runner.temp }}/staticcheck" |
| 40 | + go install honnef.co/go/tools/cmd/staticcheck@latest |
| 41 | + $(go env GOPATH)/bin/staticcheck ./... |
0 commit comments