-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
85 lines (70 loc) · 1.7 KB
/
Taskfile.yml
File metadata and controls
85 lines (70 loc) · 1.7 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
version: '3'
vars:
BINARY_NAME: api
BUILD_DIR: bin
MAIN_PATH: cmd/api/main.go
tasks:
default:
desc: Show available tasks
cmds:
- task --list
build:
desc: Build the application
cmds:
- echo "Building..."
- go build -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.MAIN_PATH}}
- echo "Build complete: {{.BUILD_DIR}}/{{.BINARY_NAME}}"
run:
desc: Run the application
cmds:
- go run {{.MAIN_PATH}}
dev:
desc: Run the application with live reload (requires air)
cmds:
- air
test:
desc: Run tests
cmds:
- go test -v ./...
test-cover:
desc: Run tests with coverage
cmds:
- go test -cover -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out -o coverage.html
- echo "Coverage report generated: coverage.html"
clean:
desc: Clean build artifacts
cmds:
- echo "Cleaning..."
- rm -rf {{.BUILD_DIR}}/
- rm -f coverage.out coverage.html
- echo "Clean complete"
deps:
desc: Download dependencies
cmds:
- go mod download
- go mod tidy
fmt:
desc: Format code
cmds:
- go fmt ./...
lint:
desc: Run linter (requires golangci-lint)
cmds:
- golangci-lint run
docker-build:
desc: Build Docker image
cmds:
- docker build -t unitedapi:latest .
docker-run:
desc: Run Docker container
cmds:
- docker run -p 8080:8080 --env-file .env unitedapi:latest
install-air:
desc: Install air for live reload
cmds:
- go install github.com/cosmtrek/air@latest
install-lint:
desc: Install golangci-lint
cmds:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest