-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
93 lines (80 loc) · 2.47 KB
/
Taskfile.yml
File metadata and controls
93 lines (80 loc) · 2.47 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
version: "3"
env:
GOCACHE: /tmp/go-cache
GOMODCACHE: /tmp/go-modcache
GOLANGCI_LINT_CACHE: /tmp/golangci-lint-cache
tasks:
go:gen:
desc: Run Go code generation
cmds:
- go run github.com/RevoTale/no-js/cmd/no-js gen assets -root .
- go generate ./internal/cmsgraphql
- go generate ./web
- go run ./cmd/techstackgen -in go.mod -out internal/techstack/generated.go
- go run ./cmd/fetchschema
go:gen:code-diff:
desc: Verify generated outputs are committed
cmds:
- |
set -euo pipefail
templ_files="$(find web -type f -name '*_templ.go' | sort)"
git diff --exit-code -- go.mod go.sum internal/cmsgraphql/generated.go internal/techstack/generated.go web/resolvers/generated.go web/generated/registry_gen.go web/generated/discovery_gen.go web/generated/bundle_gen.go web/generated/i18n/keys_gen.go web/generated/i18n/messages/bundle_gen.go $templ_files
go:fmt:
desc: Format Go sources
cmds:
- |
set -euo pipefail
files="$(find . -type f -name '*.go' -not -path './vendor/*' -not -path './no-js/*')"
if [ -n "$files" ]; then
gofmt -w $files
fi
go:lint:
desc: Run golangci-lint for all Go packages
cmds:
- golangci-lint run ./...
go:deadcode:
desc: Run deadcode analysis for all packages (including tests)
preconditions:
- sh: test -x "$(go env GOPATH)/bin/deadcode"
msg: "deadcode is not installed. Install with: go install golang.org/x/tools/cmd/deadcode@latest"
cmds:
- |
deadcode_bin="$(go env GOPATH)/bin/deadcode"
output="$(HOME=/tmp XDG_CACHE_HOME=/tmp "$deadcode_bin" -test ./...)"
if [ -n "$output" ]; then
echo "$output"
echo
echo "deadcode validation failed: remove unreachable functions or justify exclusions."
exit 1
fi
go:test:
desc: Run Go tests for all packages
cmds:
- go test ./...
gen:
desc: Run all code generation
cmds:
- task: go:gen
gen:check:
desc: Check code generation freshness (code diff)
cmds:
- task: go:gen:code-diff
gen:code-diff:
desc: CI fallback generation diff check
cmds:
- task: go:gen:code-diff
fix:
desc: Run auto-fixes
cmds:
- task: go:fmt
validate:
desc: Run project validation checks
cmds:
- task: go:lint
- task: go:deadcode
test:
desc: Run test suite
deps:
- validate
cmds:
- task: go:test