-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathMakefile
More file actions
106 lines (82 loc) · 4.54 KB
/
Copy pathMakefile
File metadata and controls
106 lines (82 loc) · 4.54 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
# Trellis Protocol — Build Automation
#
# Available targets:
# make help — list all targets
# make build — build everything (contract WASM + frontend)
# make test — run all tests (contract + frontend)
# make lint — run all linters (clippy + oxlint)
# make fmt — run cargo fmt on the workspace
# make typecheck-frontend — run tsc typecheck on the frontend
# make setup — install prerequisites (rustup target + npm deps)
# make deploy — deploy contract to testnet (see DEPLOYMENT.md)
# make clean — remove all build artifacts
# make build-contract — build only the contract WASM
# make build-cli — build only the CLI binary
# make build-frontend — build only the frontend bundle
# make test-contract — run only contract tests
# make test-snapshots-update — regenerate Soroban test snapshots (commit the result)
# make test-frontend — run only frontend tests
# make lint-contract — run only clippy on contract and CLI
# make lint-frontend — run only oxlint on frontend
.PHONY: help build test lint fmt deploy clean setup
.PHONY: build-contract build-cli build-frontend
.PHONY: test-contract test-snapshots-update test-frontend
.PHONY: lint-contract lint-frontend typecheck-frontend
help:
@echo "Trellis Protocol — Build Targets"
@echo ""
@grep -E '^[a-z-]+:' $(MAKEFILE_LIST) | sort | while IFS=: read -r target _; do \
desc=$$(grep -A1 "^$$target:" $(MAKEFILE_LIST) | tail -1 | sed 's/# //'); \
printf " %-20s %s\n" "$$target" "$$desc"; \
done
# ── Build ──────────────────────────────────────────────────────────────────
build: build-contract build-cli build-frontend
build-contract:
cargo build --frozen --manifest-path contracts/trellis_core/Cargo.toml --target wasm32-unknown-unknown --release
build-cli:
cargo build --frozen --manifest-path cli/trellis_cli/Cargo.toml --release
build-frontend:
# npm ci (not npm install) installs exact versions from package-lock.json
# for reproducible builds.
cd frontend && npm ci && npm run build
# ── Test ───────────────────────────────────────────────────────────────────
test: test-contract test-frontend
test-contract:
cargo test --frozen --manifest-path contracts/trellis_core/Cargo.toml
test-snapshots-update:
SOROBAN_TEST_SNAPSHOT_FILE=overwrite cargo test --manifest-path contracts/trellis_core/Cargo.toml
@echo "Snapshots regenerated. Review the diff with: git diff contracts/trellis_core/test_snapshots/"
test-frontend:
cd frontend && npm ci && npm test
# ── Lint ───────────────────────────────────────────────────────────────────
lint: lint-contract lint-frontend
lint-contract:
cargo clippy --frozen --manifest-path contracts/trellis_core/Cargo.toml -- -D warnings
cargo clippy --frozen --manifest-path cli/trellis_cli/Cargo.toml -- -D warnings
lint-frontend:
cd frontend && npm ci && npm run lint
fmt:
cargo fmt --all
typecheck-frontend:
cd frontend && npm run typecheck
# ── Deploy ─────────────────────────────────────────────────────────────────
deploy:
@echo "=== Deploying Trellis to Stellar Testnet ==="
@echo "Ensure you have:"
@echo " 1. A funded testnet identity: stellar keys fund <name> --network testnet"
@echo " 2. The contract WASM built: make build-contract"
@echo ""
@echo "Running: stellar contract deploy ..."
stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/trellis_core.wasm \
--source trellis-deployer \
--network testnet
# ── Clean ──────────────────────────────────────────────────────────────────
clean:
cargo clean
cd frontend && rm -rf dist node_modules
rm -rf target
# ── Setup ──────────────────────────────────────────────────────────────────
setup:
rustup target add wasm32-unknown-unknown
cd frontend && npm ci