-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (44 loc) · 1.68 KB
/
Makefile
File metadata and controls
64 lines (44 loc) · 1.68 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
.PHONY: up down build test migrate seed logs-api logs-worker clean help
up: ## Start all services
docker compose up --build -d
down: ## Stop all services and remove volumes
docker compose down -v
build: ## Build the API and Worker binaries
go build -o bin/api ./cmd/api
go build -o bin/worker ./cmd/worker
test: ## Run all tests
go test -v ./...
test-coverage: ## Run tests with coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
migrate: ## Run database migrations
docker compose exec postgres psql -U payments -d payments -f /docker-entrypoint-initdb.d/001_initial_schema.sql
seed: ## Seed the database with sample data
docker compose exec postgres psql -U payments -d payments -c "INSERT INTO counters (name, value) VALUES ('duplicates', 0) ON CONFLICT DO NOTHING;"
logs-api: ## Show API logs
docker compose logs -f api
logs-worker: ## Show Worker logs
docker compose logs -f worker
logs: ## Show all logs
docker compose logs -f
clean: ## Clean build artifacts
rm -rf bin/
rm -f coverage.out coverage.html
deps: ## Download Go dependencies
go mod download
go mod tidy
lint: ## Run linter
golangci-lint run
restart-api: ## Restart API service
docker compose restart api
restart-worker: ## Restart Worker service
docker compose restart worker
ps: ## Show running services
docker compose ps
health: ## Check health endpoint
curl -s http://localhost:8080/health | jq .
metrics: ## Check metrics endpoint
curl -s http://localhost:8080/metrics | jq .
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help