-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (65 loc) · 3.37 KB
/
Copy pathMakefile
File metadata and controls
82 lines (65 loc) · 3.37 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
# Vortex Contracts — Makefile
#
# Wraps the commands documented in README.md so contributors never need to
# copy-paste raw multi-flag invocations. All targets run inside the
# intent_settlement workspace directory.
#
# Usage:
# make — print help
# make all — fmt + lint + test + build (full pre-push check)
# make fmt — format all source files
# make lint — clippy with -D warnings (identical to CI)
# make test — run unit / integration tests
# make build — compile the release wasm binary
# make deploy-testnet — deploy to Stellar testnet (requires STELLAR_SOURCE)
.DEFAULT_GOAL := help
# ── Configuration ─────────────────────────────────────────────────────────────
WORKSPACE := intent_settlement
WASM_TARGET := wasm32-unknown-unknown
WASM_OUT := $(WORKSPACE)/target/$(WASM_TARGET)/release/vortex_intent_settlement.wasm
STELLAR_NETWORK ?= testnet
# Set STELLAR_SOURCE to your secret key or key-name before running deploy-testnet
STELLAR_SOURCE ?=
# ── Compound targets ──────────────────────────────────────────────────────────
.PHONY: all
all: fmt lint test build ## Run fmt, lint, test, and build (full pre-push check)
# ── Individual targets ────────────────────────────────────────────────────────
.PHONY: fmt
fmt: ## Format all source files with rustfmt
cd $(WORKSPACE) && cargo fmt --all
.PHONY: fmt-check
fmt-check: ## Check formatting without modifying files (used by CI)
cd $(WORKSPACE) && cargo fmt --all -- --check
.PHONY: lint
lint: ## Run clippy with -D warnings (identical to the CI command)
cd $(WORKSPACE) && cargo clippy --all-targets -- -D warnings
.PHONY: test
test: ## Run the full test suite
cd $(WORKSPACE) && cargo test
.PHONY: build
build: ## Build the release wasm binary
cd $(WORKSPACE) && cargo build --target $(WASM_TARGET) --release
.PHONY: audit
audit: ## Run cargo-audit against the dependency tree
cd $(WORKSPACE) && cargo audit
.PHONY: clean
clean: ## Remove build artefacts
cd $(WORKSPACE) && cargo clean
# ── Deploy ────────────────────────────────────────────────────────────────────
.PHONY: deploy-testnet
deploy-testnet: build ## Deploy the wasm to Stellar testnet (set STELLAR_SOURCE first)
ifndef STELLAR_SOURCE
$(error STELLAR_SOURCE is not set. Export your Stellar secret key or key-name: export STELLAR_SOURCE=<SECRET_KEY>)
endif
stellar contract deploy \
--wasm $(WASM_OUT) \
--source $(STELLAR_SOURCE) \
--network $(STELLAR_NETWORK)
# ── Help ──────────────────────────────────────────────────────────────────────
.PHONY: help
help: ## Show this help message
@echo "Usage: make <target>"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*##"}; {printf " %-20s %s\n", $$1, $$2}'