-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (65 loc) · 1.73 KB
/
Makefile
File metadata and controls
84 lines (65 loc) · 1.73 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
.PHONY: all build test test-unit test-integration test-e2e test-all test-coverage lint fmt ci clean run docker-build docker-up docker-down docker-test docker-logs
# Default target
all: build
# Build all packages
build:
go build ./...
# Run unit tests (pkg/ only) with race detection
test:
go test -v -race ./pkg/...
# Alias for test
test-unit: test
# Run integration tests
test-integration:
go test -v -race ./tests/integration/...
# Run e2e tests
test-e2e:
go test -v -race ./tests/e2e/...
# Run all tests (unit + integration + e2e)
test-all:
go test -v -race ./...
# Run tests with coverage (80%+ threshold enforced in CI)
test-coverage:
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out
# Run linter
lint:
golangci-lint run --timeout=5m
# Format code
fmt:
gofmt -w .
# CI target: lint + all tests (used by GitHub Actions)
ci: lint test-all
# Clean build artifacts
clean:
rm -f coverage.out
go clean ./...
# Run the server (default port 8080, in-memory DB)
run:
go run cmd/server/main.go
# Run with persistent DB (usage: make run-persistent DB_PATH=/path/to/file.db)
run-persistent:
DB_PATH=$(DB_PATH) go run cmd/server/main.go
# Docker targets
docker-build:
docker compose build
docker-up:
docker compose up -d
docker-down:
docker compose down
docker-logs:
docker compose logs -f
# Run Docker integration test (builds, starts, tests, stops)
docker-test: docker-build
docker compose up -d
@echo "Waiting for emulator to be ready..."
@for i in $$(seq 1 30); do \
if curl -s http://localhost:8080/health > /dev/null 2>&1; then \
echo "Emulator is ready"; \
break; \
fi; \
echo "Waiting... ($$i/30)"; \
sleep 1; \
done
go run ./example/docker
docker compose down