-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
115 lines (100 loc) · 2.73 KB
/
Taskfile.yml
File metadata and controls
115 lines (100 loc) · 2.73 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
version: '3'
vars:
BINARY_SERVER: queuekitd
BINARY_CLI: queuekit
CMD_SERVER: ./cmd/queuekitd
CMD_CLI: ./cmd/queuekit
VERSION:
sh: echo "${VERSION:-dev}"
COMMIT:
sh: git rev-parse --short HEAD 2>/dev/null || echo "unknown"
BUILD_TIME:
sh: date -u '+%Y-%m-%d_%H:%M:%S'
tasks:
default:
desc: Build both binaries
cmds:
- task: build
build:
desc: Build both binaries
cmds:
- task: build-server
- task: build-cli
build-server:
desc: Build queuekitd server binary
cmds:
- echo "Building {{.BINARY_SERVER}}..."
- go build -ldflags "-X main.Version={{.VERSION}} -X main.Commit={{.COMMIT}} -X main.BuildTime={{.BUILD_TIME}}" -o {{.BINARY_SERVER}} {{.CMD_SERVER}}
sources:
- "**/*.go"
- go.mod
- go.sum
generates:
- "{{.BINARY_SERVER}}"
build-cli:
desc: Build queuekit CLI binary
cmds:
- echo "Building {{.BINARY_CLI}}..."
- go build -ldflags "-X main.Version={{.VERSION}} -X main.Commit={{.COMMIT}} -X main.BuildTime={{.BUILD_TIME}}" -o {{.BINARY_CLI}} {{.CMD_CLI}}
sources:
- "**/*.go"
- go.mod
- go.sum
generates:
- "{{.BINARY_CLI}}"
test:
desc: Run tests with race detector
cmds:
- echo "Running tests..."
- go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
test-coverage:
desc: Run tests and generate coverage report
cmds:
- task: test
- echo "Generating coverage report..."
- go tool cover -html=coverage.txt -o coverage.html
- echo "Coverage report generated{{":"}} coverage.html"
lint:
desc: Run golangci-lint
cmds:
- echo "Running linters..."
- golangci-lint run ./...
fmt:
desc: Format code with gofmt and goimports
cmds:
- echo "Formatting code..."
- go fmt ./...
- goimports -w .
tidy:
desc: Run go mod tidy
cmds:
- echo "Tidying go.mod..."
- go mod tidy
clean:
desc: Remove build artifacts
cmds:
- echo "Cleaning..."
- rm -f {{.BINARY_SERVER}} {{.BINARY_CLI}}
- rm -f coverage.txt coverage.html
- rm -rf dist/ bin/
run-server:
desc: Build and run queuekitd
deps:
- build-server
cmds:
- echo "Running {{.BINARY_SERVER}}..."
- ./{{.BINARY_SERVER}}
run-cli:
desc: Build and run queuekit CLI
deps:
- build-cli
cmds:
- echo "Running {{.BINARY_CLI}}..."
- ./{{.BINARY_CLI}}
install-tools:
desc: Install development tools
cmds:
- echo "Installing development tools..."
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- go install golang.org/x/tools/cmd/goimports@latest
- echo "Tools installed successfully"