-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
155 lines (114 loc) · 5.46 KB
/
Makefile
File metadata and controls
155 lines (114 loc) · 5.46 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
.PHONY: rapid build test test-cov format lint check integration verify policy policy-tests policy-live \
ground-control-mcp-install sync-ground-control-policy scaffold-controller scaffold-audited-entity \
scaffold-l2-state-machine sync-packs trigger-pack-sync dev clean up down docker-build smoke frontend-install frontend-dev \
frontend-build frontend-lint frontend-format frontend-test deploy deploy-infra
# --- Rapid dev loop (< 5s) ---
rapid: ## Format + compile, no tests or static analysis
cd backend && ./gradlew spotlessApply compileJava -Pquick
# --- Standard ---
build: ## Build the project (no tests)
cd backend && ./gradlew build -x test -Pquick
test: ## Run unit tests (no static analysis)
cd backend && ./gradlew test -Pquick
test-cov: ## Run tests with coverage report
cd backend && ./gradlew test jacocoTestReport
format: ## Format code with Spotless
cd backend && ./gradlew spotlessApply
lint: ## Check formatting
cd backend && ./gradlew spotlessCheck
# --- Full verification (CI-equivalent) ---
check: ## Full build + tests + static analysis + coverage
cd backend && ./gradlew check
integration: ## Integration tests (Testcontainers)
cd backend && ./gradlew integrationTest
verify: ## Full CI-equivalent verification
cd backend && ./gradlew check integrationTest openjmlEsc
policy-tests: ## Run unit tests for repo policy tooling
python3 -m unittest discover -s tools/tests -p 'test_*.py'
policy: policy-tests ## Run repo-native policy checks shared by Claude and Codex
python3 bin/policy --skip-pr-body
ground-control-mcp-install: ## Install dependencies for the repo-local Ground Control MCP helpers
npm --prefix mcp/ground-control ci
policy-live: ground-control-mcp-install ## Run live Ground Control policy checks (requires GC_BASE_URL)
node tools/ground_control/check_adr_drift.mjs
node tools/ground_control/check_live_policy.mjs
sync-ground-control-policy: ground-control-mcp-install ## Sync repo policy expectations into Ground Control
node tools/ground_control/sync_policy.mjs --apply
sync-packs: ## Import and install cataloged packs into Ground Control (requires GC_BASE_URL and pack-registry token)
node tools/packs/sync_packs.mjs
trigger-pack-sync: ## Dispatch the remote pack sync workflow (PROJECT=<id> PACK_IDS=id1,id2 REF=<branch>)
./scripts/pack-sync.sh $(if $(PROJECT),--project $(PROJECT),) $(if $(PACK_IDS),--pack-ids $(PACK_IDS),) $(if $(REF),--ref $(REF),)
scaffold-controller: ## Create a controller + WebMvcTest scaffold (NAME=Foo FEATURE=bar)
python3 bin/scaffold-controller "$(FEATURE)" "$(NAME)"
scaffold-audited-entity: ## Create an audited entity scaffold (NAME=Foo AREA=bar)
python3 bin/scaffold-audited-entity "$(AREA)" "$(NAME)"
scaffold-l2-state-machine: ## Create an L2 state-machine scaffold (NAME=Foo AREA=bar)
python3 bin/scaffold-l2-state-machine "$(AREA)" "$(NAME)"
# --- Frontend ---
frontend-install: ## Install frontend dependencies
cd frontend && npm install
frontend-dev: ## Start frontend dev server (Vite)
cd frontend && npm run dev
frontend-build: ## Build frontend for production
cd frontend && npm run build
frontend-lint: ## Lint frontend code (Biome)
cd frontend && npm run lint
frontend-format: ## Format frontend code (Biome)
cd frontend && npm run format
frontend-test: ## Run frontend unit tests (Vitest)
cd frontend && npm test
# --- Infrastructure ---
dev: ## Start development server (loads .env)
set -a && [ -f .env ] && . ./.env && set +a && cd backend && ./gradlew bootRun
up: ## Start Docker Compose services (PostgreSQL, Redis)
docker compose up -d
down: ## Stop Docker Compose services
docker compose down
docker-build: ## Build Docker image (frontend + backend)
docker build -f backend/Dockerfile -t ghcr.io/keplerops/ground-control:latest .
smoke: docker-build ## Build Docker image and verify Flyway + health
@echo "Starting smoke test..."
@docker rm -f gc-smoke-db gc-smoke 2>/dev/null || true
@docker run -d --name gc-smoke-db \
-e POSTGRES_DB=ground_control \
-e POSTGRES_USER=gc \
-e POSTGRES_PASSWORD=gc \
-p 5433:5432 \
--health-cmd "pg_isready -U gc -d ground_control" \
--health-interval 2s --health-timeout 5s --health-retries 10 \
postgres:16
@echo "Waiting for database..."
@for i in $$(seq 1 30); do \
docker inspect --format='{{.State.Health.Status}}' gc-smoke-db 2>/dev/null | grep -q healthy && break; \
sleep 1; \
done
@docker run -d --name gc-smoke \
--network host \
-e GC_DATABASE_URL=jdbc:postgresql://localhost:5433/ground_control \
-e GC_DATABASE_USER=gc \
-e GC_DATABASE_PASSWORD=gc \
ghcr.io/keplerops/ground-control:latest
@echo "Waiting for application startup..."
@PASS=false; for i in $$(seq 1 60); do \
HEALTH=$$(curl -sf http://localhost:8000/actuator/health 2>/dev/null) && { \
echo "Smoke test passed: $$HEALTH"; PASS=true; break; \
}; \
sleep 2; \
done; \
if [ "$$PASS" != "true" ]; then \
echo "Smoke test failed after 120s"; \
docker logs gc-smoke; \
fi; \
docker rm -f gc-smoke-db gc-smoke 2>/dev/null || true; \
[ "$$PASS" = "true" ]
# --- AWS Deployment ---
deploy: ## Deploy latest image to EC2 (pulls, restarts, verifies health)
ssh gc-dev /opt/gc/deploy.sh
deploy-infra: ## Apply Terraform for dev environment
cd deploy/terraform/environments/dev && terraform apply
clean: ## Remove build artifacts
cd backend && ./gradlew clean
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help