forked from charmbracelet/crush
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
125 lines (106 loc) · 2.94 KB
/
Taskfile.yaml
File metadata and controls
125 lines (106 loc) · 2.94 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
# https://taskfile.dev
version: "3"
vars:
VERSION:
sh: git describe --long 2>/dev/null || echo ""
env:
CGO_ENABLED: 0
GOEXPERIMENT: greenteagc
tasks:
lint:install:
desc: Install golangci-lint
cmds:
- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
env:
GOTOOLCHAIN: go1.25.0
lint:
desc: Run base linters
cmds:
- golangci-lint run --path-mode=abs --config=".golangci.yml" --timeout=5m
env:
GOEXPERIMENT: null
lint:fix:
desc: Run base linters and fix issues
cmds:
- golangci-lint run --path-mode=abs --config=".golangci.yml" --timeout=5m --fix
env:
GOEXPERIMENT: null
build:
desc: Run build
vars:
LDFLAGS: '{{if .VERSION}}-ldflags="-X github.com/charmbracelet/crush/internal/version.Version={{.VERSION}}"{{end}}'
cmds:
- go build {{.LDFLAGS}} .
generates:
- crush
run:
desc: Run build
cmds:
- go run . {{.CLI_ARGS}}
test:
desc: Run tests
cmds:
- go test ./... {{.CLI_ARGS}}
test:record:
desc: Run tests and record all VCR cassettes again
aliases: [record]
cmds:
- rm -r internal/agent/testdata
- go test -v -count=1 -timeout=1h ./internal/agent
fmt:
desc: Run gofumpt
cmds:
- gofumpt -w .
dev:
desc: Run with profiling enabled
env:
CRUSH_PROFILE: true
cmds:
- go run .
install:
desc: Install the application
vars:
LDFLAGS: '{{if .VERSION}}-ldflags="-X github.com/charmbracelet/crush/internal/version.Version={{.VERSION}}"{{end}}'
cmds:
- task: fetch-tags
- go install {{.LDFLAGS}} -v .
profile:cpu:
desc: 10s CPU profile
cmds:
- go tool pprof -http :6061 'http://localhost:6060/debug/pprof/profile?seconds=10'
profile:heap:
desc: Heap profile
cmds:
- go tool pprof -http :6061 'http://localhost:6060/debug/pprof/heap'
profile:allocs:
desc: Allocations profile
cmds:
- go tool pprof -http :6061 'http://localhost:6060/debug/pprof/allocs'
schema:
desc: Generate JSON schema for configuration
cmds:
- go run main.go schema > schema.json
- echo "Generated schema.json"
generates:
- schema.json
release:
desc: Create and push a new tag following semver
vars:
NEXT:
sh: svu next --always || go run github.com/caarlos0/svu/v3@latest next --always
prompt: "This will release {{.NEXT}}. Continue?"
preconditions:
- sh: '[ $(git symbolic-ref --short HEAD) = "main" ]'
msg: Not on main branch
- sh: "[ $(git status --porcelain=2 | wc -l) = 0 ]"
msg: "Git is dirty"
cmds:
- task: fetch-tags
- git commit --allow-empty -m "{{.NEXT}}"
- git tag --annotate --sign -m "{{.NEXT}}" {{.NEXT}} {{.CLI_ARGS}}
- echo "Pushing {{.NEXT}}..."
- git push origin main --follow-tags
fetch-tags:
cmds:
- git tag -d nightly || true
- git fetch --tags