-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
106 lines (91 loc) · 2.44 KB
/
Taskfile.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
version: "3"
vars:
BRANCH:
sh: echo "${GIT_BRANCH:-`git branch --show-current`}"
BUILD_NUMBER:
sh: echo "${BUILD_NUMBER:-0}"
TEST_TIMEOUT: 5m
env:
CGO_ENABLED: 0
includes:
os: Taskfile_{{ OS }}.yml
tasks:
bootstrap-ci:
desc: Install required go tools and sync dependencies
cmds:
- go install github.com/golang/mock/[email protected]
- task: mockgen
- go mod tidy
bootstrap:
desc: Install required go tools and sync dependencies
cmds:
- go install github.com/golang/mock/mockgen@latest
- go install github.com/goreleaser/goreleaser@latest
- go install github.com/jstemmer/go-junit-report@latest
- go install github.com/golangci/golangci-lint/cmd/[email protected]
- task: mockgen
- go mod tidy
clean:
desc: Clean generated files
cmds:
- task: os:clean
format:
desc: Format the code
cmds:
- go fmt ./...
lint:
desc: lint Go code
deps:
- mockgen
sources:
- ./**/*.go
- .golangci.yml
cmds:
- golangci-lint run --out-format checkstyle ./... > ./out/golangci-report.xml
update-deps:
desc: Update Go module dependencies
cmds:
- go mod tidy
- go get -u
mockgen:
desc: All //go:generate directives
sources:
- ./internal/**/*.go
- ./pkg/**/*.go
generates:
- ./internal/**/mock_*.go
- ./pkg/**/mock_*.go
cmds:
- go generate ./pkg/... ./internal/...
unit-tests:
desc: Run all unit tests
cmds:
- cmd: go test -v -timeout {{ .TEST_TIMEOUT }} ./...
release:
desc: Create a release - requires a tag for the current commit
deps:
- format
- mockgen
cmds:
- goreleaser release --rm-dist
release-snapshot:
desc: Create a snapshot release. Intended for local use.
deps:
- format
- mockgen
env:
BUILD_NUMBER: "{{ .BUILD_NUMBER }}"
cmds:
- goreleaser release --rm-dist --snapshot
cli-cover-report:
desc: Create a CLI coverage report of all packages and an overall value
sources:
- "{{ .OUT_DIR }}/coverage/cov.out"
cmds:
- go tool cover -func={{ .OUT_DIR }}/coverage/cov.out
html-cover-report:
desc: Create an HTML coverage report of all packages and an overall value
sources:
- "{{ .OUT_DIR }}/coverage/cov_filtered.out"
cmds:
- go tool cover -html={{ .OUT_DIR }}/coverage/cov.out -o {{ .OUT_DIR }}/coverage/coverage.html