forked from mymmrac/telego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
103 lines (87 loc) · 2.11 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
version: "3"
silent: true
tasks:
default:
desc: "Show available tasks"
cmds:
- task --list-all
pre-commit:
desc: "Run tests, linter and build examples"
cmds:
- go mod tidy
- task: generate
- task: lint
- task: test
- task: build:examples
lint:
desc: "Run golangci-lint"
deps: [ install:lint ]
cmds:
- golangci-lint run
lint:list:
desc: "Run golangci-lint linters (print enabled & disabled linters)"
deps: [ install:lint ]
cmds:
- golangci-lint linters
test:
desc: "Run tests"
cmds:
- mkdir -p bin
- |
go test -coverprofile bin/cover.out \
$(go list ./... | grep -v /examples/ | grep -v /internal/ | grep -v /mock)
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 race flag"
cmds:
- go test -race -count=1 ./...
test:bench:
desc: "Run benchmarks"
cmds:
- go test -bench=. -benchtime=10s -benchmem
build:examples:
desc: "Build examples"
cmds:
- go build -o bin/ ./examples/*
generate:
desc: "Generate (used for mock generation)"
deps: [ install:mock ]
cmds:
- go generate ./...
generator:
desc: "Run specific generation"
cmds:
- go run ./internal/generator {{.CLI_ARGS}}
generator:all:
desc: "Run all generators"
cmds:
- task: generator
vars:
CLI_ARGS: types types-tests types-setters types-setters-tests methods methods-tests methods-setters methods-setters-tests
generator:clean-up:
desc: "Remove generated files"
cmds:
- rm *.generated
install:lint:
desc: "Install golangci-lint"
cmds:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
status:
- command -v golangci-lint
install:mock:
desc: "Install mockgen"
cmds:
- go install github.com/golang/mock/mockgen@latest
status:
- command -v mockgen