-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yaml
132 lines (116 loc) · 2.61 KB
/
Taskfile.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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
version: 3
silent: true
tasks:
default:
desc: "Show available tasks"
cmds:
- task --list-all
pre-commit:
desc: "Run generators, formatters, linters, tests"
cmds:
- task: generate
- task: format
- task: lint
- task: test
run:local:
desc: "Run service locally"
cmds:
- go run -tags local ./cmd/telegram-butler/
format:
desc: "Run formatters"
deps: [ install:gofumpt, install:gci ]
aliases: [ fmt ]
cmds:
- echo "Running formatters..."
- go mod tidy
- gofumpt -l -w .
- |
gci write \
--skip-generated \
--section standard \
--section default \
--section "prefix(github.com/GolangUA/telegram-butler)" \
$(go list -f "{{`{{.Dir}}`}}" ./...)
sources:
- ./**/*.go
- go.mod
- go.sum
lint:
desc: "Run golangci-lint"
deps: [ install:lint ]
cmds:
- echo "Running linters..."
- golangci-lint run
sources:
- .golangci.yaml
- ./**/*.go
- go.mod
- go.sum
lint:list:
desc: "Run golangci-lint linters (print enabled & disabled linters)"
deps: [ install:lint ]
cmds:
- golangci-lint linters
test:
desc: "Run tests"
cmds:
- echo "Running tests..."
- mkdir -p bin
- go test -coverprofile bin/cover.out ./...
sources:
- ./**/*.go
- go.mod
- go.sum
generates:
- bin/cover.out
test:cover:
desc: "Run tests & show coverage"
deps:
- test
cmds:
- go tool cover -func bin/cover.out
test:race:
desc: "Run tests with a race flag"
cmds:
- go test -race -count=8 -failfast ./...
generate:
desc: "Generate (used for mock generation)"
deps: [ install:mock ]
cmds:
- echo "Running generators..."
- go generate ./...
sources:
- ./**/*.go
- go.mod
- go.sum
install:
desc: "Install all tools"
deps:
- install:lint
- install:gofumpt
- install:gci
- install:mock
install:lint:
desc: "Install golangci-lint"
cmds:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
status:
- command -v golangci-lint
install:gofumpt:
desc: "Install gofumpt"
cmds:
- go install mvdan.cc/gofumpt@latest
status:
- command -v gofumpt
install:gci:
desc: "Install gci"
cmds:
- go install github.com/daixiang0/gci@latest
status:
- command -v gci
install:mock:
desc: "Install mockgen"
cmds:
- go install go.uber.org/mock/mockgen@latest
status:
- command -v mockgen