-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
102 lines (85 loc) · 2 KB
/
Taskfile.yml
File metadata and controls
102 lines (85 loc) · 2 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
# yaml-language-server: $schema=https://taskfile.dev/schema.json
---
version: "3"
vars:
HOME:
sh: echo $HOME
BINARY_NAME: gch
GOPATH:
sh: echo $GOPATH
tasks:
default:
cmds:
- task --list
silent: true
run:cmd:
desc: Run as go run main.go
cmds:
- "go run main.go {{ .CLI_ARGS }}"
run:bin:
desc: Run as binary
deps:
- build:bin
cmds:
- "./dist/{{ .BINARY_NAME }} {{ .CLI_ARGS }}"
tidy:
desc: Install all requirements
preconditions:
- test -f go.mod
cmds:
- "go mod tidy"
build:bin:
desc: Build bin file from go
preconditions:
- test -f main.go
cmds:
- "go mod download"
- "CGO_ENABLED=0 go build -o ./dist/{{ .BINARY_NAME }} main.go"
fmt:
desc: Run go fmt
cmds:
- "gofmt -s -w ."
vet:
desc: Run go vet ./...
cmds:
- "go vet ./..."
test:
desc: Run all test
cmds:
- task test:short
test:short:
desc: Run short test
cmds:
- "go test --short -coverprofile=cover.out -v ./..."
test:coverage:
desc: Run test coverage
cmds:
- "go test -coverprofile=cover.out -v ./..."
test:race:
desc: Run tests with race
cmds:
# - task test:coverage
- "go test -race -coverprofile=cover.out -v ./..."
test:bench:
desc: Run tests with benchmarks
cmds:
- "go test -v -bench=. -benchmem -run=^$ ./..."
test:watch:
desc: Run tests with watchexec
cmds:
- "watchexec -c clear -o do-nothing -d 100ms --exts go 'pkg=\".${WATCHEXEC_COMMON_PATH/$PWD/}/...\"; echo \"running tests for $pkg\"; go test \"$pkg\"'"
lint:
desc: Run golangci-lint
cmds:
- "golangci-lint -v run"
install:global:
desc: Build and install globally
cmds:
- "go install"
install:dev:
desc: Build bin file from go and install to
preconditions:
- test -f main.go
cmds:
- "go mod download"
- "CGO_ENABLED=0 go build -o {{ .GOPATH }}/bin/{{ .BINARY_NAME }} main.go"