-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
134 lines (114 loc) · 3.58 KB
/
Taskfile.yaml
File metadata and controls
134 lines (114 loc) · 3.58 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
version: '3'
vars:
BINARY_NAME: kelp
BUILD_DIR: ./build
COVERAGE_DIR: ./coverage
tasks:
default:
desc: Show available tasks
cmds:
- task --list
clean:
desc: Clean build artifacts and coverage reports
cmds:
- rm -rf {{.BUILD_DIR}}
- rm -rf {{.COVERAGE_DIR}}
- rm -f {{.BINARY_NAME}}
- rm -f coverage.out coverage.html
deps:
desc: Download and verify dependencies
cmds:
- go mod download
- go mod verify
build:
desc: Build the application
deps: [clean]
cmds:
- mkdir -p {{.BUILD_DIR}}
- go build -o {{.BUILD_DIR}}/{{.BINARY_NAME}} .
test:
desc: Run all tests
cmds:
- echo "Running unit tests..."
- go test -v ./...
test-unit:
desc: Run unit tests only
cmds:
- echo "Running unit tests..."
- go test -v ./... -run "^Test"
test-integration:
desc: Run integration tests only
cmds:
- echo "Running integration tests..."
- go test -v ./... -run "Integration"
test-coverage:
desc: Run tests with coverage report
cmds:
- mkdir -p {{.COVERAGE_DIR}}
- go test -v -cover -coverprofile={{.COVERAGE_DIR}}/coverage.out ./...
- go tool cover -html={{.COVERAGE_DIR}}/coverage.out -o {{.COVERAGE_DIR}}/coverage.html
- 'echo "Coverage report generated: {{.COVERAGE_DIR}}/coverage.html"'
test-coverage-text:
desc: Run tests with coverage report (text output)
cmds:
- go test -v -cover -coverprofile=coverage.out ./...
- go tool cover -func=coverage.out
- rm -f coverage.out
lint:
desc: Run linter
cmds:
- echo "Running linter..."
- go vet ./...
- go fmt ./...
- golangci-lint run --timeout=5m
lint-check:
desc: Check code formatting and linting
cmds:
- echo "Checking code formatting..."
- test -z "$(go fmt ./...)"
- go vet ./...
security:
desc: Run security scanner (requires gosec)
cmds:
- echo "Running security scanner..."
- gosec ./...
preconditions:
- sh: command -v gosec
msg: "gosec is not installed. Run: go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest"
ci:
desc: Run CI pipeline (lint, test, build)
cmds:
- task: lint-check
- task: test-coverage-text
- task: build
ci-full:
desc: Run full CI pipeline with benchmarks
cmds:
- task: deps
- task: lint-check
- task: test-coverage
- task: build
setup-dev:
desc: Setup development environment
cmds:
- echo "Setting up development environment..."
- go mod download
- go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest
- go install github.com/go-task/task/v3/cmd/task@latest
- echo "Development environment setup complete!"
test-race:
desc: Run tests with race detection
cmds:
- echo "Running tests with race detection..."
- go test -v -race ./...
release:
desc: Build release binaries for multiple platforms
deps: [clean, test-coverage-text, lint-check]
cmds:
- mkdir -p {{.BUILD_DIR}}/release
- echo "Building release binaries..."
- GOOS=darwin GOARCH=amd64 go build -o {{.BUILD_DIR}}/release/{{.BINARY_NAME}}-darwin-amd64 .
- GOOS=darwin GOARCH=arm64 go build -o {{.BUILD_DIR}}/release/{{.BINARY_NAME}}-darwin-arm64 .
- GOOS=linux GOARCH=amd64 go build -o {{.BUILD_DIR}}/release/{{.BINARY_NAME}}-linux-amd64 .
- GOOS=linux GOARCH=arm64 go build -o {{.BUILD_DIR}}/release/{{.BINARY_NAME}}-linux-arm64 .
- echo "Release binaries built in {{.BUILD_DIR}}/release/"