-
Notifications
You must be signed in to change notification settings - Fork 40
77 lines (62 loc) · 1.71 KB
/
Copy pathgo.yml
File metadata and controls
77 lines (62 loc) · 1.71 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Go
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
concurrency:
group: go-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GOTOOLCHAIN: local
jobs:
build:
name: Build and test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Check out repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
- name: Show Go version
run: go version
- name: Download and verify modules
run: |
go mod download
go mod verify
- name: Check formatting
if: runner.os == 'Linux'
shell: bash
run: |
unformatted="$(gofmt -l .)"
if [[ -n "$unformatted" ]]; then
printf 'The following files need gofmt:\n%s\n' "$unformatted"
exit 1
fi
- name: Check module tidiness
if: runner.os == 'Linux'
run: go mod tidy -diff
- name: Build
run: go build -trimpath -v ./...
- name: Vet
run: go vet ./...
- name: Test
run: go test -count=1 -v ./...
- name: Test with race detector
if: runner.os == 'Linux'
env:
CGO_ENABLED: "1"
run: go test -race -count=1 ./...
- name: Check known vulnerabilities
if: runner.os == 'Linux'
run: go run golang.org/x/vuln/cmd/govulncheck@v1.6.0 ./...