-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
131 lines (113 loc) · 2.66 KB
/
Taskfile.yml
File metadata and controls
131 lines (113 loc) · 2.66 KB
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
# https://taskfile.dev
version: "3"
vars:
COV_DATA: coverage.out
tasks:
default:
desc: List all available tasks
silent: true
cmds:
- task --list
tidy:
desc: Tidy dependencies in go.mod and go.sum
sources:
- "**/*.go"
- go.mod
- go.sum
cmds:
- go mod tidy
fmt:
desc: Run go fmt on all source files
sources:
- "**/*.go"
- .golangci.yml
cmds:
- golangci-lint fmt
test:
desc: Run the test suite
sources:
- "**/*.go"
- go.mod
- go.sum
- "**/testdata/**/*"
cmds:
- go test -race ./... {{ .CLI_ARGS }}
build:
desc: Compile the project binary
sources:
- "**/*.go"
- go.mod
- go.sum
- .goreleaser.yml
generates:
- bin
- dist
cmds:
- mkdir -p ./bin
- goreleaser build --single-target --skip before --snapshot --clean --output ./bin/dead
demo:
desc: Render the demo gifs
sources:
- ./docs/src/*.tape
- "**/*.go"
preconditions:
- sh: command -v vhs
msg: vhs not installed, see https://github.com/charmbracelet/vhs
cmds:
- for file in ./docs/src/*.tape; do vhs "$file"; done
bench:
desc: Run all project benchmarks
sources:
- "**/*.go"
cmds:
- go test ./... -run None -benchmem -bench . {{ .CLI_ARGS }}
lint:
desc: Run the linters and auto-fix if possible
sources:
- "**/*.go"
- .golangci.yml
preconditions:
- sh: command -v golangci-lint
msg: golangci-lint not installed, see https://golangci-lint.run/usage/install/#local-installation
- sh: command -v typos
msg: requires typos-cli, run `brew install typos-cli`
cmds:
- golangci-lint run --fix
- typos
cov:
desc: Calculate test coverage and render the html
generates:
- "{{ .COV_DATA }}"
cmds:
- go test -race -cover -covermode atomic -coverprofile {{ .COV_DATA }} ./...
- go tool cover -html {{ .COV_DATA }}
check:
desc: Run tests and linting in one
cmds:
- task: test
- task: lint
sloc:
desc: Print lines of code
cmds:
- fd . -e go | xargs wc -l | sort -nr | head
clean:
desc: Remove build artifacts and other clutter
cmds:
- go clean ./...
- rm -rf {{ .COV_DATA }}
install:
desc: Install the project on your machine
deps:
- uninstall
- build
cmds:
- cp ./bin/dead $GOBIN/dead
uninstall:
desc: Uninstall the project from your machine
cmds:
- rm -rf $GOBIN/dead
update:
desc: Updates dependencies in go.mod and go.sum
cmds:
- go get -u ./...
- go mod tidy