-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
283 lines (241 loc) · 9.07 KB
/
mise.toml
File metadata and controls
283 lines (241 loc) · 9.07 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
[tools]
go = "1.26"
pre-commit = "4"
terraform = "1"
terragrunt = "0"
golangci-lint = "2"
uv = "0"
bun = "1" # VS Code extension development
"cargo:git-cliff" = "2" # Changelog generator
"pipx:bump-my-version" = "1"
"go:golang.org/x/perf/cmd/benchstat" = "latest" # uses date-based versions, not semver
"go:mvdan.cc/gofumpt" = "0"
"go:golang.org/x/vuln/cmd/govulncheck" = "1.1.4" # not bundled in golangci-lint
"go:github.com/google/go-licenses" = "1"
"go:golang.org/x/exp/cmd/gorelease" = "latest" # uses date-based versions, not semver
zizmor = "1"
actionlint = "1"
shellcheck = "0"
hadolint = "2"
yamllint = "1"
# =============================================================================
# Build & Install
# =============================================================================
[tasks.setup]
description = "Install dependencies and pre-commit hooks"
run = """
go mod download
go mod tidy
pre-commit install
pre-commit install --hook-type commit-msg
"""
[tasks.build]
description = "Build the binary"
run = """
#!/usr/bin/env bash
set -euo pipefail
VERSION="${VERSION:-dev}"
COMMIT="$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')"
DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
LDFLAGS="-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}"
echo "Building terratidy..."
go build -ldflags "${LDFLAGS}" -o bin/terratidy ./cmd/terratidy
"""
[tasks.install]
description = "Install the binary to GOPATH/bin"
depends = ["build"]
run = """
#!/usr/bin/env bash
set -euo pipefail
VERSION="${VERSION:-dev}"
COMMIT="$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')"
DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
LDFLAGS="-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}"
echo "Installing terratidy to $(go env GOPATH)/bin..."
go install -ldflags "${LDFLAGS}" ./cmd/terratidy
"""
[tasks."build:all"]
description = "Build for all platforms"
run = """
#!/usr/bin/env bash
set -euo pipefail
VERSION="${VERSION:-dev}"
COMMIT="$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')"
DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
LDFLAGS="-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}"
echo "Building for multiple platforms..."
GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o bin/terratidy-linux-amd64 ./cmd/terratidy
GOOS=linux GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o bin/terratidy-linux-arm64 ./cmd/terratidy
GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o bin/terratidy-darwin-amd64 ./cmd/terratidy
GOOS=darwin GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o bin/terratidy-darwin-arm64 ./cmd/terratidy
GOOS=windows GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o bin/terratidy-windows-amd64.exe ./cmd/terratidy
echo "Binaries built in bin/"
"""
# =============================================================================
# Testing
# =============================================================================
[tasks.test]
description = "Run tests"
run = "go test -v -race -cover ./..."
[tasks."test:coverage"]
description = "Run tests with HTML coverage report"
run = """
#!/usr/bin/env bash
set -euo pipefail
echo "Running tests with coverage..."
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -html=coverage.out -o coverage.html
echo "Coverage report generated: coverage.html"
"""
[tasks."test:integration"]
description = "Run integration tests"
depends = ["build"]
run = "go test -v -tags=integration ./..."
[tasks.benchmark]
description = "Run benchmarks"
run = "bash tools/scripts/benchmark.sh"
[tasks."benchmark:baseline"]
description = "Regenerate benchmark baseline"
run = "go test -bench=. -benchmem -count=6 -run=^$ ./internal/... | tee benchmarks/baseline.txt"
hide = true
[tasks."profile:cpu"]
description = "Generate CPU profile for a benchmark"
run = """
#!/usr/bin/env bash
set -euo pipefail
BENCH="${1:-BenchmarkRunnerParallel}"
PKG="${2:-./internal/runner/...}"
echo "Profiling CPU for $BENCH in $PKG..."
go test -bench="$BENCH" -cpuprofile=cpu.prof -run=^$ "$PKG"
echo "CPU profile saved to cpu.prof"
echo "View with: go tool pprof -http=:8080 cpu.prof"
"""
[tasks."profile:mem"]
description = "Generate memory profile for a benchmark"
run = """
#!/usr/bin/env bash
set -euo pipefail
BENCH="${1:-BenchmarkRunnerParallel}"
PKG="${2:-./internal/runner/...}"
echo "Profiling memory for $BENCH in $PKG..."
go test -bench="$BENCH" -memprofile=mem.prof -run=^$ "$PKG"
echo "Memory profile saved to mem.prof"
echo "View with: go tool pprof -http=:8080 mem.prof"
"""
[tasks.fuzz]
description = "Run fuzz tests with auto-discovery"
run = "bash tools/scripts/fuzz.sh ${1:-30s}"
# =============================================================================
# Code Quality
# =============================================================================
[tasks.lint]
description = "Run all linters (golangci-lint: staticcheck, revive, gosec, and more)"
run = "golangci-lint run"
[tasks.vuln]
description = "Check for security vulnerabilities"
run = "govulncheck ./..."
[tasks.fmt]
description = "Format code with gofumpt"
run = "gofumpt -l -w ."
[tasks.vet]
description = "Run go vet"
run = "go vet ./..."
[tasks.check]
description = "Run all quality checks"
depends = ["fmt", "vet", "lint", "test"]
[tasks."check:strict"]
description = "Run all checks with vulnerability scan"
depends = ["fmt", "vet", "lint", "vuln", "test"]
# =============================================================================
# Docker
# =============================================================================
[tasks."docker:build"]
description = "Build Docker image for local development"
depends = ["build"]
run = """
#!/usr/bin/env bash
set -euo pipefail
echo "Building Docker image..."
cp bin/terratidy terratidy
docker build -t terratidy-dev .
rm -f terratidy
"""
[tasks."docker:run"]
description = "Run TerraTidy in Docker"
depends = ["docker:build"]
run = 'docker run --rm -v "$PWD":/app terratidy-dev check'
# =============================================================================
# Development Tools
# =============================================================================
[tasks.dev]
description = "Run policy dev mode (watches policy dir for changes)"
run = """
#!/usr/bin/env bash
set -euo pipefail
VERSION="${VERSION:-dev}"
COMMIT="$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')"
DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
LDFLAGS="-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}"
go run -ldflags "${LDFLAGS}" ./cmd/terratidy dev
"""
# =============================================================================
# Cleanup
# =============================================================================
[tasks.clean]
description = "Clean build artifacts"
run = """
rm -rf bin/ dist/
rm -f coverage.out coverage.html
rm -f *.test
go clean
"""
[tasks."clean:all"]
description = "Clean all generated files and caches"
run = """
rm -rf bin/ dist/ coverage/ benchmarks/
rm -f coverage.out coverage.html coverage.txt
rm -f *.test *.prof
go clean -cache -testcache -modcache
echo "All generated files cleaned"
"""
# =============================================================================
# Release & Versioning
# =============================================================================
[tasks.changelog]
description = "Generate CHANGELOG.md from git commits"
run = "git-cliff --config cliff.toml -o CHANGELOG.md"
[tasks."changelog:preview"]
description = "Preview changelog without writing to file"
run = "git-cliff --config cliff.toml --unreleased"
[tasks."bump:patch"]
description = "Bump patch version (e.g., 0.2.0 -> 0.2.1)"
run = "uv tool run bump-my-version bump patch"
[tasks."bump:minor"]
description = "Bump minor version (e.g., 0.2.0 -> 0.3.0)"
run = "uv tool run bump-my-version bump minor"
[tasks."bump:major"]
description = "Bump major version (e.g., 0.2.0 -> 1.0.0)"
run = "uv tool run bump-my-version bump major"
[tasks."bump:pre"]
description = "Bump pre-release version (e.g., alpha.1 -> alpha.2)"
run = "uv tool run bump-my-version bump pre_n"
[tasks."bump:release"]
description = "Bump to release version (remove pre-release suffix)"
run = "uv tool run bump-my-version bump pre_l"
[tasks."version:show"]
description = "Show current version and possible bumps"
run = "uv tool run bump-my-version show-bump"
# VSCode extension versioning (independent from Go project)
# See vscode/.bumpversion.toml for version scheme documentation
[tasks."vscode:bump:patch"]
description = "Bump VSCode extension patch version (e.g., 0.2.0 -> 0.2.1)"
run = "cd vscode && uv tool run bump-my-version bump patch --config-file .bumpversion.toml"
[tasks."vscode:bump:minor"]
description = "Bump VSCode extension minor version (e.g., 0.2.0 -> 0.3.0, resets patch)"
run = "cd vscode && uv tool run bump-my-version bump minor --config-file .bumpversion.toml"
[tasks."vscode:bump:major"]
description = "Bump VSCode extension major version (e.g., 0.2.0 -> 1.0.0, resets patch)"
run = "cd vscode && uv tool run bump-my-version bump major --config-file .bumpversion.toml"
[tasks."vscode:version:show"]
description = "Show current VSCode extension version"
run = "cd vscode && uv tool run bump-my-version show-bump --config-file .bumpversion.toml"