-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (71 loc) · 2.13 KB
/
Copy pathMakefile
File metadata and controls
89 lines (71 loc) · 2.13 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
.PHONY: build run test clean dev install swagger docker-build docker-push
# Build the server binary
build: swagger
go build -o bin/taskwarrior-api ./cmd/server
# Run the server
run: swagger
go run ./cmd/server
# Run with hot reload (requires air: go install github.com/air-verse/air@latest)
dev:
air
# Generate Swagger documentation
swagger:
swag init -g cmd/server/main.go -o docs
# Run tests
test:
go test -v ./...
# Run tests with coverage
test-coverage:
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
# Install dependencies
install:
go mod download
go mod tidy
go install github.com/swaggo/swag/cmd/swag@latest
# Clean build artifacts
clean:
rm -rf bin/
rm -rf docs/
rm -f coverage.out
# Format code
fmt:
go fmt ./...
# Lint code (requires golangci-lint)
lint:
golangci-lint run
# Docker commands
docker-build:
docker build -t taskwarrior-api:latest .
docker-push:
@echo "Tag and push to your registry:"
@echo " docker tag taskwarrior-api:latest your-registry/taskwarrior-api:latest"
@echo " docker push your-registry/taskwarrior-api:latest"
# Kubernetes deployment
k8s-deploy:
kubectl apply -f k8s/deployment.yaml
docker-down:
docker-compose down
k8s-logs:
kubectl logs -f -n taskwarrior deployment/taskwarrior-api
docker: docker-build docker-up
# Show help
help:
@echo "Available targets:"
@echo " build - Build the server binary"
@echo " run - Run the server"
@echo " dev - Run with hot reload (requires air)"
@echo " swagger - Generate Swagger documentation"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage report"
@echo " install - Install/update dependencies"
@echo " clean - Clean build artifacts"
@echo " fmt - Format code"
@echo " lint - Lint code (requires golangci-lint)"
@echo ""
@echo "Docker targets:"
@echo " docker-build - Build Docker image"
@echo " docker-up - Start Docker container"
@echo " docker-down - Stop Docker container"
@echo " docker-logs - View Docker logs"
@echo " docker - Build and start Docker container"