forked from risingwavelabs/risingwave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
888 lines (742 loc) · 23.3 KB
/
Makefile.toml
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
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
extend = [
{ path = "src/risedevtool/grafana.toml" },
{ path = "src/risedevtool/prometheus.toml" },
{ path = "src/risedevtool/minio.toml" },
{ path = "src/risedevtool/etcd.toml" },
{ path = "src/risedevtool/jaeger.toml" },
{ path = "src/risedevtool/kafka.toml" },
{ path = "src/risedevtool/gcloud-pubsub.toml"},
{ path = "src/risedevtool/redis.toml" },
{ path = "src/risedevtool/connector.toml" },
{ path = "src/risedevtool/risedev-components.toml" },
{ path = "src/frontend/planner_test/planner_test.toml" },
{ path = "src/tests/compaction_test/Makefile.toml" },
{ path = "src/storage/backup/integration_tests/Makefile.toml" },
]
env_files = ["./risedev-components.user.env"]
env_scripts = [
'''
#!@duckscript
is_sanitizer_enabled = get_env ENABLE_SANITIZER
is_all_in_one_enabled = get_env ENABLE_ALL_IN_ONE
if ${is_sanitizer_enabled}
set_env RISEDEV_CARGO_BUILD_EXTRA_ARGS "-Zbuild-std --target ${CARGO_MAKE_RUST_TARGET_TRIPLE}"
set_env RISEDEV_BUILD_TARGET_DIR "${CARGO_MAKE_RUST_TARGET_TRIPLE}/"
set_env RISEDEV_RUSTFLAGS "-Ctarget-cpu=native --cfg tokio_unstable -Zsanitizer=thread"
else
set_env RISEDEV_CARGO_BUILD_EXTRA_ARGS ""
set_env RISEDEV_BUILD_TARGET_DIR ""
end
if ${is_all_in_one_enabled}
set_env RISEDEV_CARGO_BUILD_CRATE "risingwave_cmd_all"
else
set_env RISEDEV_CARGO_BUILD_CRATE "risingwave_cmd"
end
''',
]
[config]
default_to_workspace = false
skip_core_tasks = true
skip_git_env_info = true
skip_rust_env_info = false
skip_crate_env_info = true
[tasks.clean-full]
category = "Misc"
description = "Clean all downloaded binaries by deleting .risingwave folder"
script = '''
#!@duckscript
rm -rf "${PREFIX}"
'''
[tasks.clean-data]
category = "Misc"
description = "Clean all data, config and logs"
script = '''
#!@duckscript
rm -rf "${PREFIX_DATA}"
rm -rf "${PREFIX_LOG}"
rm -rf "${PREFIX_CONFIG}"
rm -rf "${PREFIX_PROFILING}"
'''
[tasks.l]
alias = "logs"
[tasks.logs]
category = "Misc"
description = "Open logs with VSCode and dump in console"
script = '''
#!/bin/bash
set -e
code "${PREFIX_LOG}" || true
for out_file in ${PREFIX_LOG}/*.log
do
echo ""
echo "==="
echo "=== Dump log file $out_file ==="
echo "==="
echo ""
cat "$out_file" | tail -n 300
done
echo ""
echo ""
echo ""
'''
[tasks.ls]
category = "Misc"
description = "List all nodes in the cluster"
script = '''
#!/bin/bash
tmux list-windows -t risedev | grep -v active | cut -d'(' -f1
'''
[tasks.lsw]
category = "Misc"
description = "List --watch all nodes in the cluster"
script = '''
#!/bin/bash
watch -n 1 "tmux list-windows -t risedev | grep -v active | cut -d'(' -f1"
'''
[tasks.del]
alias = "delete"
[tasks.delete]
category = "Misc"
description = "Delete a node in the cluster"
script = '''
#!/bin/bash
risedev_ls () {
tmux list-windows -t risedev | grep -v active | cut -d'(' -f1
}
err () {
echo "Available nodes are"
risedev_ls
exit 1
}
if [[ -z "$1" ]]; then
echo "Please pass a parameter to this script, defining which node you want to delete"
err
fi
if [[ -z $(risedev_ls | grep "$1" ) ]]; then
echo "Please select a node that is currently running"
err
fi
tmux kill-window -t $1
'''
[tasks.f]
alias = "follow"
[tasks.follow]
category = "misc"
description = "Follows the end of the logs of a specific component"
script = '''
#!/bin/bash
set -e
if [[ -z "$1" ]]; then
echo "Please pass a parameter to this script, defining which logs you want to follow"
echo "Available logs are..."
ls ${PREFIX_LOG}
exit 1
fi
if [[ ! -f ${PREFIX_LOG}/$1 ]]; then
echo "selected file does not exist"
echo "Available logs are..."
ls ${PREFIX_LOG}
exit 1
fi
tail -f -n 5 ${PREFIX_LOG}/$1
'''
[tasks.check-logs]
category = "Misc"
description = "Check if there is panic in log or significant log size issue"
script = '''
#!/bin/bash
set -e
for out_file in ${PREFIX_LOG}/*.log
do
if grep "panicked at" "$out_file" -C 100; then
echo "$(tput setaf 3)\"panicked at\" found in $out_file$(tput sgr0), please check if there's any bugs in this PR."
echo "You may find \"risedev-logs\" artifacts and download logs after all workflows finish."
exit 1
fi
done
if (( "$(du -sk ${PREFIX_LOG} | cut -f1)" > 2000 )) ; then
echo "$(tput setaf 3)log size is significantly large ($(du -sh ${PREFIX_LOG} | cut -f1)).$(tput sgr0) Please disable unnecessary logs."
exit 1
fi
'''
[tasks.doc]
category = "Misc"
description = "Open rustdoc for risingwave"
dependencies = ["build-docs"]
script = '''
#!/bin/bash
set -e
python -mwebbrowser file://$(pwd)/target/doc/index.html
'''
[tasks.link-standalone-binaries]
category = "RiseDev - Build"
description = "Link standalone cmds to RiseDev bin"
condition = { env_not_set = ["ENABLE_ALL_IN_ONE"] }
script = '''
#!/bin/bash
set -e
rm -f "${PREFIX_BIN}/compute-node"
rm -f "${PREFIX_BIN}/meta-node"
rm -f "${PREFIX_BIN}/frontend"
rm -f "${PREFIX_BIN}/compactor"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/compute-node" "${PREFIX_BIN}/compute-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/meta-node" "${PREFIX_BIN}/meta-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/frontend" "${PREFIX_BIN}/frontend"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/compactor" "${PREFIX_BIN}/compactor"
'''
[tasks.link-all-in-one-binaries]
category = "RiseDev - Build"
description = "Link all-in-one cmds to RiseDev bin"
condition = { env_set = ["ENABLE_ALL_IN_ONE"] }
script = '''
#!/bin/bash
set -e
rm -rf "${PREFIX_BIN}/risingwave"
mkdir -p "${PREFIX_BIN}/risingwave"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/meta-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/compute-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/frontend-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/compactor"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/risectl"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_BIN}/risingwave/playground"
'''
[tasks.link-user-bin]
category = "RiseDev - Build"
description = "Link all binaries to .bin"
condition = { env_set = ["ENABLE_ALL_IN_ONE"] }
script = '''
#!/bin/bash
set -e
rm -rf "${PREFIX_USR_BIN}"
mkdir -p "${PREFIX_USR_BIN}"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/meta-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/compute-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/frontend-node"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/risectl"
ln -s "$(pwd)/target/${RISEDEV_BUILD_TARGET_DIR}${BUILD_MODE_DIR}/risingwave" "${PREFIX_USR_BIN}/playground"
'''
[tasks.post-build-risingwave]
category = "RiseDev - Build"
description = "Copy RisngWave binaries to bin"
condition = { env_set = ["ENABLE_BUILD_RUST"] }
dependencies = [
"link-standalone-binaries",
"link-all-in-one-binaries",
"link-user-bin",
]
[tasks.b]
alias = "build-risingwave"
[tasks.build]
alias = "build-risingwave"
[tasks.extract-dashboard-artifact]
category = "RiseDev - Build"
description = "Extract dashboard artifact"
condition = { env_not_set = ["ENABLE_BUILD_DASHBOARD_V2"] }
script = '''
#!/bin/bash
# we allow this script to fail
echo "Extracting dashboard artifacts to ${PREFIX_UI}"
rm -rf "${PREFIX_UI}"
git worktree prune
git worktree add "${PREFIX_UI}" origin/dashboard-artifact
'''
[tasks.export-dashboard-v2]
category = "RiseDev - Build"
description = "Build dashboard v2"
condition = { env_set = ["ENABLE_BUILD_DASHBOARD_V2"] }
script = """
#!/bin/bash
set -e
rm -rf "${PREFIX_UI}"
cd dashboard && npm run build-static
cd .. && ln -s "$(pwd)/dashboard/out" "${PREFIX_UI}"
"""
[tasks.build-risingwave]
category = "RiseDev - Build"
description = "Build Rust components"
condition = { env_set = ["ENABLE_BUILD_RUST"] }
script = '''
#!/bin/bash
set -e
echo "$(tput setaf 4)$(tput bold)[Reminder]$(tput sgr0) risedev will only build $(tput setaf 4)risingwave_cmd(_all) and risedev$(tput sgr0) crates."
[[ -z "${RISEDEV_RUSTFLAGS}" ]] || export RUSTFLAGS="${RISEDEV_RUSTFLAGS}"
echo + RUSTFLAGS="${RUSTFLAGS:-<not set>}"
set -xe
cargo build -p ${RISEDEV_CARGO_BUILD_CRATE} -p risedev \
--profile "${RISINGWAVE_BUILD_PROFILE}" \
${RISEDEV_CARGO_BUILD_EXTRA_ARGS}
'''
[tasks.clean]
category = "RiseDev - Build"
description = "Clean Rust targets"
condition = { env_set = ["ENABLE_BUILD_RUST"] }
script = '''
#!/bin/bash
set -e
cargo clean
'''
[tasks.build-docs]
category = "RiseDev - Build"
description = "Build Rust docs"
condition = { env_set = ["ENABLE_BUILD_RUST"] }
env = { RUSTDOCFLAGS = "--markdown-css ../../docs/rust.css --markdown-no-toc --index-page docs/index.md -Zunstable-options" }
script = '''
#!/bin/bash
set -e
cargo doc --workspace --no-deps --document-private-items
'''
[tasks.prepare-config]
category = "RiseDev - Prepare"
description = "Copy necessary configuration files to RiseDev"
script = '''
#!/bin/bash
set -e
echo > "${PREFIX_CONFIG}/risingwave.toml"
cp "src/risedevtool/run_command.sh" "${PREFIX_BIN}/run_command.sh"
cp "src/risedevtool/welcome.sh" "${PREFIX_BIN}/welcome.sh"
'''
[tasks.download-all]
category = "RiseDev - Components"
description = "Download all available components at once"
dependencies = [
"download-connector",
"download-etcd",
"download-grafana",
"download-jaeger",
"download-kafka",
"download-mcli",
"download-minio",
"download-prometheus",
"download-pubsub",
"download-redis",
]
[tasks.create-user-profiles-file]
category = "RiseDev - Prepare"
description = "Create user profiles file if not exists"
condition = { files_not_exist = ["${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/risedev-profiles.user.yml"] }
script = '''
#!/bin/bash
set -e
cat <<\EOF > "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/risedev-profiles.user.yml"
# This file is used to store extra profiles besides the ones defined in `risedev.yml`.
# It is automatically created by RiseDev.
#
# To use this:
# - add new profiles just like the ones defined under the `profile` section in `risedev.yml`
# - develop the cluster with the new profiles by `./risedev dev <new-profile-name>`
my-default-example:
config-path: src/config/default.toml
steps:
- use: meta-node
- use: compute-node
- use: frontend
EOF
'''
[tasks.pre-start-dev]
category = "RiseDev - Prepare"
description = "Prepare dev cluster by downloading necessary tools and build required components"
dependencies = [
"create-user-profiles-file",
"download-all",
"build-risingwave",
"post-build-risingwave",
"extract-dashboard-artifact",
"export-dashboard-v2",
"prepare-config",
]
[tasks.pre-start-benchmark]
category = "RiseDev - Prepare"
description = "Download necessary tools to deploy a benchmark env"
dependencies = [
"download-minio",
"download-mcli",
"download-etcd",
"download-grafana",
"download-prometheus",
"download-jaeger",
"download-kafka",
"download-redis",
]
[tasks.p]
alias = "playground"
[tasks.playground]
category = "RiseDev - Start"
description = "Start a lite RisingWave playground using risingwave all-in-one binary"
script = '''
#!/bin/bash
set -ex
RUST_BACKTRACE=1 RW_NODE=playground cargo run --bin risingwave --profile "${RISINGWAVE_BUILD_PROFILE}"
'''
[tasks.ctl]
category = "RiseDev - Start"
description = "Start RiseCtl"
script = '''
#!/bin/bash
RC_ENV_FILE="${PREFIX_CONFIG}/risectl-env"
if [ ! -f "${RC_ENV_FILE}" ]; then
echo "risectl-env file not found. Did you start cluster using $(tput setaf 4)\`./risedev d\`$(tput sgr0)?"
exit 1
fi
source "${RC_ENV_FILE}"
cargo run --bin risectl --profile "${RISINGWAVE_BUILD_PROFILE}" -- "$@"
test $? -eq 0 || exit 1
'''
[tasks.d]
alias = "dev"
[tasks.dev]
category = "RiseDev - Start"
dependencies = ["pre-start-dev"]
command = "target/${BUILD_MODE_DIR}/risedev-dev"
args = ["${@}"]
description = "Start a full RisingWave dev cluster using risedev-dev"
[tasks.kafka]
category = "RiseDev - Start"
description = "Start a RisingWave dev cluster alongside with a Kafka instance"
command = "./risedev"
args = ["dev", "ci-kafka"]
[tasks.kill-risedev]
category = "RiseDev - Stop"
description = "Kill RisingWave dev cluster"
script = '''
#!/bin/bash
tmux list-windows -t risedev -F "#{pane_id}" | xargs -I {} tmux send-keys -t {} C-c C-d
tmux kill-session -t risedev
test $? -eq 0 || { echo "Failed to stop all RiseDev components."; exit 1; }
'''
[tasks.kill]
alias = "kill-risedev"
[tasks.k]
alias = "kill-risedev"
[tasks.down]
category = "RiseDev - Stop"
description = "Kill RisingWave dev cluster and clean the data"
dependencies = ["k", "clean-data"]
[tasks.install-tools]
category = "RiseDev - Check"
script = """
#!/bin/bash
set -e
for tool in cargo-llvm-cov cargo-nextest cargo-udeps cargo-hakari cargo-sort cargo-make cargo-upgrades typos-cli
do
echo "install: $(tput setaf 4)$tool$(tput sgr0)"
cargo install $tool --locked
echo
done
echo "install: $(tput setaf 4)risinglightdb/sqllogictest-rs$(tput sgr0)"
cargo install --git https://github.com/risinglightdb/sqllogictest-rs --bin sqllogictest
echo
echo "check: $(tput setaf 4)tmux >= v3.2a$(tput sgr0)"
tmux -V || echo "$(tput setaf 3)tmux$(tput sgr0) not found."
echo
echo "check: $(tput setaf 4)psql >= 14$(tput sgr0)"
psql -V || echo "$(tput setaf 3)psql$(tput sgr0) not found."
echo
echo "check: $(tput setaf 4)cmake$(tput sgr0)"
cmake --version || echo "$(tput setaf 3)cmake$(tput sgr0) not found."
echo
echo "check: $(tput setaf 4)protoc$(tput sgr0)"
protoc --version || echo "$(tput setaf 3)protoc$(tput sgr0) not found."
echo
"""
description = "Install required tools to do pre-CI check and run e2e tests"
[tasks.warn-on-missing-tools]
private = true
script = """
echo "If any command is not found, run $(tput setaf 4)./risedev install-tools$(tput sgr0) to install required tools."
"""
[tasks.test-cov]
category = "RiseDev - Test"
dependencies = ["warn-on-missing-tools"]
script = """
#!/bin/bash
set -e
export CARGO_TARGET_DIR=target/coverage
cargo llvm-cov nextest --html
"""
description = "Run unit tests and report coverage"
[tasks.test]
category = "RiseDev - Test"
dependencies = ["warn-on-missing-tools"]
script = """
#!/bin/bash
set -e
cargo nextest run "$@"
"""
description = "Run unit tests"
[tasks.sbuild]
category = "RiseDev - Build in simulation mode"
description = "Build in simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" }
script = """
#!/bin/bash
set -e
cargo build \
-p risingwave_batch \
-p risingwave_common \
-p risingwave_compute \
-p risingwave_connector \
-p risingwave_frontend \
-p risingwave_meta \
-p risingwave_object_store \
-p risingwave_source \
-p risingwave_storage \
-p risingwave_stream \
-p pgwire \
"$@"
"""
[tasks.stest]
category = "RiseDev - Deterministic Simulation Test"
description = "Run unit tests in deterministic simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { RUSTFLAGS = "--cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" }
script = """
#!/bin/bash
set -e
cargo nextest run \
-p risingwave_batch \
-p risingwave_common \
-p risingwave_compute \
-p risingwave_connector \
-p risingwave_frontend \
-p risingwave_meta \
-p risingwave_object_store \
-p risingwave_source \
-p risingwave_storage \
-p risingwave_stream \
-p pgwire \
"$@"
"""
[tasks.sscale-test]
category = "RiseDev - Simulation scaling tests"
description = "Run integration scaling tests in deterministic simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" }
script = """
#!/bin/bash
set -e
cargo nextest run \
-p risingwave_simulation \
"$@"
"""
[tasks.sarchive-scale-test]
category = "RiseDev - Simulation scaling tests"
description = "Archive integration scaling tests in deterministic simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" }
script = """
#!/bin/bash
set -e
cargo nextest archive \
-p risingwave_simulation \
--archive-file scale-test.tar.zst \
"$@"
"""
[tasks.sslt]
category = "RiseDev - Deterministic Simulation End-to-end Test"
description = "Run e2e tests in deterministic simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" }
script = """
#!/bin/bash
set -e
cargo run -p risingwave_simulation "$@"
"""
[tasks.sslt-build-all]
category = "RiseDev - Deterministic Simulation End-to-end Test"
description = "Build deterministic simulation runner and tests"
dependencies = ["warn-on-missing-tools"]
env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" }
script = """
#!/bin/bash
set -e
cargo build -p risingwave_simulation --tests "$@"
"""
[tasks.sslt-cov]
category = "RiseDev - Deterministic Simulation End-to-end Test"
description = "Run e2e tests in deterministic simulation mode and report code coverage"
dependencies = ["warn-on-missing-tools"]
env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim-cov" }
script = """
#!/bin/bash
set -e
cargo llvm-cov run -p risingwave_simulation --html "$@"
"""
[tasks.check-hakari]
category = "RiseDev - Check"
description = "Run cargo hakari check and attempt to fix"
script = """
#!/bin/bash
echo "Running $(tput setaf 4)cargo hakari$(tput sgr0) checks and attempting to fix"
# cargo hakari will generate new Cargo.toml regardless whether the original Cargo.toml is correct or not.
# So we always verify before generate, so as not to change the modified time of Cargo.toml.
(cargo hakari verify > /dev/null) || cargo hakari generate
test $? -eq 0 || exit 1
"""
[tasks.check-dep-sort]
category = "RiseDev - Check"
description = "Run cargo sort check and attempt to fix"
script = """
#!/bin/bash
echo "Running $(tput setaf 4)cargo sort$(tput sgr0) checks and attempting to fix"
# Rewriting Cargo.toml will cause a full rebuild of all crates, so we always check before fix.
(cargo sort -w -c > /dev/null) || cargo sort -w
test $? -eq 0 || { echo "cargo sort check failed. You may run $(tput setaf 4)cargo sort -w$(tput sgr0) to fix it."; exit 1; }
"""
[tasks.check-fmt]
category = "RiseDev - Check"
description = "Run cargo fmt check and attempt to fix"
script = """
#!/bin/bash
echo "Running $(tput setaf 4)cargo fmt$(tput sgr0) checks and attempting to fix"
cargo fmt --all
test $? -eq 0 || exit 1
"""
[tasks.check-clippy]
category = "RiseDev - Check"
description = "Run cargo clippy check"
script = """
#!/bin/bash
echo "Running $(tput setaf 4)cargo clippy$(tput sgr0) checks"
cargo clippy --all-targets --all-features
echo "If cargo clippy check failed or generates warning, you may run $(tput setaf 4)cargo clippy --workspace --all-targets --fix$(tput sgr0) to fix it. Note that clippy fix requires manual review, as not all auto fixes are guaranteed to be reasonable."
"""
[tasks.check-typos]
category = "RiseDev - Check"
description = "Run cargo typos-cli check"
script = """
#!/bin/bash
if ! [ -x "$(command -v typos)" ]; then
echo "Error: 'typos-cli' is not installed, please run './risedev install-tools'." >&2
exit 1
fi
if ! typos ; then
echo "Hint: use 'typos -w' to fix."
fi
"""
[tasks.check]
category = "RiseDev - Check"
dependencies = [
"warn-on-missing-tools",
"check-hakari",
"check-dep-sort",
"check-fmt",
"check-clippy",
"check-typos",
]
script = """
#!/bin/bash
echo "Good work! You may run $(tput setaf 4)./risedev test$(tput sgr0) or $(tput setaf 4)./risedev test-cov$(tput sgr0) to run unit tests."
"""
description = "Perform pre-CI checks and automatically fix cargo sort, cargo hakari, cargo fmt warnings"
[tasks.c]
alias = "check"
[tasks.install]
category = "RiseDev - Prepare"
description = "Install RiseDev to user local"
script = """
#!/bin/bash
set -e
DIR="$(pwd)"
NAME="${1:-risedev}"
INSTALL_PATH="$CARGO_HOME/bin/${NAME}"
read -p "Install to ${INSTALL_PATH}? [y/N] " -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
cat <<EOF > "${INSTALL_PATH}"
#!/bin/bash
set -e
cd "$DIR"
./risedev "\\$@"
EOF
chmod +x "${INSTALL_PATH}"
echo RiseDev installed to $(tput setaf 4)${INSTALL_PATH}$(tput sgr0)
echo If you still feel this is not enough, you may copy $(tput setaf 4)risedev$(tput sgr0) to something like $(tput setaf 4)r+$(tput sgr0).
"""
[tasks.ci-start]
category = "RiseDev - CI"
dependencies = ["clean-data", "pre-start-dev"]
command = "target/${BUILD_MODE_DIR}/risedev-dev"
args = ["${@}"]
description = "Clean data and start a full RisingWave dev cluster using risedev-dev"
[tasks.ci-kill]
category = "RiseDev - CI"
dependencies = ["k", "l", "check-logs"]
description = "Kill cluster, dump logs and check logs"
[tasks.slt]
category = "RiseDev - SQLLogicTest"
dependencies = ["warn-on-missing-tools"]
command = "sqllogictest"
args = ["${@}"]
description = "Run SQLLogicTest"
[tasks.slt-streaming]
category = "RiseDev - SQLLogicTest"
extend = "slt"
args = ["${@}", "./e2e_test/streaming/**/*.slt"]
description = "Run all streaming e2e tests"
[tasks.slt-batch]
category = "RiseDev - SQLLogicTest"
extend = "slt"
args = ["${@}", "./e2e_test/batch/**/*.slt"]
description = "Run all batch e2e tests"
[tasks.slt-generated]
category = "RiseDev - SQLLogicTest"
extend = "slt"
args = ["${@}", "./e2e_test/generated/**/*.slt"]
description = "Run all generated e2e tests"
[tasks.slt-all]
category = "RiseDev - SQLLogicTest"
run_task = { name = ["slt-streaming", "slt-batch", "slt-generated"] }
description = "Run all e2e tests"
[tasks.docslt]
category = "RiseDev - SQLLogicTest"
description = "Extract SQL examples written in SQLLogicTest syntax from Rust doc comments"
script = '''
#!/bin/bash
set -e
cargo run --bin risedev-docslt -- "$@"
'''
[tasks.compose]
category = "RiseDev - Compose"
description = "Compose a docker-compose.yaml file"
script = '''
#!/bin/bash
set -e
rm -rf ${PREFIX_DOCKER}/*
mkdir -p "${PREFIX_DOCKER}"
cargo run --bin risedev-compose -- -d "${PREFIX_DOCKER}" "$@"
echo docker-compose file generated in $(tput setaf 4)${PREFIX_DOCKER}$(tput sgr0)
'''
[tasks.compose-deploy]
category = "RiseDev - Compose"
description = "Compose a docker-compose.yaml deploy directory"
script = '''
#!/bin/bash
set -e
rm -rf "${PREFIX_DOCKER}"/*
mkdir -p "${PREFIX_DOCKER}"
cargo run --bin risedev-compose -- -d "${PREFIX_DOCKER}" --deploy "$@"
echo docker-compose file and deploy.sh generated in $(tput setaf 4)${PREFIX_DOCKER}$(tput sgr0)
echo If you are ready, run $(tput setaf 4)./risedev apply-compose-deploy$(tput sgr0) to do the deployment.
'''
[tasks.apply-compose-deploy]
category = "RiseDev - Compose"
description = "Run deploy.sh"
script = '''
#!/bin/bash
set -e
.risingwave/rw-docker/deploy.sh "$@"
echo
echo "Deploy finished!"
cat .risingwave/rw-docker/_message.partial.sh
'''
[tasks.apply-compose-docker]
category = "RiseDev - Compose"
description = "Run deploy.sh"
script = '''
#!/bin/bash
set -e
cp -a .risingwave/rw-docker/* docker
'''