-
Notifications
You must be signed in to change notification settings - Fork 132
50 lines (41 loc) · 1000 Bytes
/
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
44
45
46
47
48
49
50
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- "*"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Format with goimports
run: |
go install golang.org/x/tools/cmd/goimports@latest
if [ "$(goimports -l --format-only . | wc -l)" -gt 0 ];
then
goimports -l --format-only .
exit 1
fi
- name: Run go vet
# TODO: Enforce when possible.
run: |
go vet ./... || true
- name: Run tests
run: |
go test -v -race ./...
- name: Run go mod tidy
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum
- name: Run go build
run: go build ./pkg/sloop/main.go