-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
99 lines (83 loc) · 2.3 KB
/
Taskfile.yml
File metadata and controls
99 lines (83 loc) · 2.3 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
version: '3'
vars:
BINARY: craft
CMD: ./cmd/craft
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo "dev"
LDFLAGS: -s -w -X github.com/erdemtuna/craft/internal/version.Version={{.VERSION}}
tasks:
default:
desc: List available tasks
cmds:
- task --list
build:
desc: Build the binary
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o {{.BINARY}} {{.CMD}}
test:
desc: Run tests with race detector
cmds:
- go test -race ./...
test:coverage:
desc: Run tests with coverage report
cmds:
- go test -race -coverprofile=coverage.out ./...
- go tool cover -func=coverage.out
- go tool cover -html=coverage.out -o coverage.html
- echo "Coverage report written to coverage.html"
fmt:
desc: Format Go source files
cmds:
- gofmt -w .
fmt:check:
desc: Check formatting (fails if files need formatting)
cmds:
- test -z "$(gofmt -l .)" || { gofmt -l . && echo "Files above need formatting. Run 'task fmt'" && exit 1; }
vet:
desc: Run go vet
cmds:
- go vet ./...
lint:
desc: Run golangci-lint
cmds:
- golangci-lint run ./...
vuln:
desc: Run govulncheck for known vulnerabilities
cmds:
- govulncheck ./...
ci:
desc: Run full CI pipeline locally
cmds:
- task: fmt:check
- task: vet
- task: lint
- task: vuln
- task: test
- task: build
install:
desc: Install binary to $GOPATH/bin
cmds:
- go install -ldflags "{{.LDFLAGS}}" {{.CMD}}
tools:install:
desc: Install development tools (golangci-lint, govulncheck)
cmds:
- curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b "$(go env GOPATH)/bin"
- go install golang.org/x/vuln/cmd/govulncheck@latest
- echo "Development tools installed"
hooks:install:
desc: Install git hooks (pre-commit and pre-push)
cmds:
- git config core.hooksPath .githooks
- echo "Git hooks installed (.githooks/)"
hooks:uninstall:
desc: Uninstall git hooks
cmds:
- git config --unset core.hooksPath 2>/dev/null || true
- echo "Git hooks uninstalled"
clean:
desc: Remove build artifacts
cmds:
- rm -f {{.BINARY}}
- rm -f coverage.out coverage.html
- rm -rf dist/
- rm -rf .task/