-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
425 lines (387 loc) · 12.7 KB
/
Taskfile.yml
File metadata and controls
425 lines (387 loc) · 12.7 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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
# yaml-language-server: $schema=https://taskr-io.vercel.app/schema.json
version: '3'
banner: true
categories: ["core"]
includes:
website:
aliases: [w, docs, d]
taskfile: ./website
dir: ./website
vars:
BIN: "{{.ROOT_DIR}}/bin"
GOTESTSUM_FORMAT: '{{if .CI}}github-actions{{else}}pkgname{{end}}'
INSTALL_PATH:
sh: go env GOPATH
TASKR_BINARY: "{{.INSTALL_PATH}}/bin/taskr{{exeExt}}"
env:
CGO_ENABLED: '0'
tasks:
default:
category: core
cmds:
- taskr --list
run:
category: core
desc: Runs Task
cmds:
- go run ./cmd/taskr {{.CLI_ARGS}}
install:
category: core
desc: Installs taskr (incremental build, skips if up-to-date)
aliases: [i]
sources:
- './**/*.go'
- 'go.mod'
- 'go.sum'
generates:
- "{{.TASKR_BINARY}}"
method: checksum
cmds:
- go install -v ./cmd/taskr
reinstall:
category: core
desc: Force reinstall taskr binary (always rebuilds and installs)
aliases: [ri]
cmds:
- cmd: echo "🗑️ Removing old binary..."
silent: true
- rm -f {{.TASKR_BINARY}}
- cmd: echo "🔨 Rebuilding and installing taskr..."
silent: true
- go install -v ./cmd/taskr
- cmd: echo "✅ taskr reinstalled successfully!"
silent: true
- cmd: echo "📍 Location{{":"}} {{.TASKR_BINARY}}"
silent: true
- cmd: taskr --version
silent: true
verify-install:
category: core
desc: Verify taskr is installed and working correctly
aliases: [verify, check-install]
cmds:
- cmd: echo "📍 Checking installation..."
silent: true
- cmd: |
if [ -f "{{.TASKR_BINARY}}" ]; then
echo "✅ Binary exists{{":"}} {{.TASKR_BINARY}}"
echo "📦 Version{{":"}}";
taskr --version;
echo "✅ Installation verified!";
else
echo "❌ Binary not found{{":"}} {{.TASKR_BINARY}}";
echo "💡 Run 'taskr install' or 'taskr reinstall' to install";
exit 1;
fi
silent: true
build:
category: core
desc: Build taskr binary to ./bin directory (for local testing)
aliases: [b]
sources:
- './**/*.go'
- 'go.mod'
- 'go.sum'
generates:
- "{{.BIN}}/taskr{{exeExt}}"
cmds:
- mkdir -p {{.BIN}}
- go build -v -o {{.BIN}}/taskr{{exeExt}} ./cmd/taskr
- cmd: echo "✅ Built{{":"}} {{.BIN}}/taskr{{exeExt}}"
silent: true
dev:
category: core
desc: Quick development cycle (reinstall + run with args)
cmds:
- task: reinstall
- taskr {{.CLI_ARGS}}
generate:
category: generate
aliases: [gen, g]
desc: Runs all generate tasks
cmds:
- task: generate:mocks
- task: generate:fixtures
generate:mocks:
category: generate
desc: Runs Mockery to create mocks
aliases: [gen:mocks, g:mocks]
deps: [install:mockery]
sources:
- "internal/fingerprint/checker.go"
generates:
- "internal/mocks/*.go"
cmds:
- find . -type f -name *_mock.go -delete
- "{{.BIN}}/mockery"
generate:fixtures:
category: generate
desc: Runs tests and generates golden fixture files
aliases: [gen:fixtures, g:fixtures]
env:
GOLDIE_UPDATE: 'true'
GOLDIE_TEMPLATE: 'true'
cmds:
- find ./testdata -name '*.golden' -delete
- go test ./...
install:mockery:
category: generate
index: 1
desc: Installs mockgen; a tool to generate mock files
vars:
MOCKERY_VERSION: v3.2.2
env:
GOBIN: "{{.BIN}}"
status:
- go version -m {{.BIN}}/mockery | grep github.com/vektra/mockery | grep {{.MOCKERY_VERSION}}
cmds:
- GOBIN="{{.BIN}}" go install github.com/vektra/mockery/v3@{{.MOCKERY_VERSION}}
mod:
category: maintenance
desc: Downloads and tidy Go modules
cmds:
- go mod download
- go mod tidy
clean:
category: maintenance
desc: Cleans temp files and folders
aliases: [clear]
cmds:
- rm -rf dist/
- rm -rf tmp/
clean:all:
category: maintenance
desc: Cleans temp files, folders, and installed binaries
aliases: [clean-all, clear-all]
cmds:
- task: clean
- rm -f {{.TASKR_BINARY}}
- rm -f {{.BIN}}/taskr{{exeExt}}
- cmd: echo "✅ All clean!"
silent: true
lint:
category: core
desc: Runs golangci-lint
aliases: [l]
sources:
- './**/*.go'
- .golangci.yml
- go.mod
cmds:
- golangci-lint run
lint:fix:
category: core
desc: Runs golangci-lint and fixes any issues
sources:
- './**/*.go'
- .golangci.yml
- go.mod
cmds:
- golangci-lint run --fix
format:
category: core
desc: Runs golangci-lint and formats any Go files
aliases: [fmt, f]
sources:
- './**/*.go'
- .golangci.yml
cmds:
- golangci-lint fmt
sleepit:build:
category: maintenance
desc: Builds the sleepit test helper
sources:
- ./cmd/sleepit/**/*.go
generates:
- "{{.BIN}}/sleepit{{exeExt}}"
cmds:
- go build -o {{.BIN}}/sleepit{{exeExt}} ./cmd/sleepit
sleepit:run:
category: maintenance
desc: Builds the sleepit test helper
deps: [sleepit:build]
cmds:
- "{{.BIN}}/sleepit {{.CLI_ARGS}}"
silent: true
test:
category: test
desc: Runs test suite
aliases: [t]
deps: [gotestsum:install]
sources:
- "**/*.go"
- "testdata/**/*"
cmds:
- gotestsum -f '{{.GOTESTSUM_FORMAT}}' ./...
test:watch:
category: test
desc: Runs test suite with watch tests included
deps: [sleepit:build, gotestsum:install]
cmds:
- gotestsum -f '{{.GOTESTSUM_FORMAT}}' ./... -tags 'watch'
test:all:
category: test
desc: Runs test suite with signals and watch tests included
deps: [sleepit:build, gotestsum:install]
cmds:
- gotestsum -f '{{.GOTESTSUM_FORMAT}}' -tags 'signals watch' ./...
goreleaser:test:
category: release
desc: Tests release process without publishing
cmds:
- goreleaser --snapshot --clean
gotestsum:install:
category: release
desc: Installs gotestsum
status:
- command -v gotestsum
cmds:
- go install gotest.tools/gotestsum@latest
goreleaser:install:
category: release
desc: Installs goreleaser
cmds:
- go install github.com/goreleaser/goreleaser/v2@latest
gorelease:install:
category: release
desc: "Installs gorelease: https://pkg.go.dev/golang.org/x/exp/cmd/gorelease"
status:
- command -v gorelease
cmds:
- go install golang.org/x/exp/cmd/gorelease@latest
apicheck:
category: core
desc: Checks what changes have been made to the public API
deps: [gorelease:install]
vars:
LATEST:
sh: git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"
cmds:
- gorelease -base={{.LATEST}}
release:*:
category: release
desc: Prepare the project for a new release
summary: |
This task will do the following:
- Update the version and date in the CHANGELOG.md file
- Update the version in the package.json and package-lock.json files
- Copy the latest docs to the "current" version on the website
- Commit the changes
- Create a new tag
- Push the commit/tag to the repository
- Create a GitHub release
To use the task, run "taskr release:<version>" where "<version>" is is one of:
- "major" - Bumps the major number
- "minor" - Bumps the minor number
- "patch" - Bumps the patch number
- A semver compatible version number (e.g. "1.2.3")
vars:
VERSION:
sh: "go run ./cmd/release --version {{index .MATCH 0}}"
COMPLETE_MESSAGE: |
Creating release with GoReleaser: https://github.com/vikbert/taskr/actions/workflows/release.yml
Please wait for the CI to finish and then do the following:
- Copy the changelog for v{{.VERSION}} to the GitHub release
- Run 'taskr release:package-managers' to publish to package managers
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: "You must have a clean working tree 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
release:package-managers:
category: release
desc: Manual steps to publish Taskr to various package managers
summary: |
This task provides step-by-step instructions for manually publishing Taskr
to various package managers after a release has been created.
Required: Run this after 'taskr release:<version>' has completed and GoReleaser has finished.
cmds:
- cmd: echo "🚀 Taskr Package Manager Publishing Guide"
silent: true
- cmd: |
echo ""
echo "📋 Prerequisites:"
echo " - Release created with: taskr release:<version>"
echo " - GoReleaser CI completed: https://github.com/vikbert/taskr/actions/workflows/release.yml"
echo " - Release tag created and pushed"
echo ""
echo "📦 Package Managers to Update:"
echo ""
silent: true
- cmd: |
echo "1. 🏠 Homebrew (macOS/Linux)"
echo " • Fork: https://github.com/go-task/homebrew-tap"
echo " • Create your tap: https://github.com/vikbert/homebrew-taskr"
echo " • Update Formula/taskr.rb with new version and SHA256"
echo " • Submit PR to your tap repository"
echo ""
silent: true
- cmd: |
echo "2. 📦 npm (Cross-platform)"
echo " • Publish to npm: npm publish"
echo " • Package name: @vikbert/taskr or @taskr/cli"
echo " • Update package.json with correct version"
echo ""
silent: true
- cmd: |
echo "3. 📱 Snap (Linux)"
echo " • Repository: https://github.com/vikbert/snap"
echo " • Update snap/snapcraft.yaml with new version"
echo " • Push changes to trigger automated build"
echo ""
silent: true
- cmd: |
echo "4. 🪟 WinGet (Windows)"
echo " • Repository: https://github.com/microsoft/winget-pkgs"
echo " • Submit PR to add/update Taskr.Task package manifest"
echo " • Use the installer URL from GitHub releases"
echo ""
silent: true
- cmd: |
echo "5. 🌐 Cloudsmith (RPM/DEB)"
echo " • Create Taskr repository: https://cloudsmith.io/~vikbert/repos/taskr"
echo " • Upload RPM/DEB packages from GoReleaser artifacts"
echo " • Update repository metadata"
echo ""
silent: true
- cmd: |
echo "6. 🤝 Community Package Managers"
echo " • Chocolatey: Submit PR to https://github.com/chocolatey-community/chocolatey-coreteampackages"
echo " • Scoop: Submit PR to https://github.com/ScoopInstaller/Main"
echo " • Arch Linux: Submit PR to https://gitlab.archlinux.org/archlinux/packaging/packages/go-task"
echo " • Fedora: Submit PR to https://src.fedoraproject.org/rpms/golang-github-task"
echo " • Nix: Submit PR to https://github.com/NixOS/nixpkgs"
echo " • FreeBSD: Submit PR to https://cgit.freebsd.org/ports/tree/devel/task"
echo ""
silent: true
- cmd: |
echo "🔧 Automation Helpers:"
echo " • GitHub Action: Create fork of go-task/setup-task"
echo " • Mise integration: Already configured for vikbert/taskr"
echo " • pkgx: Already configured for taskr-io.vercel.app"
echo ""
echo "📋 Quick Commands Reference:"
echo ""
echo " # Check current release status"
echo " gh release list --repo vikbert/taskr"
echo ""
echo " # Download release artifacts (if needed)"
echo " gh release download v{{.VERSION}} --repo vikbert/taskr"
echo ""
echo " # Update Homebrew formula example:"
echo " brew bump-formula-pr --url https://github.com/vikbert/taskr/archive/v{{.VERSION}}.tar.gz taskr"
echo ""
echo "📝 Remember to update installation docs after publishing!"
silent: true