This repository has been archived by the owner on Mar 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
92 lines (72 loc) · 1.93 KB
/
go.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Go
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
gofmt:
name: No suggestions from gofmt
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.15'
- name: Checkout code
uses: actions/checkout@v2
- name: gofmt
run: |
gofmt_out=/tmp/gofmt.out
git ls-files -cmoz --exclude-standard '*.go' \
| sort -z \
| xargs -0 gofmt -l -s -d >"$gofmt_out"
if [ "$(wc -c "$gofmt_out" | awk '{print $1}')" -ne 0 ]; then
cat >&2 <"$gofmt_out"
exit 1
fi
golangci-lint:
name: No errors from golangci-lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
build_test:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
go:
- '1.14'
- '1.15'
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: go build -v ./...
- name: Test go
env:
CGO_ENABLED: '0'
run: go test -v -tags DEBUG ./...
# Resolving on macos does not work as expected when using pure-go
# resolver. In particular, net.LookupHost(os.Hostname()) fails with
# `no such host'. See readme for more details on this defect.
if: matrix.os != 'macos-latest'
- name: Test cgo
env:
CGO_ENABLED: '1'
run: go test -v -tags DEBUG ./...
- name: Test cgo race
env:
CGO_ENABLED: '1'
run: go test -v -tags DEBUG -race ./...