Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
210 lines (160 loc) · 7.73 KB
/
Copy pathMakefile
File metadata and controls
210 lines (160 loc) · 7.73 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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
default: check
build:
cargo xtask build
build-wasm:
cargo xtask build --target wasm32-unknown-unknown
# This adds a make command to install a target, e.g. `make install-target-wasm32-unknown-unknown`
install-target-%:
$(CLANG_PREFIX) rustup target add $*
build-target-%: install-target-%
cargo xtask build --target $*
build-release:
cargo xtask build --release
check: fmt-check clippy-check wasm-js-lint test flutter-check
clippy-fix: cargo-clippy-fix wasm-clippy-fix
cargo-clippy-fix:
cargo xtask clippy --fix
wasm-clippy-fix:
cargo xtask wasm-clippy --fix
clippy-check: cargo-clippy-check wasm-clippy-check
cargo-clippy-check:
cargo xtask clippy
wasm-clippy-check:
cargo xtask wasm-clippy
fix: fmt-fix clippy-fix
fmt-fix:
cargo xtask fmt
fmt-check:
cargo xtask fmt --check
test: cargo-test wasm-test
cargo-test:
cargo xtask test
wasm-test: wasm-test-browser wasm-test-node wasm-test-mysql-timezone wasm-test-js-ssl-mode
wasm-test-browser:
cargo xtask wasm-test
wasm-test-node:
cargo xtask wasm-test --node
# Regression test for the JS mysql-{token,tree}-store TZ-handling bug. Runs
# the spent-marker / spent-leaf scenarios under several host TZs (positive
# and negative offsets) so the bug surfaces on any CI runner regardless of
# system clock. Depends on wasm-test-node for the upstream `npm install` of
# mysql-storage / mysql-{token,tree}-store deps that these tests reuse.
wasm-test-mysql-timezone: wasm-test-node
cd crates/breez-sdk/wasm/js/mysql-token-store && npm test
cd crates/breez-sdk/wasm/js/mysql-tree-store && npm test
# Unit tests for the JS storage TLS translation: `ssl-mode` in createMysqlPool
# and `sslmode` in createPostgresPool. Pure unit tests: they need `npm install`
# in the package dirs, but no database.
wasm-test-js-ssl-mode:
cd crates/breez-sdk/wasm/js/mysql-storage && npm install && npm test
cd crates/breez-sdk/wasm/js/postgres-storage && npm install && npm test
wasm-js-lint:
cd crates/breez-sdk/wasm/js && npm ci && ESLINT_USE_FLAT_CONFIG=false npm run lint
flutter-check:
cargo xtask flutter-check
itest:
cargo xtask itest
spark-itest-pg:
USE_POSTGRES_BACKEND=true cargo xtask itest
spark-itest-mysql:
USE_MYSQL_BACKEND=true cargo xtask itest
# Build the images a local cluster runs, skipping those already present.
itest-images:
cargo xtask itest-images
# Rebuild the state snapshot local operator clusters restore from
# (crates/spark-itest/state-snapshot/).
capture-itest-state:
cargo xtask capture-itest-state
# Cross-version signer compatibility tests: links the previous SDK release
# (git tag pinned in spark-compat-itest's Cargo.toml) next to the current
# build and continues flows across versions. Requires Docker.
compat-itest:
cargo xtask compat-itest
# Behavioral scenarios driven through the Rust CLI REPL against the remote
# regtest network (see crates/breez-sdk/cli/tests/scenarios/README.md).
# Soft-skips without FAUCET_USERNAME/FAUCET_PASSWORD; lnurl scenarios also
# need Docker. Two threads to bound faucet pressure.
cli-itest:
cargo xtask test --package cli --test scenarios -- --test-threads=2
# WASM binding e2e tests: the shared CLI scenarios driven through the wasm
# CLI port, plus an npm-API smoke suite. Builds the local npm package first.
# Same gating as cli-itest. Requires Node 22. Test files run one at a time:
# parallel files would race on the faucet and the lnurl image build.
wasm-itest:
$(MAKE) -C crates/breez-sdk/bindings/examples/cli/langs/wasm setup
cd packages/wasm/itest && npm install && npm test
# Swift binding e2e tests: the shared CLI scenarios driven through the swift
# CLI port (macOS only). Same gating as cli-itest; the lnurl scenario skips
# where docker is unavailable (macOS CI runners).
swift-itest:
$(MAKE) -C crates/breez-sdk/bindings/examples/cli/langs/swift setup build
SCENARIO_CLI="$(CURDIR)/crates/breez-sdk/bindings/examples/cli/langs/swift/.build/debug/breez-cli" \
cargo xtask test --package cli --test scenarios -- --test-threads=2
# Kotlin binding e2e tests: the shared CLI scenarios driven through the
# kotlin-multiplatform CLI port's JVM target, which shares the generated
# uniffi binding surface with Android. Same gating as cli-itest.
kotlin-itest:
$(MAKE) -C crates/breez-sdk/bindings/examples/cli/langs/kotlin-multiplatform setup
cd crates/breez-sdk/bindings/examples/cli/langs/kotlin-multiplatform && ./gradlew jar -q --console=plain
SCENARIO_CLI="java -jar $(CURDIR)/crates/breez-sdk/bindings/examples/cli/langs/kotlin-multiplatform/build/libs/breez-sdk-spark-cli-1.0-SNAPSHOT.jar" \
cargo xtask test --package cli --test scenarios -- --test-threads=2
breez-itest:
cargo xtask test --package breez-sdk-itest -- --test-threads=8
breez-itest-pg-tree-store:
USE_POSTGRES_TREE_STORE=true cargo xtask test --package breez-sdk-itest -- --test-threads=8
breez-itest-mysql-tree-store:
USE_MYSQL_TREE_STORE=true cargo xtask test --package breez-sdk-itest -- --test-threads=8
# Mainnet conversion tests (token_conversion + stable_balance). Selects only
# those test binaries and runs single-threaded, since they share the one
# env-funded test wallet. They skip automatically unless MAINNET_TEST_MNEMONIC
# and BREEZ_API_KEY are set, so this is a no-op without those secrets.
breez-itest-mainnet:
cargo xtask test --package breez-sdk-itest --test mainnet_token_conversion -- --test-threads=1
cargo xtask test --package breez-sdk-itest --test mainnet_stable_balance -- --test-threads=1
cargo xtask test --package breez-sdk-itest --test mainnet_server_mode_conversion -- --test-threads=1
cargo xtask test --package breez-sdk-itest --test mainnet_cross_chain -- --test-threads=1
# Mainnet teardown: drains the deterministic Bob wallet back to the test account,
# converting tokens to sats. Run last (e.g. as an always() CI step) so funds are
# recovered even when the conversion tests fail. No-op without the secrets above.
breez-itest-mainnet-teardown:
cargo xtask test --package breez-sdk-itest --test mainnet_teardown -- --test-threads=1
claude-check:
make fmt-check clippy-check cargo-test
open-core-rustdocs:
cd crates/breez-sdk/core && cargo doc --no-deps --open
update-lockfiles:
./scripts/update-lock-files.sh
# A Spark regtest environment of your own, in docker (regtest/local/).
# `docker compose -f regtest/local/docker-compose.yml up` runs it in the
# foreground; these targets run it in the background.
LOCAL_ENV = docker compose -f regtest/local/docker-compose.yml
# `up` returns only once the operators hold their keyshares, so the service
# that reports readiness starts first and its progress shows while `up` waits.
# Its exit code is this target's. `--wait` is not used: it fails when any
# container exits, which that service does.
local-env-up:
$(LOCAL_ENV) up --no-start --build --scale ready=0
@reporter=$$($(LOCAL_ENV) --progress quiet run --detach --no-deps \
-e SPARK_CONFIG_PATH=$(CURDIR)/regtest/local/data/spark-config.json ready) || exit 1; \
trap 'docker rm --force $$reporter >/dev/null 2>&1' EXIT INT TERM; \
docker logs --follow $$reporter & \
$(LOCAL_ENV) --progress quiet up --detach --scale ready=0 || exit 1; \
code=$$(docker wait $$reporter); wait; exit $$code
local-env-down:
$(LOCAL_ENV) down
# Deletes the chain and every wallet's funds with it.
local-env-reset:
$(LOCAL_ENV) down --volumes
$(LOCAL_ENV) run --rm --no-deps -T --entrypoint sh init -c 'rm -rf /out/*'
local-env-logs:
$(LOCAL_ENV) logs --follow
# make local-env-fund ADDRESS=bcrt1... AMOUNT_SATS=100000
local-env-fund:
$(LOCAL_ENV) exec -T miner /scripts/fund.sh $(ADDRESS) $(AMOUNT_SATS)
# make local-env-mine BLOCKS=6
local-env-mine:
$(LOCAL_ENV) exec -T miner /scripts/mine.sh $(BLOCKS)
# make local-env-block-interval SECONDS=0 leaves mining to local-env-mine, until
# the environment restarts.
local-env-block-interval:
$(LOCAL_ENV) exec -T miner /scripts/block-interval.sh $(SECONDS)