-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (36 loc) · 963 Bytes
/
Copy pathtest.yml
File metadata and controls
44 lines (36 loc) · 963 Bytes
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
name: Test
on:
push:
branches: [main]
pull_request:
# Allow manual runs from the Actions tab.
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
# Track the version in go.mod so this never drifts from the module.
go-version-file: go.mod
- name: Check formatting
# gofmt -l lists misformatted files and exits 0 either way, so fail
# explicitly when the list is non-empty.
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "These files need gofmt:"
echo "$unformatted"
exit 1
fi
- name: Build
run: go build ./...
- name: Vet
run: go vet ./...
- name: Test
run: go test -race ./...