-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
62 lines (53 loc) · 1.46 KB
/
Copy pathTaskfile.yml
File metadata and controls
62 lines (53 loc) · 1.46 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
version: "3"
vars:
BINARY_NAME:
sh: echo hatch
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo "dev"
COMMIT:
sh: git rev-parse --short HEAD 2>/dev/null || echo "unknown"
DATE:
sh: date -u +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || echo "unknown"
tasks:
build:
desc: Build the binary
cmds:
- mkdir -p bin
- echo "Building {{.BINARY_NAME}}..."
- go build -ldflags "-X main.version={{.VERSION}} -X main.commit={{.COMMIT}} -X main.date={{.DATE}}" -o bin/{{.BINARY_NAME}} ./cmd/hatch
install:
desc: Install the binary
cmds:
- echo "Installing {{.BINARY_NAME}}..."
- go install -ldflags "-X main.version={{.VERSION}} -X main.commit={{.COMMIT}} -X main.date={{.DATE}}" ./cmd/hatch
test:
desc: Run tests
cmds:
- echo "Running tests..."
- go test -v ./...
test-coverage:
desc: Run tests with coverage
cmds:
- echo "Running tests with coverage..."
- go test -v -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out -o coverage.html
clean:
desc: Clean build artifacts
cmds:
- echo "Cleaning..."
- rm -rf bin/
- rm -f coverage.out coverage.html
run:
desc: Build and run the binary
deps:
- build
cmds:
- ./bin/{{.BINARY_NAME}}{{if .CLI_ARGS}} {{.CLI_ARGS}}{{end}}
lint:
desc: Run linter
cmds:
- golangci-lint run
fmt:
desc: Format code
cmds:
- go fmt ./...