-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
211 lines (183 loc) · 5.31 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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
version: '3'
vars:
# Define the directory for binaries
BIN: "{{.ROOT_DIR}}/bin"
tasks:
# Default task to run linting and testing
default:
cmds:
- task: lint
- task: test
# Build tasks
build:
desc: Builds the Go project
cmds:
- go build -o {{.BIN}}/devex ./cmd/main.go
build:local:
desc: Builds the Go project for local development
cmds:
- go build -o ./bin/devex -v ./cmd/main.go
# Installation task
install:
desc: Installs DevEx
aliases: [i]
sources:
- './**/*.go'
cmds:
- go install -v ./cmd/main.go
# Setup Python environment
setup:python:
desc: Sets up Python environment and installs requirements
cmds:
- pip install -r requirements.txt
# Manage Go modules
mod:
desc: Downloads and tidies Go modules
cmds:
- go mod download
- go mod tidy
# Clean up temporary files
clean:
desc: Cleans temp files and folders
aliases: [clear]
cmds:
- rm -rf bin/
# Linting tasks
lint:
desc: Runs golangci-lint
aliases: [l]
sources:
- './**/*.go'
- .golangci.yml
cmds:
- golangci-lint run
lint:fix:
desc: Runs golangci-lint and fixes issues
sources:
- './**/*.go'
- .golangci.yml
cmds:
- golangci-lint run --fix
lint:staticcheck:
desc: Runs staticcheck
cmds:
- staticcheck ./...
# Vulnerability checks
vulncheck:
desc: Runs vulnerability checks
cmds:
- govulncheck ./...
# Testing tasks
test:
desc: Runs test suite
aliases: [t]
deps: [install]
cmds:
- go test {{catLines .GO_PACKAGES}}
vars:
GO_PACKAGES:
sh: go list ./...
test:all:
desc: Runs test suite with additional tags
deps: [install]
cmds:
- go test {{catLines .GO_PACKAGES}} -tags 'signals watch'
vars:
GO_PACKAGES:
sh: go list ./...
test:testify:
desc: Runs tests with testify
cmds:
- go test ./... {{.TESTIFY}}
test:ginkgo:
desc: Runs tests with Ginkgo
cmds:
- ginkgo run ./...
# Mock generation
mockgen:
desc: Generates mocks for interfaces
cmds:
- mockgen -source=source_file.go -destination=destination_mock.go -package=mocks
# Prettier formatting
prettier:check:
desc: Checks if files are formatted with Prettier
cmds:
- npx prettier --check .
prettier:fix:
desc: Formats files with Prettier
cmds:
- npx prettier --write .
# Documentation tasks
docs:build:
desc: Builds the MkDocs site
cmds:
- mkdocs build
docs:serve:
desc: Serves MkDocs documentation locally
cmds:
- mkdocs serve
# Code visualization
callvis:
desc: Generates a visualization of code
cmds:
- go-callvis ./... --nostd --group pkg
# Static analysis
gocritic:
desc: Runs Go Critic for advanced analysis
cmds:
- gocritic check ./...
# CLI tasks
cli:generate:
desc: Generates CLI commands
cmds:
- go run ./cmd/gencli
# GoReleaser tasks
goreleaser:test:
desc: Tests the release process without publishing
cmds:
- goreleaser --snapshot --clean
goreleaser:install:
desc: Installs GoReleaser
cmds:
- go install github.com/goreleaser/goreleaser/v2@latest
# Release management
release:*:
desc: Prepares the project for a new release
summary: |
This task updates the version and creates a new GitHub release:
- Updates CHANGELOG.md
- Commits changes
- Creates and pushes a new tag
- Creates a GitHub release
vars:
VERSION:
sh: "go run ./cmd/release --version {{index .MATCH 0}}"
COMPLETE_MESSAGE: |
Release created. Please:
- Publish the package to NPM
- Update and push snapcraft manifest
preconditions:
- sh: test $(git rev-parse --abbrev-ref HEAD) = "main"
msg: "You must be on the main branch to release."
- sh: "[[ -z $(git diff --shortstat main) ]]"
msg: "Your working tree must be clean to release."
prompt: "Are you sure you want to release version {{.VERSION}}?"
cmds:
- cmd: echo "Releasing v{{.VERSION}}"
silent: true
- "go run ./cmd/release {{.VERSION}}"
- "git add --all"
- "git commit -m v{{.VERSION}}"
- "git push"
- "git tag v{{.VERSION}}"
- "git push origin tag v{{.VERSION}}"
- cmd: printf "%s" '{{.COMPLETE_MESSAGE}}'
silent: true
# Package listing
packages:
cmds:
- echo '{{.GO_PACKAGES}}'
vars:
GO_PACKAGES:
sh: go list ./...
silent: true