-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtaskfile.yml
More file actions
86 lines (77 loc) · 1.95 KB
/
taskfile.yml
File metadata and controls
86 lines (77 loc) · 1.95 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
#https://taskfile.dev/
version: "3"
dotenv:
- .env
includes:
vars:
taskfile: taskfile/.vars.yml
flatten: true
tools:
taskfile: taskfile/.tools.yml
flatten: true
go-tools:
taskfile: taskfile/go-tools.yml
flatten: true
vars:
tasks:
check-commit:
desc: "check if the commit message follows the conventional commit format"
cmds:
- go run .
ci:
desc: "do almost all the checks"
cmds:
- task: tidy
- task: format
- task: lint
- task: test
test:
desc: "run Go tests"
deps:
- task: check-go-tool
vars:
TOOL: GOTESTSUM
vars:
PKG: '{{default "./..." .PKG}}'
FORMAT: '{{default "testdox" .FORMAT}}'
cmds:
- |
/{{.TMP}}/gotestsum/{{.GOTESTSUM_VERSION}}/gotestsum \
--format-icons=hivis \
--format={{.FORMAT}} \
--format-hide-empty-pkg \
-- -count=1 \
-v \
{{.PKG}}
tidy:
desc: "run Go mod tidy"
cmds:
- go mod tidy
lint:
desc: "run Go linters"
deps:
- task: check-go-tools
vars:
TOOLS: [BETTERALIGN, REVIVE, STATICCHECK]
cmds:
- /{{.TMP}}/revive/{{.REVIVE_VERSION}}/revive -config revive.toml -formatter friendly -set_exit_status ./...
- /{{.TMP}}/staticcheck/{{.STATICCHECK_VERSION}}/staticcheck ./...
- /{{.TMP}}/betteralign/{{.BETTERALIGN_VERSION}}/betteralign ./...
format:
desc: "formats the code"
deps:
- task: check-go-tools
vars:
TOOLS: [BETTERALIGN, GOFUMPT]
cmds:
- go fix ./...
- /{{.TMP}}/betteralign/{{.BETTERALIGN_VERSION}}/betteralign -apply ./... || true
- /{{.TMP}}/gofumpt/{{.GOFUMPT_VERSION}}/gofumpt -l -w .
govulncheck:
desc: "run Go vulnerability check"
deps:
- task: check-go-tool
vars:
TOOL: GOVULNCHECK
cmds:
- /{{.TMP}}/govulncheck/{{.GOVULNCHECK_VERSION}}/govulncheck -show verbose ./...