-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
440 lines (371 loc) · 14.8 KB
/
Taskfile.yaml
File metadata and controls
440 lines (371 loc) · 14.8 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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
---
version: "3"
vars:
CONFORMANCE_VERSION: v1.0.5
CONFORMANCE_BIN: "{{.ROOT_DIR}}/conformance/bin/connectconformance"
SERVER_BIN: "{{.ROOT_DIR}}/target/release/conformance-server"
CLIENT_BIN: "{{.ROOT_DIR}}/target/release/conformance-client"
tasks:
default:
desc: Show available tasks
cmds:
- task --list
# ===========================================================================
# Core development tasks
# ===========================================================================
build:
desc: Build the entire workspace
cmds:
- cargo build --workspace --all-features
build:release:
desc: Build the entire workspace in release mode
cmds:
- cargo build --workspace --all-features --release
check:
desc: Run cargo check on the workspace
cmds:
- cargo check --workspace --all-features
test:
desc: Run all tests
cmds:
- cargo test --workspace --all-features
clippy:
desc: Run clippy lints
cmds:
- cargo clippy --workspace --all-features -- -D warnings
fmt:
desc: Check code formatting
cmds:
- cargo fmt --all -- --check
fmt:fix:
desc: Fix code formatting
cmds:
- cargo fmt --all
doc:
desc: Build documentation
env:
RUSTDOCFLAGS: -Dwarnings
cmds:
- cargo doc --workspace --all-features --no-deps
lint:
desc: Run all lints (clippy + format check)
cmds:
- task: clippy
- task: fmt
ci:
desc: Run all CI checks locally
cmds:
- task: check
- task: clippy
- task: fmt
- task: test
- task: doc
- task: check:minimal
- task: example:multiservice:test
check:minimal:
desc: Check with no default features (minimal build)
cmds:
- cargo check -p connectrpc --no-default-features
- cargo test -p connectrpc --no-default-features
# ===========================================================================
# Code generator
# ===========================================================================
install:
desc: Install protoc-gen-connect-rust to ~/.cargo/bin
cmds:
- cargo install --path connectrpc-codegen
# ===========================================================================
# Local buffa override (for testing combined speculative changes)
# ===========================================================================
buffa:link:
desc: Override crates.io buffa with a sibling ../buffa checkout (local only, gitignored)
cmds:
- cp .cargo/config.toml.example .cargo/config.toml
- cargo update -p buffa -p buffa-types -p buffa-codegen
buffa:unlink:
desc: Remove the local buffa path override and revert to crates.io
cmds:
- rm -f .cargo/config.toml
- cargo update -p buffa -p buffa-types -p buffa-codegen
# ===========================================================================
# Examples
# ===========================================================================
example:eliza:
desc: Run the ELIZA example server
cmds:
- cargo run -p eliza-example
example:eliza:generate:
desc: Regenerate ELIZA example Rust code from protos
dir: "{{.ROOT_DIR}}/examples/eliza"
cmds:
- buf generate
example:multiservice:server:
desc: Run the multi-service server (greet, math, well-known types)
cmds:
- cargo run -p multiservice-example --bin multiservice-server
example:multiservice:client:
desc: Run the multi-service client (requires multiservice-server running)
cmds:
- cargo run -p multiservice-example --bin multiservice-client
example:multiservice:test:
desc: Build, start the server, run the client, and verify all RPCs pass
cmds:
- ./examples/multiservice/test.sh
example:multiservice:generate:
desc: Regenerate multi-service example Rust code from protos
dir: "{{.ROOT_DIR}}/examples/multiservice"
cmds:
- buf generate
# ===========================================================================
# Protocol specifications (fetched locally, gitignored)
# ===========================================================================
specs:fetch:
desc: Fetch protocol spec documents into docs/specs/ (gitignored; for local reference)
vars:
RAW: '-H "Accept: application/vnd.github.raw"'
cmds:
- mkdir -p docs/specs
- gh api {{.RAW}} repos/connectrpc/connectrpc.com/contents/docs/protocol.md > docs/specs/connect-protocol.md
- gh api {{.RAW}} repos/grpc/grpc/contents/doc/PROTOCOL-HTTP2.md > docs/specs/grpc-http2-protocol.md
- gh api {{.RAW}} repos/grpc/grpc/contents/doc/PROTOCOL-WEB.md > docs/specs/grpc-web-protocol.md
# ===========================================================================
# Conformance tests
# ===========================================================================
conformance:download:
desc: Download the conformance test runner
cmds:
- ./conformance/scripts/download-conformance.sh {{.CONFORMANCE_VERSION}}
conformance:build:
desc: Build the conformance server and client binaries
cmds:
- cargo build --release -p connectrpc-conformance
conformance:generate:
desc: Regenerate conformance Rust code from BSR protos
dir: "{{.ROOT_DIR}}/conformance"
cmds:
- BUF_TOKEN="" buf generate
conformance:test:
desc: Run full server conformance tests
deps: [conformance:download, conformance:build]
cmds:
- |
echo "Running server conformance tests..."
echo ""
RUST_LOG=warn "{{.CONFORMANCE_BIN}}" --mode server -- "{{.SERVER_BIN}}"
conformance:test-connect-only:
desc: Run server conformance tests for Connect protocol only
deps: [conformance:download, conformance:build]
cmds:
- |
echo "Running Connect-only server conformance tests..."
echo ""
RUST_LOG=warn "{{.CONFORMANCE_BIN}}" --mode server \
--conf "{{.ROOT_DIR}}/conformance/config/connect-only.yaml" \
-- "{{.SERVER_BIN}}"
conformance:test-connect-tls:
desc: Run server conformance tests for Connect protocol with TLS
deps: [conformance:download, conformance:build]
cmds:
- |
echo "Running Connect+TLS server conformance tests..."
echo ""
RUST_LOG=warn "{{.CONFORMANCE_BIN}}" --mode server \
--conf "{{.ROOT_DIR}}/conformance/config/connect-tls.yaml" \
-- "{{.SERVER_BIN}}"
conformance:test-client-connect-only:
desc: Run client conformance tests for Connect protocol (unary)
deps: [conformance:download, conformance:build]
cmds:
- |
echo "Running Connect-only client conformance tests..."
echo ""
RUST_LOG=warn "{{.CONFORMANCE_BIN}}" --mode client \
--conf "{{.ROOT_DIR}}/conformance/config/client-connect-only.yaml" \
-- "{{.CLIENT_BIN}}"
conformance:test-client-grpc-only:
desc: Run client conformance tests for gRPC protocol
deps: [conformance:download, conformance:build]
cmds:
- |
echo "Running gRPC-only client conformance tests..."
echo ""
RUST_LOG=warn "{{.CONFORMANCE_BIN}}" --mode client \
--conf "{{.ROOT_DIR}}/conformance/config/client-grpc-only.yaml" \
-- "{{.CLIENT_BIN}}"
conformance:test-client-grpc-web-only:
desc: Run client conformance tests for gRPC-Web protocol
deps: [conformance:download, conformance:build]
cmds:
- |
echo "Running gRPC-Web-only client conformance tests..."
echo ""
RUST_LOG=warn "{{.CONFORMANCE_BIN}}" --mode client \
--conf "{{.ROOT_DIR}}/conformance/config/client-grpc-web-only.yaml" \
-- "{{.CLIENT_BIN}}"
conformance:test-grpc-only:
desc: Run server conformance tests for gRPC protocol only
deps: [conformance:download, conformance:build]
cmds:
- |
echo "Running gRPC-only server conformance tests..."
echo ""
RUST_LOG=warn "{{.CONFORMANCE_BIN}}" --mode server \
--conf "{{.ROOT_DIR}}/conformance/config/grpc-only.yaml" \
-- "{{.SERVER_BIN}}"
conformance:test-grpc-web-only:
desc: Run server conformance tests for gRPC-Web protocol only
deps: [conformance:download, conformance:build]
cmds:
- |
echo "Running gRPC-Web-only server conformance tests..."
echo ""
RUST_LOG=warn "{{.CONFORMANCE_BIN}}" --mode server \
--conf "{{.ROOT_DIR}}/conformance/config/grpc-web-only.yaml" \
-- "{{.SERVER_BIN}}"
conformance:test-verbose:
desc: Run server conformance tests with verbose output
deps: [conformance:download, conformance:build]
cmds:
- |
echo "Running server conformance tests (verbose)..."
echo ""
RUST_LOG=debug "{{.CONFORMANCE_BIN}}" --mode server -v -- "{{.SERVER_BIN}}"
conformance:clean:
desc: Remove downloaded conformance runner
cmds:
- rm -rf conformance/bin
# ===========================================================================
# Benchmarks
# ===========================================================================
bench:
desc: Run RPC benchmarks (all protocols, codecs, and payload sizes)
cmds:
- cargo bench -p rpc-bench --bench rpc_bench
bench:quick:
desc: Run RPC benchmarks with reduced sample size for quick iteration
cmds:
- cargo bench -p rpc-bench --bench rpc_bench -- --quick --warm-up-time 1 --measurement-time 3
bench:cross:
desc: Run cross-implementation benchmarks (connectrpc vs tonic vs connect-go)
cmds:
- cargo bench -p rpc-bench --bench cross_impl_bench
bench:fmt:
desc: Run RPC benchmarks and format results as a markdown table
cmds:
- cargo criterion -p rpc-bench --bench rpc_bench --message-format=json 2>/dev/null | python3 benches/rpc/format-results.py
bench:save:
desc: Run RPC benchmarks, save JSON results, and print formatted table
cmds:
- |
cargo criterion -p rpc-bench --bench rpc_bench --message-format=json 2>/dev/null | tee /tmp/bench-results.json | python3 benches/rpc/format-results.py
echo ""
echo "Raw JSON saved to /tmp/bench-results.json"
bench:cross:quick:
desc: Run cross-implementation benchmarks with reduced sample size
cmds:
- cargo bench -p rpc-bench --bench cross_impl_bench -- --quick --warm-up-time 1 --measurement-time 3
bench:fortunes:
desc: Run fortunes benchmark (connectrpc vs tonic vs connect-go)
cmds:
- cargo run --release -p rpc-bench --bin fortune_bench
bench:fortunes:quick:
desc: Run fortunes benchmark with shorter duration
cmds:
- cargo run --release -p rpc-bench --bin fortune_bench -- --quick
bench:fortunes:protocols:
desc: Fortunes benchmark across Connect/gRPC/gRPC-Web on connectrpc
cmds:
- cargo run --release -p rpc-bench --bin fortune_bench -- --protocols
bench:fortunes:protocols:h2:
desc: Protocol comparison with all three on 8 h2 connections (fair framing-only comparison)
cmds:
- cargo run --release -p rpc-bench --bin fortune_bench -- --protocols --multi-conn=8
bench:echo:
desc: Run echo benchmark (connectrpc vs tonic, framework overhead only)
cmds:
- cargo run --release -p rpc-bench --bin echo_bench
bench:echo:quick:
desc: Run echo benchmark with shorter duration
cmds:
- cargo run --release -p rpc-bench --bin echo_bench -- --quick
bench:log:
desc: Run log-ingest benchmark (decode-heavy, buffa-view vs prost-owned)
cmds:
- cargo run --release -p rpc-bench --bin log_bench
bench:log:quick:
desc: Run log-ingest benchmark with shorter duration
cmds:
- cargo run --release -p rpc-bench --bin log_bench -- --quick
bench:generate:
desc: Regenerate benchmark Rust code from protos
dir: "{{.ROOT_DIR}}/benches/rpc"
cmds:
- buf generate
bench:charts:
desc: Regenerate README performance charts (edit BENCHMARKS dict first)
cmds:
- python3 benches/charts/generate.py
generate:all:
desc: Regenerate all checked-in Rust code from protos
cmds:
- cargo build --release -p connectrpc-codegen --bin protoc-gen-connect-rust
- cargo build --release --manifest-path ../buffa/Cargo.toml -p protoc-gen-buffa -p protoc-gen-buffa-packaging
- task: example:eliza:generate
- task: example:multiservice:generate
- task: conformance:generate
- task: bench:generate
# ===========================================================================
# Profiling
# ===========================================================================
profile:connectrpc:
desc: Profile connectrpc fortune server (CPU + heap)
vars:
DURATION: '{{.DURATION | default "300"}}'
CONCURRENCY: '{{.CONCURRENCY | default "64"}}'
cmds:
- ./benches/profile_server.sh connectrpc {{.DURATION}} {{.CONCURRENCY}}
profile:tonic:
desc: Profile tonic fortune server (CPU + heap)
vars:
DURATION: '{{.DURATION | default "300"}}'
CONCURRENCY: '{{.CONCURRENCY | default "64"}}'
cmds:
- ./benches/profile_server.sh tonic {{.DURATION}} {{.CONCURRENCY}}
profile:compare:
desc: Profile both servers and print comparative summary
vars:
DURATION: '{{.DURATION | default "300"}}'
CONCURRENCY: '{{.CONCURRENCY | default "64"}}'
cmds:
- ./benches/profile_server.sh connectrpc {{.DURATION}} {{.CONCURRENCY}}
- ./benches/profile_server.sh tonic {{.DURATION}} {{.CONCURRENCY}}
- echo "Results in /tmp/connectrpc-profile/"
profile:echo:
desc: Profile echo server (framework overhead, multi-conn to reduce h2 noise)
vars:
DURATION: '{{.DURATION | default "30"}}'
CONCURRENCY: '{{.CONCURRENCY | default "64"}}'
N_CONNS: '{{.N_CONNS | default "8"}}'
cmds:
- ./benches/profile_server.sh echo-connectrpc {{.DURATION}} {{.CONCURRENCY}} {{.N_CONNS}}
- ./benches/profile_server.sh echo-tonic {{.DURATION}} {{.CONCURRENCY}} {{.N_CONNS}}
- echo "Results in /tmp/connectrpc-profile/echo-{{'{'}}connectrpc,tonic{{'}'}}/"
profile:log:
desc: Profile log-ingest server (decode-heavy, buffa-view vs prost-owned)
vars:
DURATION: '{{.DURATION | default "30"}}'
CONCURRENCY: '{{.CONCURRENCY | default "64"}}'
N_CONNS: '{{.N_CONNS | default "8"}}'
RECORDS: '{{.RECORDS | default "50"}}'
cmds:
- ./benches/profile_server.sh log-connectrpc {{.DURATION}} {{.CONCURRENCY}} {{.N_CONNS}} {{.RECORDS}}
- ./benches/profile_server.sh log-tonic {{.DURATION}} {{.CONCURRENCY}} {{.N_CONNS}} {{.RECORDS}}
- echo "Results in /tmp/connectrpc-profile/log-{{'{'}}connectrpc,tonic{{'}'}}/"
# ===========================================================================
# Cleanup
# ===========================================================================
clean:
desc: Remove all build artifacts
cmds:
- cargo clean
- task: conformance:clean