generated from bep/golibtemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 6
43 lines (43 loc) · 1.24 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
on:
push:
branches: [main]
pull_request:
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.21.x, 1.22.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
package: [passthrough]
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: false
- name: Install staticcheck
if: matrix.platform == 'ubuntu-latest'
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Update PATH
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Checkout code
uses: actions/checkout@v4
- name: Fmt
if: matrix.platform != 'windows-latest'
run: "diff <(gofmt -d .) <(printf '')"
working-directory: ${{ matrix.package }}
- name: Vet
run: go vet ./...
working-directory: ${{ matrix.package }}
- name: Staticcheck
if: matrix.platform == 'ubuntu-latest'
run: staticcheck ./...
working-directory: ${{ matrix.package }}
- name: Test
run: go test -race ./...
working-directory: ${{ matrix.package }}