-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
184 lines (161 loc) · 3.76 KB
/
Taskfile.yml
File metadata and controls
184 lines (161 loc) · 3.76 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
version: '3'
set:
- errexit
- nounset
- pipefail
vars:
COVERAGE_THRESHOLD: 80
GODOC_PORT: 6060
tasks:
default:
desc: List all available tasks
cmds:
- task --list
silent: true
# Build tasks
build:
desc: Build Go packages (library only)
sources:
- 'pkg/**/*.go'
- go.mod
- go.sum
cmds:
- go build ./pkg/...
# Test tasks
test:
desc: Run all tests
deps:
- go:fmt
- go:vet
cmds:
- go test -v ./pkg/...
test:coverage:
desc: Run tests with coverage report
sources:
- 'pkg/**/*.go'
generates:
- coverage.out
- coverage.html
cmds:
- go test -coverprofile=coverage.out ./pkg/...
- go tool cover -func=coverage.out
- go tool cover -html=coverage.out -o coverage.html
- echo Coverage report generated - coverage.html
test:fuzz:
desc: Run fuzz tests
cmds:
- go test -fuzz=. -fuzztime=30s ./pkg/...
# Code quality tasks
go:fmt:
desc: Format Go code
sources:
- 'pkg/**/*.go'
cmds:
- go fmt ./pkg/...
go:vet:
desc: Run go vet static analysis
sources:
- 'pkg/**/*.go'
cmds:
- go vet ./pkg/...
go:lint:
desc: Run golint (if available)
preconditions:
- sh: command -v golint
msg: golint not installed - run go install golang.org/x/lint/golint@latest
cmds:
- golint ./pkg/...
go:staticcheck:
desc: Run staticcheck (if available)
preconditions:
- sh: command -v staticcheck
msg: staticcheck not installed - run go install honnef.co/go/tools/cmd/staticcheck@latest
cmds:
- staticcheck ./pkg/...
# Quality checks
check:
desc: Run pre-commit checks (format, vet, test)
deps:
- go:fmt
- go:vet
- test
quality:
desc: Run all quality checks including lint and staticcheck
deps:
- go:fmt
- go:vet
- test
cmds:
- task: go:lint
ignore_error: true
- task: go:staticcheck
ignore_error: true
# Dependencies
deps:
desc: Install and update dependencies
cmds:
- go mod tidy
- go mod download
deps:install:
desc: Install development tools
cmds:
- go install golang.org/x/lint/golint@latest
- go install honnef.co/go/tools/cmd/staticcheck@latest
- echo 'Development tools installed'
# Documentation
docs:serve:
desc: Start documentation server
cmds:
- echo 'Starting documentation server at http://localhost:{{.GODOC_PORT}}'
- echo 'Visit http://localhost:{{.GODOC_PORT}}/pkg/github.com/tron-format/trongo/ for package docs'
- godoc -http=:{{.GODOC_PORT}}
docs:pkg:
desc: View package documentation
requires:
vars: [PKG]
cmds:
- go doc {{.PKG}}
# Examples
examples:run:
desc: Run example code
cmds:
- go run examples/quickstart.go
- go run examples/comparison.go
- go run examples/unmarshal_examples.go
- go run examples/use_cases.go
# Cleanup
clean:
desc: Clean build artifacts and test cache
cmds:
- go clean ./pkg/...
- rm -f coverage.out coverage.html
clean:all:
desc: Clean all generated files including module cache
deps:
- clean
cmds:
- go clean -cache -testcache -modcache
# CI/CD
ci:
desc: Run CI pipeline (used in continuous integration)
deps:
- deps
- go:fmt
- go:vet
- test:coverage
cmds:
- echo 'CI pipeline completed successfully'
# Development workflow
dev:
desc: Run development workflow (format, test, build)
deps:
- go:fmt
- go:vet
- test
- build
cmds:
- echo 'Development workflow completed'
all:
desc: Alias for dev (full local workflow)
deps:
- dev