-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
87 lines (72 loc) · 1.89 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
# https://taskfile.dev
version: '3'
silent: true
vars:
GO_MODULE: github.com/kazhuravlev/awesome-tools
GO_FILES:
sh: find . -type f -name '*.go' -not -path "./.gocache/*" -not -path "./.go/*" -not -path "_generated.go" | tr "\n" " "
TOOL_BIN_DIR: ./bin/tools
TOOL_LINT_SRC: github.com/golangci/golangci-lint/cmd/[email protected]
TOOL_LINT: ./{{ .TOOL_BIN_DIR }}/golangci-lint
TOOL_OPTIONS_GEN_SRC: github.com/kazhuravlev/options-gen/cmd/options-gen@latest
TOOL_OPTIONS_GEN: ./{{ .TOOL_BIN_DIR }}/options-gen
tasks:
default:
cmds:
- task --list-all
check:
desc: Run all project checks
cmds:
- echo "- Run all routines"
- task: tidy
- task: tools:install
- task: generate
- task: fmt
- task: lint
- task: install
- task: tests
generate:
desc: Generate source code
env:
SEARCH_BIN_PATH:
sh: "echo `pwd`/{{ .TOOL_BIN_DIR }}:$PATH"
cmds:
- echo "- Run code generator"
- PATH=$SEARCH_BIN_PATH go generate ./...
tidy:
cmds:
- echo "- Tidy"
- go mod tidy
fmt:
desc: Run code formatter
cmds:
- echo "- Format"
- go fmt ./...
tools:install:
desc: Install required tools (into local project dir)
run: once
vars:
GOBIN:
sh: "echo `pwd`/{{ .TOOL_BIN_DIR }}"
cmds:
- echo '>>> Run install tools'
- rm -rf {{ .TOOL_BIN_DIR }}
- mkdir -p {{ .TOOL_BIN_DIR }}
- export GOBIN="{{.GOBIN}}" && go install {{ .TOOL_LINT_SRC }}
- export GOBIN="{{.GOBIN}}" && go install {{ .TOOL_OPTIONS_GEN_SRC }}
lint:
desc: Run linter
deps:
- "tools:install"
cmds:
- echo "- Lint"
- "{{ .TOOL_LINT }} run --fix ./..."
install:
run: once
cmds:
- echo "- Install"
- go install ./cmd/awesome-tool
tests:
cmds:
- echo "- Tests"
- go test -race -count 1 ./...