Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (64 loc) · 3.51 KB
/
Copy pathMakefile
File metadata and controls
86 lines (64 loc) · 3.51 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
.PHONY: help setup-tools fmt fmt-check lint check-generated-html-js build-playground test test-rust test-html-viewer test-update test-coverage test-wasm test-playground test-large test-ci bench build-frontend build deny-check
.DEFAULT_GOAL := help
WASM_TARGET := wasm32-unknown-unknown
# Size budget for the optimized playground WASM binary: 4 MiB (4 * 1024 * 1024 bytes).
WASM_SIZE_LIMIT := 4194304
help: ## Show available make targets.
@printf 'Usage: make <target>\n\n'
@awk 'BEGIN {FS = ":.*## "}/^[a-zA-Z0-9_.-]+:.*## / {printf " %-14s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
setup-tools: ## Install required toolchains and development tools.
rustup component add llvm-tools-preview
rustup target add $(WASM_TARGET)
cargo install cargo-llvm-cov cargo-deny --locked
cargo install wasm-pack --locked
fmt: ## Format all code.
cargo fmt --all
cd crates/relune-render-html && pnpm fmt
cd playground && pnpm fmt
fmt-check: ## Check formatting without modifying files.
cargo fmt --all -- --check
cd crates/relune-render-html && pnpm fmt:check
cd playground && pnpm fmt:check
lint: ## Run Rust linting plus frontend lint and type checks.
cargo clippy --workspace --all-targets -- -D warnings
cargo clippy -p relune-wasm --target $(WASM_TARGET) -- -D warnings
cd crates/relune-render-html && pnpm lint && pnpm typecheck
cd playground && pnpm lint && pnpm typecheck
$(MAKE) check-generated-html-js
check-generated-html-js: ## Verify committed HTML viewer bundles match TypeScript sources.
$(MAKE) build-frontend
git diff --exit-code -- crates/relune-render-html/src/js
test -z "$$(git ls-files --others --exclude-standard -- crates/relune-render-html/src/js)"
build-playground: ## Build the public WASM playground.
cd crates/relune-wasm && wasm-pack build --target web --profile wasm-release --out-dir ../../playground/dist/pkg
@size=$$(wc -c < playground/dist/pkg/relune_wasm_bg.wasm | tr -d ' '); \
if [ "$$size" -gt $(WASM_SIZE_LIMIT) ]; then \
echo "relune_wasm_bg.wasm is $$size bytes, over the $(WASM_SIZE_LIMIT) byte limit" >&2; exit 1; \
fi
cd playground && pnpm build
test: test-rust test-html-viewer test-wasm test-playground ## Run local Rust, HTML viewer, wasm, and playground checks.
test-rust: ## Run workspace Rust tests.
cargo test --workspace
test-html-viewer: ## Run HTML viewer TypeScript tests.
cd crates/relune-render-html && pnpm test
test-update: ## Update insta snapshots and rerun workspace Rust tests.
INSTA_UPDATE=always cargo test --workspace
test-coverage: ## Run workspace Rust tests with coverage and write lcov.info.
cargo llvm-cov test --workspace --lcov --output-path lcov.info
test-wasm: ## Run relune-wasm tests in Node.js.
cd crates/relune-wasm && wasm-pack test --node
test-playground: ## Run playground TypeScript tests and build the WASM playground as a smoke test.
cd playground && pnpm test
$(MAKE) build-playground
test-large: ## Run large-schema layout regression tests in release mode.
cargo test --release -p relune-layout --test large_schemas -- --ignored
test-ci: test-coverage test-wasm ## Run CI coverage and wasm tests.
bench: ## Time layouts of generated 500-2000 table schemas.
cargo bench -p relune-layout --bench layout_scale
build-frontend: ## Rebuild committed HTML viewer bundles from TypeScript.
cd crates/relune-render-html && pnpm build
build: ## Build Rust and wasm artifacts using committed HTML viewer bundles.
cargo build
cargo build -p relune-wasm --target $(WASM_TARGET)
deny-check: ## Run cargo-deny across advisories, bans, licenses, and sources.
cargo deny check all