-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfile.yml
More file actions
129 lines (111 loc) · 4.34 KB
/
Copy pathTaskfile.yml
File metadata and controls
129 lines (111 loc) · 4.34 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
version: "3"
includes:
site:
taskfile: website/Taskfile.yml
dir: website
# Every *.modelith.yaml the repo treats as a golden fixture: the root example
# and the worked example embedded in the docs. Both are linted strictly and their
# committed .md is render-checked, so neither can drift from real tool output.
vars:
EXAMPLES: examples/*.modelith.yaml docs/05-parking-garage/*.modelith.yaml
# Stamp local builds with a version. Go's own VCS stamping
# (debug.ReadBuildInfo) doesn't fire in some worktree layouts, so we set it
# explicitly. goreleaser overrides this with the release tag.
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo dev
LDFLAGS: -X main.version={{.VERSION}}
tasks:
default:
desc: List available tasks
cmds:
- task --list
silent: true
build:
desc: Build the modelith binary into ./bin
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o bin/modelith ./cmd/modelith
install:
desc: go install modelith into GOBIN
cmds:
- go install -ldflags "{{.LDFLAGS}}" ./cmd/modelith
test:
desc: Run unit tests with cross-package coverage
cmds:
# -coverpkg=./... credits each package for code exercised by ANY package's
# tests, so the reported numbers reflect real coverage. Without it, helpers
# in internal/schema and internal/model that are driven only by lint/cmd
# tests show a misleadingly low per-package figure.
- go test -race -coverpkg=./... -coverprofile=coverage.out ./...
cover:
desc: Show the per-function coverage report (run `task test` first)
cmds:
- go tool cover -func=coverage.out
vet:
desc: Run go vet
cmds:
- go vet ./...
staticcheck:
desc: Run staticcheck (pinned version)
# staticcheck v0.7.0 is a Go 1.25-era release. Run as `go run …@v0.7.0`, its
# own go.mod makes the toolchain resolve to 1.25.x, and a 1.25-built
# staticcheck can't analyze this module's go1.26 code ("package requires
# newer Go version go1.26"). Force a floor of go1.26 (auto-upgrading if a
# newer toolchain is the default) so staticcheck is built by go1.26+. Drop
# this once staticcheck v0.8.0 ships stable — it requires and builds on 1.26.
env:
GOTOOLCHAIN: go1.26.0+auto
cmds:
- go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./...
lint:
desc: Run golangci-lint (pinned version)
# A golangci-lint binary built with an older Go toolchain refuses to target
# this module's go1.26 code. Run the pinned version via `go run` with the
# same go1.26 floor as staticcheck, so it is built by go1.26+ regardless of
# any locally installed golangci-lint. The version matches CI's pinned
# golangci-lint-action version.
env:
GOTOOLCHAIN: go1.26.0+auto
cmds:
- go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 run ./...
fmt:
desc: Format all Go code
cmds:
- gofmt -w .
tidy:
desc: Tidy go.mod / go.sum
cmds:
- go mod tidy
lint-models:
desc: Lint the example domain models (strict — completeness gaps are errors)
cmds:
- go run ./cmd/modelith lint --completeness error {{.EXAMPLES}}
render:
desc: Render the example domain models to Markdown
cmds:
- for f in {{.EXAMPLES}}; do go run ./cmd/modelith render "$f"; done
render-check:
desc: Verify committed Markdown is up to date (used in CI)
cmds:
- for f in {{.EXAMPLES}}; do go run ./cmd/modelith render --check "$f"; done
validate-plugin:
desc: Validate the Claude Code plugin manifest + skill frontmatter (needs the `claude` CLI)
cmds:
- claude plugin validate ./plugin --strict
mermaid-check:
desc: >-
Parse every emitted/committed Mermaid diagram with the real mermaid-cli
(needs npx/node). NOT part of `check` — deliberately, unlike
validate-plugin — so `task check` stays green for contributors without
node/npm installed; CI runs the real thing instead.
cmds:
- bash hack/mermaid-check.sh
check:
desc: CI parity (vet, staticcheck, golangci-lint, test, lint models, render-check) plus the local-only claude-based validate-plugin (CI does a lighter jq check instead)
cmds:
- task: vet
- task: staticcheck
- task: lint
- task: test
- task: lint-models
- task: render-check
- task: validate-plugin