-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (50 loc) · 2.37 KB
/
Makefile
File metadata and controls
72 lines (50 loc) · 2.37 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
.PHONY: run build test test-unit test-integration migrate migrate-down lint swagger docker-up docker-down
# ── Local development ─────────────────────────────────────────
run:
go run ./cmd/api
build:
go build -o bin/fairqueue ./cmd/api
# ── Tests ─────────────────────────────────────────────────────
# Unit tests only (domain layer — fast, no containers)
test-unit:
go test ./internal/domain/... ./internal/auth/...
# Integration tests (spins up real Postgres + Redis via testcontainers)
test-integration:
go test ./internal/store/... ./internal/service/... ./internal/worker/... -timeout 120s
# E2E tests
test-e2e:
go test ./internal/e2e/... -v -timeout 180s
# All tests
test:
go test ./... -timeout 120s
# ── Database ──────────────────────────────────────────────────
# Run migrations against the local DB (requires .env to be loaded)
migrate:
@echo "Running migrations..."
@for f in migrations/*.sql; do \
echo "Applying $$f"; \
psql "$$DATABASE_URL" -f "$$f"; \
done
# ── Docs ──────────────────────────────────────────────────────
swagger:
swag init -g internal/api/server.go -o docs/
@echo "Swagger UI available at http://localhost:8080/swagger/index.html"
# ── Lint ──────────────────────────────────────────────────────
lint:
golangci-lint run ./...
# ── Docker ───────────────────────────────────────────────────
docker-build:
docker compose up --build -d
docker-up:
docker compose up -d
@echo "FairQueue running at http://localhost:8080"
@echo "Swagger UI at http://localhost:8080/swagger/index.html"
docker-down:
docker compose down
docker-logs:
docker compose logs -f app
# Start only infrastructure (Postgres + Redis) — run app locally
infra-up:
docker compose up postgres redis -d
infra-down:
docker compose down postgres redis