forked from Soroban-Pulse/SorobanPulse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (70 loc) · 3.08 KB
/
Copy pathMakefile
File metadata and controls
91 lines (70 loc) · 3.08 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
.DEFAULT_GOAL := help
.PHONY: help build test test-db lint fmt run docker-up docker-down migrate clean gen-openapi
help: ## Show available targets
@grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*##"}; {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}'
build: ## Compile the project
cargo build
test: ## Run the full test suite (requires DATABASE_URL)
cargo test
test-db: ## Start a test Postgres container and run the full test suite
docker compose -f docker-compose.test.yml up -d --wait
DATABASE_URL=postgres://postgres:postgres@localhost/soroban_pulse_test cargo test; \
EXIT=$$?; \
docker compose -f docker-compose.test.yml down; \
exit $$EXIT
lint: ## Run clippy with warnings as errors
cargo clippy -- -D warnings
fmt: ## Format source code
cargo fmt
run: ## Start the development server
cargo run
docker-up: ## Start the full stack via Docker Compose and wait for app to be healthy
docker-compose up --build -d
docker-compose wait app
docker-down: ## Tear down the Docker Compose stack
docker-compose down
migrate: ## Run pending database migrations
cargo sqlx migrate run
migrate-down: ## Rollback the most recent migration
cargo sqlx migrate revert
check-migrations: ## Check for duplicate migration timestamps
@bash scripts/check-migrations.sh
clean: ## Remove build artifacts
cargo clean
rm -f openapi.json
gen-openapi: ## Regenerate openapi.json from handler signatures and sync docs/openapi.json
cargo run --bin gen_openapi > openapi.json
cp openapi.json docs/openapi.json
changelog: ## Generate changelog from git history (requires git-cliff)
@command -v git-cliff >/dev/null 2>&1 || { echo "git-cliff not installed. Install with: cargo install git-cliff"; exit 1; }
git-cliff --unreleased
generate-sdk: ## Generate TypeScript and Python SDKs from OpenAPI spec
cargo run --bin gen_openapi > openapi.json
# Generate TypeScript SDK
npx @openapitools/openapi-generator-cli generate \
-i openapi.json \
-g typescript-fetch \
-o sdk/typescript \
--additional-properties=typescriptThreePlus=true,supportsES6=true
# Generate Python SDK
npx @openapitools/openapi-generator-cli generate \
-i openapi.json \
-g python \
-o sdk/python \
--additional-properties=library=httpx
vacuum: ## Run VACUUM ANALYZE on the events table
@if [ -z "$$DATABASE_URL" ]; then echo "DATABASE_URL is not set"; exit 1; fi
psql "$$DATABASE_URL" -c "VACUUM ANALYZE events;"
.PHONY: run-zipkin zipkin-up zipkin-down
run-zipkin: ## Run with Zipkin tracing
ZIPKIN_ENDPOINT=$${ZIPKIN_ENDPOINT:-http://localhost:9411/api/v2/spans} \
cargo run --features zipkin
zipkin-up: ## Start Zipkin container
docker run -d -p 9411:9411 --name zipkin openzipkin/zipkin
zipkin-down: ## Stop Zipkin container
docker stop zipkin || true && docker rm zipkin || true
fuzz: ## Run fuzz tests locally (60 seconds each)
@command -v cargo-fuzz >/dev/null 2>&1 || cargo install cargo-fuzz
cd fuzz && cargo fuzz run fuzz_validate_contract_id -- -max_total_time=60
cd fuzz && cargo fuzz run fuzz_validate_tx_hash -- -max_total_time=60
cd fuzz && cargo fuzz run fuzz_pagination_params -- -max_total_time=60