-
Notifications
You must be signed in to change notification settings - Fork 5
/
Taskfile.yml
136 lines (114 loc) · 3.74 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
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
133
134
135
136
---
version: "3"
vars:
GIT_ROOT:
sh: git rev-parse --show-toplevel
MAIN_PACKAGE: main.go
includes:
docs:
taskfile: ./docs
dir: ./docs
tasks:
deps:
desc: Install dependencies
cmds:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest
- go install golang.org/x/vuln/cmd/govulncheck@latest
- go install github.com/jstemmer/go-junit-report@latest
- go install github.com/segmentio/golines@latest
- go install github.com/golang/mock/mockgen@latest
- go install github.com/boumenot/gocover-cobertura@latest
- go install mvdan.cc/gofumpt@latest
- go install github.com/goreleaser/goreleaser@latest
- go get github.com/bats-core/bats-core@latest
- bash $(go env GOMODCACHE)/$(go list -m github.com/bats-core/bats-core | tr ' ' @)/install.sh ./test/integration/vendor/bats
deps:check:
desc: Check dependencies needed for development
cmds:
- echo "Dependency check OK"
preconditions:
- sh: "case '{{OS}}' in darwin|linux) true ;; *) false ;; esac"
msg: Operating System '{{OS}}' not supported
- sh: command -v jq
msg: |
'jq' not found in $PATH
Suggested action: 'brew install jq'
mod:
desc: Module maintenance
cmds:
- go mod download
- go mod tidy
vet:
desc: Report likely mistakes in packages
cmds:
- $(go env GOPATH)/bin/golangci-lint run --config {{ .GIT_ROOT }}/.golangci.yml
vuln:
desc: Run Go's vulnerability scanner
cmds:
- govulncheck ./...
run:
desc: Compile and run Go program
cmds:
- go run {{ .MAIN_PACKAGE }} {{.CLI_ARGS}}
unit:
desc: Test packages
cmds:
- go test -parallel 5 -race -v ./...
unit:int:
desc: Integration test packages
cmds:
- task: unit:bats
unit:bats:
desc: Integration bats test packages
cmds:
- ./test/integration/vendor/bats/bin/bats test/integration
test:
desc: Test all
cmds:
- task: deps
- task: mod
- task: fmt:check
- task: vet
- task: cov
- task: unit:int
cov:
desc: Generate coverage
env:
# https://github.com/golang/go/issues/65570
GOEXPERIMENT: nocoverageredesign
cmds:
- go test -race -coverprofile=cover.out -v $(go list ./... | grep -v /mocks)
- gocover-cobertura < cover.out > cobertura.xml
- go tool cover -func=cover.out
cov:map:
desc: Generate coverage and show heatmap
cmds:
- task: cov
- go tool cover -html=cover.out
fmt:
desc: Reformat files whose formatting differs from `go_fmt_command`
cmds:
- gofumpt -l -w .
- golines --base-formatter=gofumpt -w .
fmt:check:
desc: Check files whose formatting differs from `go_fmt_command`
cmds:
# https://github.com/mvdan/gofumpt/issues/114
- test -z "$(gofumpt -d -e . | tee /dev/stderr)"
- test -z "$(golines -l --dry-run --base-formatter=gofumpt -w .)"
build:
desc: Build ARCH compatible binary.
cmds:
- goreleaser release --snapshot --clean
build:wheel:
desc: Build ARCH Python wheel. Requires running `task build` first.
cmds:
- python/dist2wheel.py
mockgen:
desc: Generate mock for interface
cmds:
- mockgen -source=internal/git.go -destination=internal/mocks/git/git_mock.go -package=git
- mockgen -source=internal/repository.go -destination=internal/mocks/repository/repository_mock.go -package=repository
- mockgen -source=internal/exec.go -destination=internal/mocks/exec/exec_mock.go -package=exec
- mockgen -source=internal/repository/types.go -destination=internal/mocks/repository/copy_mock.go -package=repository