forked from risingwavelabs/risingwave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
1109 lines (926 loc) · 30.4 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
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
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/sqlparser/test_runner/sqlparser_test.toml" },
{ path = "src/frontend/planner_test/planner_test.toml" },
{ path = "src/tests/compaction_test/Makefile.toml" },
{ path = "src/storage/backup/integration_tests/Makefile.toml" },
{ path = "src/java_binding/make-java-binding.toml" },
{ path = "src/stream/tests/integration_tests/integration_test.toml" },
]
env_files = ["./risedev-components.user.env"]
env_scripts = [
'''
#!@duckscript
# only duckscript can modify env variables in cargo-make
set_env ENABLE_TELEMETRY "false"
is_sanitizer_enabled = get_env ENABLE_SANITIZER
is_all_in_one_enabled = get_env ENABLE_ALL_IN_ONE
is_hdfs_backend = get_env ENABLE_HDFS
is_release = get_env ENABLE_RELEASE_PROFILE
is_not_release = not ${is_release}
is_dynamic_linking = get_env ENABLE_DYNAMIC_LINKING
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
if ${is_hdfs_backend}
set_env BUILD_HDFS_BACKEND_CMD "-p risingwave_object_store --features hdfs-backend"
else
set_env BUILD_HDFS_BACKEND_CMD ""
end
if ${is_not_release} and ${is_dynamic_linking}
set_env RISINGWAVE_FEATURE_FLAGS "--features rw-dynamic-link --no-default-features"
else
set_env RISINGWAVE_FEATURE_FLAGS "--features rw-static-link"
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
min_version = "0.36.6"
[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 or dump in console"
script = '''
#!/usr/bin/env bash
set -e
code "${PREFIX_LOG}" 2> /dev/null || true
for out_file in ${PREFIX_LOG}/*.log
do
echo "~~~ Dump log file $out_file"
echo ""
cat "$out_file" | tail -n 300
done
echo ""
echo ""
echo ""
'''
[tasks.ls]
category = "Misc"
description = "List all nodes in the cluster"
script = '''
#!/usr/bin/env 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 = '''
#!/usr/bin/env 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 = '''
#!/usr/bin/env 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 = '''
#!/usr/bin/env 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 = "RiseDev - CI"
description = "Check if there is panic in log or significant log size issue"
script = '''
#!/usr/bin/env bash
set -e
echo "~~~ Check logs"
du -ah ${PREFIX_LOG}
for out_file in ${PREFIX_LOG}/*.log
do
if grep "panicked at" "$out_file" -C 100; then
echo "$(tput setaf 1)\"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 1)ERROR: 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 = '''
#!/usr/bin/env 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 = '''
#!/usr/bin/env 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 = '''
#!/usr/bin/env 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 = '''
#!/usr/bin/env 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 = '''
#!/usr/bin/env 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 = """
#!/usr/bin/env 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_true = ["ENABLE_BUILD_RUST"] }
script = '''
#!/usr/bin/env 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 ${BUILD_HDFS_BACKEND_CMD}\
--profile "${RISINGWAVE_BUILD_PROFILE}" \
${RISINGWAVE_FEATURE_FLAGS} \
${RISEDEV_CARGO_BUILD_EXTRA_ARGS}
'''
[tasks.clean]
category = "RiseDev - Build"
description = "Clean Rust targets"
condition = { env_set = ["ENABLE_BUILD_RUST"] }
script = '''
#!/usr/bin/env 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/rustdoc/rust.css --markdown-no-toc --index-page docs/rustdoc/index.md -Zunstable-options" }
script = '''
#!/usr/bin/env 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 = '''
#!/usr/bin/env 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-maven",
"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 = '''
#!/usr/bin/env 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/my_config.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",
"build-connector-node",
"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"
dependencies = ["build-connector-node"]
script = '''
#!/usr/bin/env bash
set -ex
RUST_BACKTRACE=1 \
cargo run --bin risingwave \
--profile "${RISINGWAVE_BUILD_PROFILE}" \
${RISINGWAVE_FEATURE_FLAGS} \
-- playground
'''
[tasks.ctl]
category = "RiseDev - Start"
description = "Start RiseCtl"
script = '''
#!/usr/bin/env 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"]
script = "RUST_BACKTRACE=1 target/${BUILD_MODE_DIR}/risedev-dev ${@}"
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 = '''
#!/usr/bin/env 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-nextest]
category = "RiseDev - Check"
install_crate = { min_version = "0.9.51", crate_name = "cargo-nextest", binary = "cargo", test_arg = ["nextest", "--help"], install_command = "binstall" }
[tasks.install-llvm-cov]
category = "RiseDev - Check"
install_crate = { min_version = "0.5.17", crate_name = "cargo-llvm-cov", binary = "cargo", test_arg = ["llvm-cov", "--help"], install_command = "binstall" }
[tasks.install-tools]
category = "RiseDev - Check"
script = """
#!/usr/bin/env bash
set -e
for tool in cargo-llvm-cov cargo-nextest cargo-hakari cargo-sort cargo-make
do
echo "install: $(tput setaf 4)$tool$(tput sgr0)"
cargo binstall -y --no-symlinks $tool
echo
done
# Need https://github.com/est31/cargo-udeps/pull/147 to make --exclude work
echo "install: $(tput setaf 4)cargo-udeps$(tput sgr0)"
cargo install cargo-udeps --locked --git https://github.com/est31/cargo-udeps --rev 63dd458
echo
# Tools that fallback to `cargo install` when using `cargo binstall`.
# We directly use `cargo install` here to be faster.
for tool in typos-cli sqllogictest-bin
do
echo "install: $(tput setaf 4)$tool$(tput sgr0)"
cargo install $tool --locked
echo
done
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 >= 3.12.0$(tput sgr0)"
protoc --version || echo "$(tput setaf 3)protoc$(tput sgr0) not found."
echo
"""
description = "Install (or upgrade) 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 = ["install-llvm-cov", "install-nextest"]
script = """
#!/usr/bin/env 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 = ["install-nextest"]
script = """
#!/usr/bin/env bash
set -e
cargo nextest run "$@"
"""
description = "Run unit tests"
[tasks.build-connector-node]
category = "RiseDev - Components"
dependencies = ["prepare"]
condition = { env_set = ["ENABLE_BUILD_RW_CONNECTOR"], files_modified = { input = [
"./java/connector-node/**/*.java",
], output = [
"./java/connector-node/assembly/target/*",
] } }
description = "Build RisingWave Connector from source"
script = '''
#!/usr/bin/env bash
set -e
if command -v mvn &> /dev/null; then
MAVEN_PATH="$(command -v mvn)"
else
MAVEN_PATH="${PREFIX_BIN}/maven/bin/mvn"
fi
ARTIFACT="risingwave-connector-1.0.0.tar.gz"
TARGET_PATH="${JAVA_DIR}/connector-node/assembly/target/${ARTIFACT}"
echo "Building connector node..."
cd "${JAVA_DIR}"
"${MAVEN_PATH}" --batch-mode --update-snapshots clean package -Dmaven.test.skip
rm -rf ${PREFIX_BIN}/connector-node
mkdir -p "${PREFIX_BIN}/connector-node"
tar xf ${TARGET_PATH} -C "${PREFIX_BIN}/connector-node"
'''
[tasks.sbuild]
category = "RiseDev - Build in simulation mode"
description = "Build in simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo build \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-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 = ["install-nextest"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo nextest run \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-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 integration tests"
description = "Run scaling tests in deterministic simulation mode"
deprecated = "Please use `risedev sit-test scale::` instead."
[tasks.sit-test]
category = "RiseDev - Simulation integration tests"
description = "Run integration tests in deterministic simulation mode"
dependencies = ["install-nextest"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo nextest run \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_simulation \
"$@"
"""
[tasks.sarchive-it-test]
category = "RiseDev - Simulation integration tests"
description = "Archive integration tests in deterministic simulation mode"
dependencies = ["install-nextest"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo nextest archive \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_simulation \
--archive-file simulation-it-test.tar.zst \
"$@"
"""
[tasks.scheck]
category = "RiseDev - Deterministic Simulation End-to-end Test"
description = "Run cargo check in deterministic simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo check \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_simulation --all-targets "$@"
"""
[tasks.sslt]
category = "RiseDev - Deterministic Simulation End-to-end Test"
description = "Run e2e tests in deterministic simulation mode"
dependencies = ["warn-on-missing-tools"]
env = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo run \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-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 = { CARGO_TARGET_DIR = "target/sim" }
script = """
#!/usr/bin/env bash
set -e
cargo build \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-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 = ["install-llvm-cov"]
env = { CARGO_TARGET_DIR = "target/sim-cov" }
script = """
#!/usr/bin/env bash
set -e
cargo llvm-cov run \
--config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \
-p risingwave_simulation \
--html "$@"
"""
[tasks.check-java]
category = "RiseDev - Check"
description = "Run mvn spotless:check in connector-node"
dependencies = ["warn-on-missing-tools"]
condition = { env_set = ["ENABLE_RW_CONNECTOR", "ENABLE_BUILD_RW_CONNECTOR"] }
script = """
#!/usr/bin/env bash
set -e
if command -v mvn &> /dev/null; then
MAVEN_PATH="$(command -v mvn)"
else
MAVEN_PATH="${PREFIX_BIN}/maven/bin/mvn"
fi
cd "${JAVA_DIR}"
"${MAVEN_PATH}" spotless:check -q
"""
[tasks.check-java-fix]
category = "RiseDev - Check"
description = "Run mvn spotless:apply in connector-node"
dependencies = ["warn-on-missing-tools"]
condition = { env_set = ["ENABLE_RW_CONNECTOR", "ENABLE_BUILD_RW_CONNECTOR"] }
script = """
#!/usr/bin/env bash
set -e
if command -v mvn &> /dev/null; then
MAVEN_PATH="$(command -v mvn)"
else
MAVEN_PATH="${PREFIX_BIN}/maven/bin/mvn"
fi
cd "${JAVA_DIR}"
"${MAVEN_PATH}" spotless:apply
"""
[tasks.check-hakari]
category = "RiseDev - Check"
description = "Run cargo hakari check and attempt to fix"
install_crate = { min_version = "0.9.24", crate_name = "cargo-hakari", binary = "cargo", test_arg = ["hakari", "--help"], install_command = "binstall" }
script = """
#!/usr/bin/env bash
echo "Running $(tput setaf 4)cargo hakari$(tput sgr0) checks and attempting to fix"
cargo hakari generate --diff --quiet || cargo hakari generate
cargo hakari verify > /dev/null
test $? -eq 0 || exit 1
"""
[tasks.check-dep-sort]
category = "RiseDev - Check"
description = "Run cargo sort check and attempt to fix"
install_crate = { min_version = "1.0.9", crate_name = "cargo-sort", binary = "cargo", test_arg = ["sort", "--help"], install_command = "binstall" }
script = """
#!/usr/bin/env 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 = """
#!/usr/bin/env 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 = """
#!/usr/bin/env bash
echo "Running $(tput setaf 4)cargo clippy$(tput sgr0) checks"
cargo clippy --all-targets ${RISINGWAVE_FEATURE_FLAGS}
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."
echo "Alternately, you may run $(tput setaf 4)./risedev cf {package_names}$(tput sgr0) to fix those packages (e.g. frontend, meta)."
"""
[tasks.check-clippy-fix]
category = "RiseDev - Check"
description = "Run cargo clippy check and fixes all files (including dirty and staged)"
script = """
#!/usr/bin/env bash
echo "Running $(tput setaf 4)cargo clippy$(tput sgr0) checks and attempting to fix"
if [ $# -gt 0 ]; then
ARGS=("$@")
echo "Applying clippy --fix for $@ (including dirty and staged files)"
cargo clippy ${ARGS[@]/#/--package risingwave_} ${RISINGWAVE_FEATURE_FLAGS} --fix --allow-dirty --allow-staged
else
echo "Applying clippy --fix for all targets to all files (including dirty and staged files)"
echo "Tip: run $(tput setaf 4)./risedev cf {package_names}$(tput sgr0) to only check-fix those packages (e.g. frontend, meta)."
cargo clippy --all-targets ${RISINGWAVE_FEATURE_FLAGS} --fix --allow-dirty --allow-staged
fi
"""
[tasks.check-typos]
category = "RiseDev - Check"
description = "Run cargo typos-cli check"
install_crate = { min_version = "1.14.8", crate_name = "typos-cli", binary = "typos", test_arg = ["--help"], install_command = "binstall" }
script = """
#!/usr/bin/env bash
if ! typos ; then
echo "Hint: use 'typos -w' to fix."
fi
"""
[tasks.check-udeps]
category = "RiseDev - Check"
description = "Check unused dependencies"
env = { RUSTFLAGS = "--cfg tokio_unstable" }
install_crate = { min_version = "0.1.35", crate_name = "cargo-udeps", binary = "cargo", test_arg = ["udeps", "--help"], install_command = "binstall" }
script = """
#!/usr/bin/env bash
# TODO: after cargo-machete supports excluding packages, we may use it instead of cargo udeps.
# It's much faster so we can add it to CI and [tasks.check].
echo "Running $(tput setaf 4)cargo udeps$(tput sgr0) checks"
cargo udeps --workspace --all-targets ${RISINGWAVE_FEATURE_FLAGS} --exclude workspace-hack --exclude risingwave_bench --exclude risingwave_udf --exclude risingwave_simulation
"""
[tasks.check]
category = "RiseDev - Check"
dependencies = [
"warn-on-missing-tools",
"check-hakari",
"check-dep-sort",
"check-fmt",
"check-clippy",
"check-typos",
"check-java",
]
script = """
#!/usr/bin/env bash
echo "Tip: use the alias $(tput setaf 4)./risedev c$(tput sgr0)."
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.check-fix]
category = "RiseDev - Check"
dependencies = [
"warn-on-missing-tools",
"check-hakari",
"check-dep-sort",
"check-fmt",
"check-clippy-fix",
"check-typos",
"check-java-fix",
]
script = """
#!/usr/bin/env bash
echo "Tip: use the alias $(tput setaf 4)./risedev cf$(tput sgr0)."
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, fixes cargo fmt warnings"
[tasks.cf]
alias = "check-fix"
[tasks.install]
category = "RiseDev - Prepare"
description = "Install RiseDev to user local"
script = """
#!/usr/bin/env 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}"
#!/usr/bin/env 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"