-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (38 loc) · 1.43 KB
/
Copy pathMakefile
File metadata and controls
50 lines (38 loc) · 1.43 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
.PHONY: help up down psql build test bench report fmt lint clean
POSTGRES_URL ?= postgres://benchmark:benchmark@localhost:5433/benchmark?sslmode=disable
help:
@echo "Targets:"
@echo " up — start ephemeral Postgres via docker-compose"
@echo " down — stop and remove Postgres + its data volume"
@echo " psql — connect to the benchmark Postgres"
@echo " build — build ./cmd/bench"
@echo " test — run Go tests"
@echo " bench — run a scenario: make bench LIB=river SCENARIO=steady"
@echo " report — analyze collected JSONL data"
@echo " fmt — gofmt + goimports"
@echo " clean — remove build artifacts and results"
up:
docker compose up -d
@echo "Waiting for Postgres..."
@until docker compose exec -T postgres pg_isready -U benchmark -d benchmark >/dev/null 2>&1; do sleep 1; done
@echo "Postgres ready at $(POSTGRES_URL)"
down:
docker compose down -v
psql:
docker compose exec postgres psql -U benchmark -d benchmark
build:
go build -o bin/bench ./cmd/bench
test:
QB_POSTGRES_URL='$(POSTGRES_URL)' go test -p 1 ./...
test-unit:
go test ./...
bench: build
@if [ -z "$(LIB)" ] || [ -z "$(SCENARIO)" ]; then echo "Usage: make bench LIB=<river|platlib> SCENARIO=<name>"; exit 1; fi
./bin/bench run --lib=$(LIB) --scenario=$(SCENARIO) --postgres-url='$(POSTGRES_URL)'
report:
./bin/bench report --results-dir=./results
fmt:
gofmt -w .
go mod tidy
clean:
rm -rf bin/ results/