-
Notifications
You must be signed in to change notification settings - Fork 34
61 lines (49 loc) · 1.37 KB
/
go.yaml
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
name: Go
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/[email protected]
with:
go-version: ^1.22
id: go
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Install kubebuilder
# see kubebuilder book: https://book.kubebuilder.io/quick-start.html
run: |
version="3.1.0"
os=$(go env GOOS)
arch=$(go env GOARCH)
curl -L -o kubebuilder https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/kubebuilder_${os}_${arch}
sudo chmod +x kubebuilder
sudo mv kubebuilder /usr/local/
- name: Get go dependencies
run: |
go install -v ./...
go install -v golang.org/x/lint/golint
go install -v golang.org/x/tools/cmd/goimports
- name: Check for format and lint issues
run: |
# see https://github.com/golang/go/issues/24230
fmtcode="$(gofmt -s -d -l .)"
echo $fmtcode && test -z "$fmtcode"
lintcode="$(golint ./...)"
echo $lintcode && test -z "$lintcode"
- name: Check imports
run: goimports -l .
- name: Build
run: go build ./...
- name: Vet
run: make vet
- name: Test
run: make test