-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
101 lines (84 loc) · 2.46 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
version: '3'
tasks:
default:
cmds:
- task: generate:docs
- task: generate:graph
- task: generate:kod
github-action:
cmds:
- task
- task: test:coverage
generate:graph:
desc: Runs gqlgen
cmds:
- go run github.com/99designs/gqlgen generate
generate:kod:
desc: Runs kod generate
cmds:
- go run github.com/go-kod/kod/cmd/kod generate -s ./...
generate:docs:
desc: Run docs generate
cmds:
- swag init -g ./cmd/server/main.go -o ./api/swagger
deps: [install:swag]
generate:callgraph:
desc: Run callgraph generate
cmds:
- go build -o tmp/main ./cmd/server/
- go run github.com/go-kod/kod/cmd/kod callgraph tmp/main --o assets/my-graph.dot
- dot assets/my-graph.dot -T png -o assets/callgraph.png
- rm assets/my-graph.dot
deps: [install:mockgen]
lint:check:
desc: Runs golangci-lint
sources:
- './**/*.go'
aliases: [l]
cmds:
- golangci-lint run -v
lint:fix:
desc: Runs golangci-lint and fixes any issues
sources:
- './**/*.go'
cmds:
- golangci-lint run --fix
install:mod:
desc: Runs go mod tidy
cmds:
- go mod tidy
test:unit:
desc: Runs test
cmd: |
GOEXPERIMENT=nocoverageredesign go test -race -cover -coverprofile=coverage.out -covermode=atomic ./... -coverpkg=./internal/...
cat coverage.out| grep -v "kod_gen" > coverage.out.tmp
mv coverage.out.tmp coverage.out
test:coverage:
desc: Runs coverage
cmd: |
go tool cover -func=coverage.out
deps:
- test:unit
run:air:
desc: Runs air
cmds:
- KOD_CONFIG=./config/server/dev.toml air -build.cmd "go build -o tmp/main ./cmd/server/"
deps: [install:air, install:mod]
install:air:
desc: Install air
status:
- go version -m $GOPATH/bin/air | grep github.com/cosmtrek/air | grep `grep github.com/cosmtrek/air go.mod | awk '{print $2}'`
cmds:
- go install github.com/cosmtrek/air
install:mockgen:
desc: Install mockgen
status:
- go version -m $GOPATH/bin/mockgen | grep go.uber.org/mock | grep `grep go.uber.org/mock go.mod | awk '{print $2}'`
cmds:
- go install go.uber.org/mock/mockgen
install:swag:
desc: Install swag
status:
- go version -m $GOPATH/bin/swag | grep github.com/swaggo/swag | grep `grep github.com/swaggo/swag go.mod | awk '{print $2}'`
cmds:
- go install github.com/swaggo/swag/cmd/swag