forked from Lilly-Protocol/lily-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (69 loc) · 2.42 KB
/
Copy pathMakefile
File metadata and controls
89 lines (69 loc) · 2.42 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
SHELL := /bin/sh
CONTRACT_PACKAGES := protocol identity wallet payments
WASM_TARGET := wasm32v1-none
ARTIFACTS_DIR := dist
.PHONY: fmt fmt-check lint check test doc build build-wasm artifacts ci clean help
help:
@printf "%s\n" \
"make fmt - format the workspace" \
"make fmt-check - verify formatting" \
"make lint - run clippy with warnings denied" \
"make docs - verify rustdoc builds with warnings denied" \
"make check - cargo check across the workspace" \
"make test - run all unit and integration-style tests" \
"make doc - generate documentation with warnings denied" \
"make build - build the workspace" \
"make build-wasm - compile all contract packages to Wasm (with size regression gate)" \
"make wasm-size - compile and check wasm sizes against the committed baseline" \
"make artifacts - copy optimized Wasm artifacts into dist/" \
"make ci - local CI bundle (fmt-check, lint, test, doc)" \
"make clean - remove build outputs"
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all --check
lint:
cargo clippy --locked --workspace --all-targets -- -D warnings
docs:
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps
check:
cargo check --locked --workspace
test:
cargo test --locked --workspace
doc:
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps
test-locked:
cargo test --workspace --locked
audit:
cargo audit
docs:
cargo doc --workspace --no-deps
size-report: build-wasm
@echo "=== Wasm Artifact Size Report ==="
@for pkg in $(CONTRACT_PACKAGES); do \
if [ -f target/$(WASM_TARGET)/release/$$pkg.wasm ]; then \
ls -lh target/$(WASM_TARGET)/release/$$pkg.wasm | awk '{print $$9, ":", $$5}'; \
fi \
done
build:
cargo build --locked --workspace
build-wasm:
@test -d "$$(rustc --print sysroot)/lib/rustlib/$(WASM_TARGET)/lib" || { \
echo "$(WASM_TARGET) target stdlib is not installed. Run: rustup target add $(WASM_TARGET)"; \
exit 1; \
}
@for pkg in $(CONTRACT_PACKAGES); do \
cargo build --locked --target $(WASM_TARGET) --profile release --package $$pkg; \
done
@sh scripts/check-wasm-size.sh
wasm-size: build-wasm
@echo "wasm size regression gate: PASS"
artifacts: build-wasm
@mkdir -p $(ARTIFACTS_DIR)
@for pkg in $(CONTRACT_PACKAGES); do \
cp target/$(WASM_TARGET)/release/$$pkg.wasm $(ARTIFACTS_DIR)/$$pkg.wasm; \
done
@./scripts/generate-manifest.sh
ci: fmt-check lint test doc
clean:
rm -rf target $(ARTIFACTS_DIR)