-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathMakefile
155 lines (114 loc) · 6.5 KB
/
Makefile
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
.DEFAULT_GOAL := help
.PHONY: help
help: ## Show description of all commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# --- Variables -----------------------------------------------------------------------------------
FEATURES_WEB_CLIENT=--features "testing"
FEATURES_CLIENT=--features "testing, concurrent"
FEATURES_CLI=--features "testing, concurrent"
NODE_FEATURES_TESTING=--features "testing"
WARNINGS=RUSTDOCFLAGS="-D warnings"
NODE_BRANCH="main"
PROVER_BRANCH="main"
PROVER_FEATURES_TESTING=--features "testing"
PROVER_PORT=50051
# --- Linting -------------------------------------------------------------------------------------
.PHONY: clippy
clippy: ## Run Clippy with configs
cargo clippy --workspace --exclude miden-client-web --all-targets $(FEATURES_CLI) -- -D warnings
.PHONY: clippy-wasm
clippy-wasm: ## Run Clippy for the miden-client-web package
cargo clippy --package miden-client-web --target wasm32-unknown-unknown --all-targets $(FEATURES_WEB_CLIENT) -- -D warnings
.PHONY: fix
fix: ## Run Fix with configs
cargo +nightly fix --workspace --exclude miden-client-web --allow-staged --allow-dirty --all-targets $(FEATURES_CLI)
.PHONY: fix-wasm
fix-wasm: ## Run Fix for the miden-client-web package
cargo +nightly fix --package miden-client-web --target wasm32-unknown-unknown --allow-staged --allow-dirty --all-targets $(FEATURES_WEB_CLIENT)
.PHONY: format
format: ## Run format using nightly toolchain
cargo +nightly fmt --all && yarn prettier . --write
.PHONY: format-check
format-check: ## Run format using nightly toolchain but only in check mode
cargo +nightly fmt --all --check && yarn prettier . --check
.PHONY: lint
lint: format fix clippy fix-wasm clippy-wasm ## Run all linting tasks at once (clippy, fixing, formatting)
# --- Documentation site --------------------------------------------------------------------------
.PHONY: doc-deps
doc-deps: ## Install dependencies to build and serve documentation site
pip3 install -r scripts/docs_requirements.txt
.PHONY: doc-build
doc-build: doc-deps ## Build documentation site
mkdocs build
.PHONY: doc-serve
doc-serve: doc-deps ## Serve documentation site
mkdocs serve
# --- Rust documentation --------------------------------------------------------------------------
.PHONY: doc
doc: ## Generate & check rust documentation. You'll need `jq` in order for this to run.
@cd crates/rust-client && \
FEATURES=$$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "miden-client") | .features | keys[] | select(. != "web-tonic" and . != "idxdb")' | tr '\n' ',') && \
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --features "$$FEATURES" --keep-going --release
# --- Testing -------------------------------------------------------------------------------------
.PHONY: test
test: ## Run tests
cargo nextest run --workspace --exclude miden-client-web --release --lib $(FEATURES_CLIENT)
.PHONY: test-deps
test-deps: ## Install dependencies for tests
cargo install cargo-nextest
# --- Integration testing -------------------------------------------------------------------------
.PHONY: integration-test
integration-test: ## Run integration tests
cargo nextest run --workspace --exclude miden-client-web --release --test=integration $(FEATURES_CLI) --no-default-features
.PHONY: integration-test-web-client
integration-test-web-client: ## Run integration tests for the web client
cd ./crates/web-client && npm run test:clean
.PHONY: integration-test-remote-prover-web-client
integration-test-remote-prover-web-client: ## Run integration tests for the web client with remote prover
cd ./crates/web-client && npm run test:remote_prover
.PHONY: integration-test-full
integration-test-full: ## Run the integration test binary with ignored tests included
cargo nextest run --workspace --exclude miden-client-web --release --test=integration $(FEATURES_CLI)
cargo nextest run --workspace --exclude miden-client-web --release --test=integration $(FEATURES_CLI) --run-ignored ignored-only -- test_import_genesis_accounts_can_be_used_for_transactions
.PHONY: kill-node
kill-node: ## Kill node process
pkill miden-node || echo 'process not running'
.PHONY: clean-node
clean-node: ## Clean node directory
rm -rf miden-node
.PHONY: node
node: ## Setup node directory
if [ -d miden-node ]; then cd miden-node ; else git clone https://github.com/0xPolygonMiden/miden-node.git && cd miden-node; fi
cd miden-node && git checkout $(NODE_BRANCH) && git pull origin $(NODE_BRANCH)
cd miden-node && rm -rf miden-store.sqlite3*
cd miden-node && cargo update && cargo run --bin miden-node $(NODE_FEATURES_TESTING) -- make-genesis --inputs-path ../tests/config/genesis.toml --force
.PHONY: start-node
start-node: ## Run node. This requires the node repo to be present at `miden-node`
cd miden-node && cargo run --bin miden-node $(NODE_FEATURES_TESTING) -- start --config ../tests/config/miden-node.toml node
.PHONY: clean-prover
clean-prover: ## Uninstall prover
cargo uninstall miden-tx-prover || echo 'prover not installed'
.PHONY: prover
prover: ## Download and install the prover binary
cargo install --git https://github.com/0xPolygonMiden/miden-base $(PROVER_FEATURES_TESTING) miden-tx-prover --branch $(PROVER_BRANCH) --locked
.PHONY: start-prover
start-prover: ## Run prover. This requires the base repo to be present at `miden-base`
RUST_LOG=info miden-tx-prover start-worker -p $(PROVER_PORT)
.PHONY: kill-prover
kill-prover: ## Kill prover process
pkill miden-tx-prover || echo 'process not running'
# --- Installing ----------------------------------------------------------------------------------
install: ## Install the CLI binary
cargo install $(FEATURES_CLI) --path bin/miden-cli
# --- Building ------------------------------------------------------------------------------------
build: ## Build the CLI binary and client library in release mode
cargo build --workspace --exclude miden-client-web --release $(FEATURES_CLI)
build-wasm: ## Build the client library for wasm32
cargo build --package miden-client-web --target wasm32-unknown-unknown $(FEATURES_WEB_CLIENT)
# --- Check ---------------------------------------------------------------------------------------
.PHONY: check
check: ## Build the CLI binary and client library in release mode
cargo check --workspace --exclude miden-client-web --release $(FEATURES_CLI)
.PHONY: check-wasm
check-wasm: ## Build the client library for wasm32
cargo check --package miden-client-web --target wasm32-unknown-unknown $(FEATURES_WEB_CLIENT)