Repository navigation
Expand file tree
/
Copy pathMakefile.toml
More file actions
296 lines (258 loc) · 8.11 KB
/
Copy pathMakefile.toml
File metadata and controls
296 lines (258 loc) · 8.11 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
[config]
default_to_workspace = false
[tasks.help]
description = "Show available tasks"
script = '''
echo "MQDB Makefile Commands"
echo "======================"
echo ""
echo "Development:"
echo " cargo make format Format all code"
echo " cargo make format-check Check formatting (CI)"
echo " cargo make check Quick compilation check"
echo " cargo make clippy Lint with pedantic warnings"
echo " cargo make dev Format + clippy + test"
echo " cargo make watch Watch mode for check"
echo ""
echo "Building:"
echo " cargo make build Build all targets (debug)"
echo " cargo make build-release Build release binary"
echo " cargo make build-dist Build size-optimized dist binary"
echo " cargo make install Install mqdb binary from local codebase"
echo " cargo make build-profiling Build with profiling profile"
echo " cargo make wasm-build Build WASM package (pkg/)"
echo ""
echo "Testing:"
echo " cargo make test Run all tests"
echo " cargo make test-verbose Run tests with output"
echo " cargo make ci CI pipeline (format-check + clippy + test)"
echo " cargo make test-e2e Run E2E cluster tests"
echo " cargo make ci-full CI + E2E tests"
echo ""
echo "WASM:"
echo " cargo make wasm-build Build WASM package (pkg/)"
echo " cargo make wasm-test Run WASM tests (Node.js)"
echo " cargo make ci-wasm WASM CI (build + test)"
echo " cargo make wasm-publish Publish mqdb-wasm to npm (requires auth)"
echo ""
echo "Benchmarking:"
echo " cargo make bench-pubsub Run pub/sub benchmark"
echo " cargo make bench-db Run DB benchmark"
echo ""
echo "Profiling:"
echo " cargo make profile-pubsub Profile pub/sub with samply"
echo " cargo make profile-db Profile DB with samply"
echo ""
echo "Cleanup:"
echo " cargo make clean Clean build artifacts"
'''
[tasks.format]
description = "Format all crates"
dependencies = ["format-native", "format-wasm"]
[tasks.format-native]
description = "Format native crate"
command = "cargo"
args = ["fmt", "--all"]
[tasks.format-wasm]
description = "Format WASM crate"
command = "cargo"
args = ["fmt", "--manifest-path", "crates/mqdb-wasm/Cargo.toml"]
[tasks.format-check]
description = "Check formatting (CI)"
dependencies = ["format-check-native", "format-check-wasm"]
[tasks.format-check-native]
description = "Check native formatting"
command = "cargo"
args = ["fmt", "--all", "--check"]
[tasks.format-check-wasm]
description = "Check WASM formatting"
command = "cargo"
args = ["fmt", "--manifest-path", "crates/mqdb-wasm/Cargo.toml", "--check"]
[tasks.check]
description = "Quick compilation check"
dependencies = ["check-native", "check-wasm"]
[tasks.check-native]
description = "Quick compilation check (native)"
command = "cargo"
args = ["check", "--all-targets", "--all-features"]
[tasks.check-wasm]
description = "Quick compilation check (WASM)"
command = "cargo"
args = [
"check",
"--target",
"wasm32-unknown-unknown",
"--manifest-path",
"crates/mqdb-wasm/Cargo.toml",
]
[tasks.build]
description = "Build all targets (debug)"
command = "cargo"
args = ["build", "--all-targets"]
[tasks.build-release]
description = "Build release binary"
command = "cargo"
args = ["build", "--release"]
[tasks.install]
description = "Install mqdb binary from local codebase"
command = "cargo"
args = ["install", "--path", "crates/mqdb-cli"]
[tasks.clippy]
description = "Lint all crates with pedantic warnings"
dependencies = ["clippy-native", "clippy-no-default", "clippy-wasm"]
[tasks.clippy-native]
description = "Lint native crate (matches CI: all features, warnings denied)"
command = "cargo"
args = [
"clippy",
"--all-targets",
"--all-features",
"--",
"-D", "warnings",
]
[tasks.clippy-no-default]
description = "Lint workspace with no default features (catches feature-gating regressions)"
command = "cargo"
args = [
"clippy",
"--workspace",
"--no-default-features",
"--all-targets",
"--",
"-D", "warnings",
]
[tasks.clippy-wasm]
description = "Lint WASM crate"
command = "cargo"
args = [
"clippy",
"--target", "wasm32-unknown-unknown",
"--manifest-path", "crates/mqdb-wasm/Cargo.toml",
"--",
"-W", "clippy::pedantic",
]
[tasks.test]
description = "Run all tests"
command = "cargo"
args = ["test", "--all-features"]
[tasks.test-verbose]
description = "Run tests with output"
command = "cargo"
args = ["test", "--all-features", "--", "--nocapture"]
[tasks.clean]
description = "Clean build artifacts"
command = "cargo"
args = ["clean"]
[tasks.dev]
description = "Format + clippy + test"
dependencies = ["format", "clippy", "test"]
[tasks.ci]
description = "CI pipeline (format-check + clippy + test)"
dependencies = ["format-check", "clippy", "test"]
[tasks.watch]
description = "Watch mode for check"
command = "cargo"
args = ["watch", "-x", "check"]
[tasks.bench-pubsub]
description = "Run pub/sub benchmark"
command = "cargo"
args = ["run", "--release", "--", "dev", "bench", "pubsub"]
[tasks.bench-db]
description = "Run DB benchmark"
command = "cargo"
args = ["run", "--release", "--", "dev", "bench", "db"]
[tasks.profile-pubsub]
description = "Profile pub/sub with samply"
command = "cargo"
args = ["run", "--release", "--", "dev", "profile", "pubsub"]
[tasks.profile-db]
description = "Profile DB with samply"
command = "cargo"
args = ["run", "--release", "--", "dev", "profile", "db"]
[tasks.build-dist]
description = "Build size-optimized dist binary (lto + strip + abort + opt-z)"
command = "cargo"
args = ["build", "--profile=dist"]
[tasks.build-profiling]
description = "Build with profiling profile"
command = "cargo"
args = ["build", "--profile=profiling"]
[tasks.wasm-build]
description = "Build WASM package (pkg/)"
dependencies = ["wasm-compile", "wasm-bindgen", "wasm-opt"]
[tasks.wasm-compile]
description = "Compile WASM binary"
command = "cargo"
args = ["build", "--target", "wasm32-unknown-unknown", "--release", "--manifest-path", "crates/mqdb-wasm/Cargo.toml"]
[tasks.wasm-bindgen]
description = "Generate JS bindings"
command = "wasm-bindgen"
args = ["--target", "web", "--out-dir", "crates/mqdb-wasm/pkg", "crates/mqdb-wasm/target/wasm32-unknown-unknown/release/mqdb_wasm.wasm"]
[tasks.wasm-opt]
description = "Optimize WASM binary with wasm-opt (optional, skipped if not installed)"
script = '''
if command -v wasm-opt > /dev/null 2>&1; then
echo "Running wasm-opt -O4 on mqdb_wasm_bg.wasm..."
wasm-opt -O4 --enable-bulk-memory --enable-nontrapping-float-to-int -o crates/mqdb-wasm/pkg/mqdb_wasm_bg.wasm crates/mqdb-wasm/pkg/mqdb_wasm_bg.wasm
echo "wasm-opt complete"
else
echo "wasm-opt not found, skipping (install binaryen for smaller WASM binaries)"
fi
'''
[tasks.test-e2e]
description = "Run E2E cluster tests (requires release build)"
dependencies = ["build-release"]
script = '''
./target/release/mqdb dev start-cluster --nodes 3 --clean
sleep 3
./target/release/mqdb dev test --all
RESULT=$?
./target/release/mqdb dev kill
exit $RESULT
'''
[tasks.ci-full]
description = "Full CI: format-check + clippy + test + E2E"
dependencies = ["ci", "test-e2e"]
[tasks.wasm-test]
description = "Run WASM tests in Node.js"
script = '''
cd crates/mqdb-wasm
wasm-pack test --node
'''
[tasks.ci-wasm]
description = "WASM CI: build + test"
dependencies = ["wasm-build", "wasm-test"]
[tasks.wasm-publish]
description = "Publish mqdb-wasm to npm (requires npm auth)"
dependencies = ["wasm-build"]
script = '''
set -e
VERSION=$(grep '^version' crates/mqdb-wasm/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
if npm view "mqdb-wasm@$VERSION" version > /dev/null 2>&1; then
echo "mqdb-wasm@$VERSION already published to npm; skipping"
exit 0
fi
cat > crates/mqdb-wasm/pkg/package.json <<PKGJSON
{
"name": "mqdb-wasm",
"version": "$VERSION",
"description": "WASM client library for MQDB reactive database",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/LabOverWire/MQDB"
},
"files": [
"mqdb_wasm_bg.wasm",
"mqdb_wasm.js",
"mqdb_wasm.d.ts"
],
"main": "mqdb_wasm.js",
"types": "mqdb_wasm.d.ts"
}
PKGJSON
cp LICENSE-APACHE crates/mqdb-wasm/pkg/LICENSE
cd crates/mqdb-wasm/pkg
npm pkg fix
npm publish
'''