-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (78 loc) · 4.87 KB
/
Copy pathMakefile
File metadata and controls
104 lines (78 loc) · 4.87 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Govrix Scout — Build Orchestration
# Usage: make <target>
.PHONY: help setup dev test lint build clean fmt check docker-up docker-down
CARGO := cargo
PNPM := pnpm
RUST_LOG ?= info
# ── Help ──────────────────────────────────────────────────────────────────────
help: ## Show available targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
# ── Setup ─────────────────────────────────────────────────────────────────────
setup: ## First-time project setup
@echo "==> Installing Rust toolchain..."
rustup update stable
rustup component add clippy rustfmt
@echo "==> Installing dashboard dependencies..."
cd dashboard && $(PNPM) install
@echo "==> Setup complete. Run 'make dev' to start development servers."
# ── Development ───────────────────────────────────────────────────────────────
dev: ## Start proxy + dashboard in watch mode
@echo "==> Starting development servers..."
$(CARGO) watch -x "run --bin govrix-scout" &
cd dashboard && $(PNPM) dev
dev-proxy: ## Start only the proxy in watch mode
RUST_LOG=$(RUST_LOG) $(CARGO) watch -x "run --bin govrix-scout"
dev-dashboard: ## Start only the dashboard
cd dashboard && $(PNPM) dev
# ── Build ─────────────────────────────────────────────────────────────────────
build: ## Build all crates in release mode
$(CARGO) build --release --workspace
build-proxy: ## Build only the proxy binary
$(CARGO) build --release -p govrix-scout-proxy
build-dashboard: ## Build dashboard for production
cd dashboard && $(PNPM) build
# ── Testing ───────────────────────────────────────────────────────────────────
test: ## Run all Rust tests
$(CARGO) test --workspace
test-proxy: ## Run proxy tests only
$(CARGO) test -p govrix-scout-proxy
test-integration: ## Run integration tests (requires running postgres)
$(CARGO) test --test '*' -- --test-threads=1
test-dashboard: ## Run dashboard tests
cd dashboard && $(PNPM) test
# ── Lint & Format ─────────────────────────────────────────────────────────────
lint: ## Run clippy on all crates
$(CARGO) clippy --workspace --all-targets --all-features -- -D warnings
fmt: ## Format all Rust code
$(CARGO) fmt --all
fmt-check: ## Check formatting without modifying files
$(CARGO) fmt --all -- --check
check: ## Run cargo check (fast compile check)
$(CARGO) check --workspace
# ── Database ──────────────────────────────────────────────────────────────────
migrate: ## Run database init SQL
@echo "==> Running init SQL..."
@for f in init/*.sql; do \
echo " Applying $$f..."; \
psql "$$DATABASE_URL" -f "$$f"; \
done
db-reset: ## Drop and recreate the database
@echo "==> Resetting database..."
psql "$$DATABASE_URL" -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"
$(MAKE) migrate
# ── Docker ────────────────────────────────────────────────────────────────────
docker-up: ## Start all Docker services
docker compose -f docker/docker-compose.yml up -d
docker-down: ## Stop all Docker services
docker compose -f docker/docker-compose.yml down
docker-build: ## Build Docker images
docker compose -f docker/docker-compose.yml build
docker-logs: ## Tail Docker logs
docker compose -f docker/docker-compose.yml logs -f
# ── Clean ─────────────────────────────────────────────────────────────────────
clean: ## Remove build artifacts
$(CARGO) clean
cd dashboard && rm -rf dist node_modules
# ── CI ────────────────────────────────────────────────────────────────────────
ci: fmt-check lint test build ## Run full CI pipeline (format check, lint, test, build)