-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (70 loc) · 3.5 KB
/
Copy pathMakefile
File metadata and controls
93 lines (70 loc) · 3.5 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
# =============================================================================
# Kora Protocol — Makefile
# =============================================================================
.PHONY: build test clean fmt lint check audit coverage deploy-testnet deploy-mainnet
WASM_TARGET := wasm32-unknown-unknown
CONTRACTS := access_control invoice_nft marketplace financing_pool treasury risk_registry
COVERAGE_MIN ?= 95
# ── Build ─────────────────────────────────────────────────────────────────────
build:
cargo build --target $(WASM_TARGET) --release
build-optimized: build
@for c in $(CONTRACTS); do \
wasm="target/$(WASM_TARGET)/release/kora_$${c}.wasm"; \
if [ -f "$$wasm" ]; then \
stellar contract optimize --wasm "$$wasm"; \
echo "Optimized: $$wasm"; \
fi; \
done
# ── Test ──────────────────────────────────────────────────────────────────────
test:
cargo test --all
test-verbose:
cargo test --all -- --nocapture
# ── Code Quality ──────────────────────────────────────────────────────────────
fmt:
cargo fmt --all
lint:
cargo clippy --all -- -D warnings
check:
cargo check --all
# ── Audit ─────────────────────────────────────────────────────────────────────
audit:
cargo audit
cargo deny check
coverage:
@echo "Running coverage analysis (threshold: $(COVERAGE_MIN)%)..."
cargo tarpaulin --all --timeout 300 --out Stdout | tee /tmp/coverage.txt
@coverage=$$(grep -oP 'Coverage: \K[0-9.]+' /tmp/coverage.txt | head -1); \
if [ -z "$$coverage" ]; then \
echo "Error: Could not parse coverage percentage"; \
exit 1; \
fi; \
if (( $$(echo "$$coverage < $(COVERAGE_MIN)" | bc -l) )); then \
echo "Coverage $$coverage% is below threshold of $(COVERAGE_MIN)%"; \
exit 1; \
else \
echo "Coverage $$coverage% meets threshold of $(COVERAGE_MIN)%"; \
fi
# ── Clean ─────────────────────────────────────────────────────────────────────
clean:
cargo clean
# ── Deploy ────────────────────────────────────────────────────────────────────
deploy-testnet: build-optimized
bash scripts/deploy.sh testnet
deploy-mainnet: build-optimized
@echo "WARNING: Deploying to MAINNET. Press Ctrl+C to abort, Enter to continue."
@read _
bash scripts/deploy.sh mainnet
# ── Helpers ───────────────────────────────────────────────────────────────────
setup:
rustup target add $(WASM_TARGET)
cargo install stellar-cli --locked
sizes: build
@echo "WASM sizes:"
@for c in $(CONTRACTS); do \
wasm="target/$(WASM_TARGET)/release/kora_$${c}.wasm"; \
if [ -f "$$wasm" ]; then \
printf " %-25s %s\n" "$$c" "$$(du -sh $$wasm | cut -f1)"; \
fi; \
done