-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
102 lines (84 loc) · 2.36 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
# https://taskfile.dev
version: '3'
output: prefixed
vars:
BIN_DIR: '{{.PWD}}/build/bin'
PROJECT: devctl
VERSION: v0.8
GIT_COMMIT:
sh: git log -n 1 --format=%h
tasks:
tidy:
desc: Tidies go.mod and go.sum
summary: |
Cleans up dependencies inside go.mod and go.sum.
Make sure no unnecessary dependecies are present
cmds:
- go mod tidy -v
- git diff-index --quiet HEAD
install-deps:
desc: Installs all required tooling and dependencies
cmds:
- go mod download
- go get -u
- go install github.com/spf13/cobra/cobra
- ./build/install-tools.sh -b {{.BIN_DIR}}
install:
desc: Installs {{.PROJECT}} into GOBIN
cmds:
- task: build
- cp {{.PROJECT}} {{.GOPATH}}/bin/{{.PROJECT}}
run:
desc: Runs {{.PROJECT}}
cmds:
- task: build
- ./{{.PROJECT}} {{.ARGS}}
env:
ARGS:
build:
desc: Builds {{.PROJECT}}
cmds:
- go build -ldflags="-X cmd.Version={{.VERSION}}" -v -o out/{{.PROJECT}}
test:watch:
desc: Watches files and runs ginkgo tests on file changes
cmds:
- ginkgo watch -r -depth 3 -v
test:cover:
desc: Tests & Covers {{.PROJECT}}
summary: |
Tests & Covers {{.PROJECT}}
It will test your project and collects the coverage.
The coverage gets saved to out/coverage.out
cmds:
- go test -v ./...
test-quiet:
desc: Tests {{.PROJECT}} quietly
cmds:
- go test --short ./...
cover:
desc: Tests & Covers {{.PROJECT}}
summary: |
Tests & Covers {{.PROJECT}}
It will test your project and collects the coverage.
The coverage gets saved to out/coverage.out
cmds:
- go test -v -cover -coverprofile=out/coverage.out ./... > out/test-report.out
lint:
desc: Lints & Fixes {{.PROJECT}}
cmds:
- "{{.BIN_DIR}}/golangci-lint -v --color=always run ./... --fix"
lint:silently:
desc: Lints & Fixes {{.PROJECT}}
cmds:
- "{{.BIN_DIR}}/golangci-lint run ./... --fix"
lint:tool:
desc: Lints & Fixes inside a given file {{.PROJECT}}
vars:
FILE:
cmds:
- "{{.BIN_DIR}}/golangci-lint run --color=always {{.FILE}} --fix > out/lint || (cat out/lint && rm out/lint) && rm out/lint"
clean:
desc: Cleans temp files and folders
cmds:
- rm -rf out/
- rm $(find build/bin -type l -name "[a-z]*")