Repository navigation
Expand file tree
/
Copy pathMakefile.ci.toml
More file actions
1064 lines (958 loc) · 28.2 KB
/
Copy pathMakefile.ci.toml
File metadata and controls
1064 lines (958 loc) · 28.2 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
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
[env]
BENCH_WORKER_THREADS = { value = "1", condition = { env_not_set = [
"BENCH_WORKER_THREADS",
] } }
BENCH_NUM_OPS = { value = "1000", condition = { env_not_set = [
"BENCH_NUM_OPS",
] } }
BENCH_DURATION = { value = "30", condition = { env_not_set = [
"BENCH_DURATION",
] } }
BENCH_SAMPLE_SIZE = { value = "10", condition = { env_not_set = [
"BENCH_SAMPLE_SIZE",
] } }
BENCH_FEATURES = { value = "protocol-ws,kv-mem,kv-rocksdb,kv-surrealkv", condition = { env_not_set = [
"BENCH_FEATURES",
] } }
# Configure LLVM profiling output to go to target directory instead of repo root
LLVM_PROFILE_FILE = { value = "target/llvm-cov-target/%p-%m.profraw", condition = { env_not_set = [
"LLVM_PROFILE_FILE",
] } }
# Adjacent-pair upgrade chain for language upgrade tests. Each consecutive
# pair (3.0.0 -> 3.0.1, 3.0.1 -> 3.0.2, ...) is exercised as a separate hop.
# The trailing `..` token resolves to a path-based version, which the runner
# cargo-builds against the current checkout — this is the "main" target.
#
# Every numeric entry must have a published binary at
# https://download.surrealdb.com/v{ver}/surreal-v{ver}.{platform}.{tgz|exe}
# Override `LANG_UPGRADE_VERSIONS` to test alternative chains locally.
LANG_UPGRADE_VERSIONS = { value = "3.0.0,3.0.1,3.0.2,3.0.3,3.0.4,3.0.5,3.1.0-beta.1,3.1.0-beta.2,..", condition = { env_not_set = [
"LANG_UPGRADE_VERSIONS",
] } }
# --------------------------------------------------
# Quality checks
# --------------------------------------------------
[tasks.ci-docs]
category = "CI - CHECK"
description = "Check documentation generation"
command = "cargo"
args = [
"doc",
"--no-deps",
"--package",
"surrealdb",
"--features",
"rustls,native-tls,protocol-ws,protocol-http,kv-mem,kv-rocksdb,kv-tikv,http,scripting,jwks",
]
[tasks.ci-fmt]
category = "CI - CHECK"
description = "Run code formatting checks"
toolchain = "${SURREAL_NIGHTLY_RUST_TOOLCHAIN}"
command = "cargo"
args = [
"fmt",
"--all",
"--check",
]
[tasks.ci-check]
category = "CI - CHECK"
description = "Run code quality checks"
command = "cargo"
args = [
"check",
"--locked",
"--workspace",
"--all-targets",
"--features",
"${ALL_FEATURES}",
"${@}",
]
[tasks.ci-check-release]
category = "CI - CHECK"
description = "Run code quality checks (release)"
command = "cargo"
args = [
"check",
"--profile",
"clippy-release",
"--locked",
"--workspace",
"--all-targets",
"--features",
"${ALL_FEATURES}",
]
[tasks.ci-clippy]
category = "CI - CHECK"
description = "Run clippy linting"
command = "cargo"
args = [
"clippy",
"--workspace",
"--all-targets",
"--features",
"${ALL_FEATURES}",
"--tests",
"--benches",
"--bins",
"--",
"-D",
"warnings",
]
[tasks.ci-clippy-fix]
category = "CI - CHECK"
description = "Fix clippy lint issues"
command = "cargo"
args = [
"clippy",
"--workspace",
"--all-targets",
"--features",
"${ALL_FEATURES}",
"--tests",
"--benches",
"--bins",
"--fix",
"--allow-dirty",
]
[tasks.ci-clippy-release]
category = "CI - CHECK"
description = "Run code quality linting (release)"
command = "cargo"
args = [
"clippy",
"--workspace",
"--all-targets",
"--profile",
"clippy-release",
"--features",
"${ALL_FEATURES}",
"--tests",
"--benches",
"--bins",
"--",
"-D",
"warnings",
]
[tasks.ci-feature-check]
category = "CI - CHECK"
description = "Verify each feature compiles individually"
run_task = { name = [
"ci-feature-check-sdk",
"ci-feature-check-core",
"ci-feature-check-server",
], fork = true, parallel = true }
[tasks.ci-feature-check-sdk]
category = "CI - CHECK"
description = "Verify each SDK feature compiles individually"
install_crate = "cargo-hack"
env = { RUSTFLAGS = "-D warnings" }
command = "cargo"
args = [
"hack",
"check",
"--package",
"surrealdb",
"--each-feature",
"--exclude-features",
"kv-indxdb",
"--exclude-no-default-features",
]
[tasks.ci-feature-check-core]
category = "CI - CHECK"
description = "Verify each core feature compiles individually"
install_crate = "cargo-hack"
env = { RUSTFLAGS = "-D warnings" }
command = "cargo"
args = [
"hack",
"check",
"--package",
"surrealdb-core",
"--each-feature",
"--exclude-features",
"kv-indxdb",
]
[tasks.ci-feature-check-server]
category = "CI - CHECK"
description = "Verify each server feature compiles individually (with storage-mem base)"
install_crate = "cargo-hack"
env = { RUSTFLAGS = "-D warnings" }
command = "cargo"
args = [
"hack",
"check",
"--package",
"surrealdb-server",
"--each-feature",
"--exclude-features",
"storage-indxdb,tokio-console",
"--include-features",
"storage-mem",
"--exclude-no-default-features",
]
[tasks.ci-unused-deps]
category = "CI - CHECK"
description = "Check for unused dependencies"
install_crate = "cargo-machete"
command = "cargo"
args = ["machete"]
[tasks.ci-check-imports]
category = "CI - CHECK"
description = "Check for disallowed std::time imports (use web_time instead)"
script = '''
#!/bin/bash
set -euo pipefail
# Scan for direct use of std::time::Instant or std::time::SystemTime in Rust source files.
# These should be imported from web_time instead for WASM compatibility.
# std::time::Duration is fine and not flagged.
# language-tests/ and fuzz/ are excluded (separate workspaces).
MATCHES=$(grep -rn --include='*.rs' \
-E 'std::time::(Instant|SystemTime)' \
--exclude-dir=target \
--exclude-dir=language-tests \
--exclude-dir=fuzz \
. || true)
if [ -n "$MATCHES" ]; then
echo "$MATCHES" | while IFS= read -r match; do
echo "error: $match"
echo " --> Use web_time::{Instant,SystemTime} instead of std::time for WASM compatibility."
echo ""
done
COUNT=$(echo "$MATCHES" | wc -l | tr -d ' ')
echo "Found $COUNT disallowed std::time import(s). Use web_time instead."
exit 1
fi
echo "No disallowed std::time imports found."
'''
[tasks.ci-check-wasm]
# Note: On Mac, Apple ships its own version of LLVM which does not cross-compile to WASM.
# To build this on a Mac, you need to install the upstream LLVM Clang.
# Steps:
# 1. Install LLVM from Homebrew: `brew install llvm`
# 2. Add the LLVM bin directory to your PATH: `echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc`
category = "CI - CHECK"
description = "Run code quality checks (WASM)"
command = "cargo"
env = { RUSTFLAGS = '--cfg getrandom_backend="wasm_js"' }
args = [
"check",
"--locked",
"--package",
"surrealdb",
"--features",
"protocol-ws,protocol-http,kv-mem,kv-indxdb,http,jwks",
"--target",
"wasm32-unknown-unknown",
]
# --------------------------------------------------
# Integration Tests
# --------------------------------------------------
[tasks.ci-cli-integration]
category = "CI - INTEGRATION TESTS"
description = "Run CLI integration tests"
command = "cargo"
env = { RUST_BACKTRACE = 1, RUST_LOG = { value = "cli_integration=debug", condition = { env_not_set = [
"RUST_LOG",
] } } }
args = [
"test",
"--locked",
"--no-default-features",
"--features",
"storage-mem,storage-surrealkv,http,scripting,jwks,cli",
"--workspace",
"--test",
"cli_integration",
"--",
"cli_integration",
]
[tasks.ci-http-integration]
category = "CI - INTEGRATION TESTS"
description = "Run HTTP integration tests"
command = "cargo"
env = { RUST_BACKTRACE = 1, RUST_LOG = { value = "http_integration=debug", condition = { env_not_set = [
"RUST_LOG",
] } } }
args = [
"test",
"--locked",
"--no-default-features",
"--features",
"storage-mem,jwks",
"--workspace",
"--test",
"http_integration",
"--",
"http_integration",
]
[tasks.ci-ws-integration]
category = "CI - INTEGRATION TESTS"
description = "Run WebSocket integration tests"
command = "cargo"
env = { RUST_BACKTRACE = 1, RUST_LOG = { value = "ws_integration=debug", condition = { env_not_set = [
"RUST_LOG",
] } } }
args = [
"test",
"--locked",
"--no-default-features",
"--features",
"storage-mem",
"--workspace",
"--test",
"ws_integration",
"--",
"ws_integration",
]
[tasks.ci-ml-integration]
category = "CI - INTEGRATION TESTS"
description = "Run ML integration tests"
command = "cargo"
env = { RUST_BACKTRACE = 1, RUST_LOG = { value = "cli_integration::common=debug", condition = { env_not_set = [
"RUST_LOG",
] } } }
args = [
"test",
"--locked",
"--features",
"storage-mem,ml",
"--workspace",
"--test",
"ml_integration",
"--",
"ml_integration",
]
[tasks.ci-graphql-integration]
category = "CI - INTEGRATION TESTS"
description = "Run GraphQL integration tests"
command = "cargo"
env = { RUST_BACKTRACE = 1, RUST_LOG = { value = "cli_integration::common=debug", condition = { env_not_set = [
"RUST_LOG",
] } } }
args = [
"test",
"--locked",
"--features",
"storage-mem",
"--workspace",
"--test",
"graphql_integration",
"--",
"graphql_integration",
]
[tasks.ci-gql-integration]
category = "CI - INTEGRATION TESTS"
description = "Run GQL integration tests"
command = "cargo"
env = { RUST_BACKTRACE = 1, RUST_LOG = { value = "cli_integration::common=debug", condition = { env_not_set = [
"RUST_LOG",
] } } }
args = [
"test",
"--locked",
"--features",
"storage-mem",
"--workspace",
"--test",
"gql_integration",
"--",
"gql_integration",
]
[tasks.ci-integration-all]
category = "CI - INTEGRATION TESTS"
description = "Single compile: CLI, HTTP, WS, ML, GraphQL, and GQL integration suites"
command = "cargo"
env = { RUST_BACKTRACE = 1 }
args = [
"nextest",
"run",
"--locked",
"--workspace",
"--no-default-features",
"--features",
"storage-mem,storage-surrealkv,http,scripting,jwks,cli,ml,graphql,gql",
"--test",
"cli_integration",
"--test",
"http_integration",
"--test",
"ws_integration",
"--test",
"ml_integration",
"--test",
"graphql_integration",
"--test",
"gql_integration",
]
# --------------------------------------------------
# API tests
# --------------------------------------------------
[tasks.test-api-integration]
private = true
command = "cargo"
env = { RUST_BACKTRACE = 1 }
args = [
"nextest",
"run",
"--locked",
"--package",
"surrealdb",
"--no-default-features",
"--features",
"${_TEST_FEATURES}",
"--test",
"api",
"${@}",
]
[tasks.ci-api-integration]
private = true
env = { RUST_BACKTRACE = 1, _START_SURREALDB_PATH = "memory" }
run_task = { name = [
"start-surrealdb",
"test-api-integration",
"stop-surrealdb",
], fork = true }
[tasks.ci-api-integration-all]
category = "CI - INTEGRATION TESTS"
description = "Run all integration tests"
dependencies = [
"ci-api-integration-mem",
"ci-api-integration-rocksdb",
"ci-api-integration-surrealkv",
"ci-api-integration-tikv",
"ci-api-integration-http",
"ci-api-integration-ws",
"ci-api-integration-any",
]
#
# API tests with networked services
#
[tasks.ci-api-integration-any]
category = "CI - INTEGRATION TESTS"
description = "Run API integration tests with Any engine"
env = { _TEST_API_ENGINE = "any", _TEST_FEATURES = "protocol-http" }
run_task = "ci-api-integration"
[tasks.ci-api-integration-http]
category = "CI - INTEGRATION TESTS"
description = "Run API integration tests with the HTTP engine"
env = { _TEST_API_ENGINE = "http", _TEST_FEATURES = "protocol-http" }
run_task = "ci-api-integration"
[tasks.ci-api-integration-ws]
category = "CI - INTEGRATION TESTS"
description = "Run API integration tests with the WebSocket engine"
env = { _TEST_API_ENGINE = "ws", _TEST_FEATURES = "protocol-ws" }
run_task = "ci-api-integration"
#
# API tests with embedded services
#
[tasks.ci-api-integration-mem]
category = "CI - INTEGRATION TESTS"
description = "Run API integration tests with the in-memory engine"
env = { _TEST_API_ENGINE = "mem", _TEST_FEATURES = "kv-mem" }
run_task = { name = [
"test-api-integration",
], fork = true, parallel = true }
[tasks.ci-api-integration-rocksdb]
category = "CI - INTEGRATION TESTS"
description = "Run API integration tests with the RocksDB engine"
env = { _TEST_API_ENGINE = "rocksdb", _TEST_FEATURES = "kv-rocksdb" }
run_task = { name = [
"test-api-integration",
], fork = true, parallel = true }
[tasks.ci-api-integration-surrealkv]
category = "CI - INTEGRATION TESTS"
description = "Run API integration tests with the SurrealKV engine"
env = { _TEST_API_ENGINE = "surrealkv", _TEST_FEATURES = "kv-surrealkv" }
run_task = { name = [
"test-api-integration",
], fork = true, parallel = false }
[tasks.ci-api-integration-tikv]
category = "CI - INTEGRATION TESTS"
description = "Run API integration tests with the TiKV engine"
env = { _TEST_API_ENGINE = "tikv", _TEST_FEATURES = "kv-tikv" }
run_task = { name = [
"start-tikv",
"test-api-integration",
"stop-tikv",
], fork = true, parallel = false }
# --------------------------------------------------
# KVS tests
# --------------------------------------------------
[tasks.test-kvs]
private = true
command = "cargo"
env = { RUST_BACKTRACE = 1 }
args = [
"nextest",
"run",
"--locked",
"--package",
"surrealdb-core",
"--no-default-features",
"--features",
"${_TEST_FEATURES}",
"--lib",
"--",
"kvs::tests",
]
[tasks.ci-kvs-mem]
category = "CI - INTEGRATION TESTS"
description = "Run KVS integration tests with the in-memory engine"
env = { _TEST_API_ENGINE = "mem", _TEST_FEATURES = "kv-mem" }
run_task = { name = [
"test-kvs",
], fork = true, parallel = true }
[tasks.ci-kvs-rocksdb]
category = "CI - INTEGRATION TESTS"
description = "Run KVS integration tests with the RocksDB engine"
env = { _TEST_API_ENGINE = "file", _TEST_FEATURES = "kv-rocksdb" }
run_task = { name = [
"test-kvs",
], fork = true, parallel = true }
[tasks.ci-kvs-surrealkv]
category = "CI - INTEGRATION TESTS"
description = "Run KVS integration tests with the SurrealKV engine"
env = { _TEST_API_ENGINE = "surrealkv", _TEST_FEATURES = "kv-surrealkv" }
run_task = { name = [
"test-kvs",
], fork = true, parallel = false }
[tasks.ci-kvs-tikv]
category = "CI - INTEGRATION TESTS"
description = "Run KVS integration tests with the TiKV engine"
env = { _TEST_API_ENGINE = "tikv", _TEST_FEATURES = "kv-tikv" }
run_task = { name = [
"start-tikv",
"test-kvs",
"stop-tikv",
], fork = true, parallel = false }
# --------------------------------------------------
# Language tests
# --------------------------------------------------
[tasks.test-lang]
private = true
category = "CI - LANGUAGE TESTS"
description = "Run SurrealQL language tests with specified engine"
script = """
#!/bin/bash -ex
cd language-tests
if [ "${_TEST_LANG_FEATURES}" != "" ]; then
cargo build --features ${_TEST_LANG_FEATURES}
else
cargo build
fi
if [ "${_TEST_API_ENGINE}" = "tikv" ]; then
./target/debug/surrealql-test --color always run --no-wip --jobs 1 --backend ${_TEST_API_ENGINE}
else
./target/debug/surrealql-test --color always run --no-wip --jobs 12 --backend ${_TEST_API_ENGINE}
fi
"""
[tasks.ci-lang-test-all]
category = "CI - LANGUAGE TESTS"
description = "Run all language tests"
dependencies = [
"ci-lang-test-mem",
"ci-lang-test-rocksdb",
"ci-lang-test-surrealkv",
"ci-lang-test-tikv",
]
[tasks.ci-lang-test-mem]
category = "CI - LANGUAGE TESTS"
description = "Run SurrealQL language tests with the in-memory engine"
env = { _TEST_API_ENGINE = "memory", _TEST_LANG_FEATURES = "" }
run_task = { name = [
"test-lang",
], fork = true, parallel = true }
[tasks.ci-lang-test-rocksdb]
category = "CI - LANGUAGE TESTS"
description = "Run SurrealQL language tests with the RocksDB engine"
env = { _TEST_API_ENGINE = "rocksdb", _TEST_LANG_FEATURES = "backend-rocksdb" }
run_task = { name = [
"test-lang",
], fork = true, parallel = true }
[tasks.ci-lang-test-surrealkv]
category = "CI - LANGUAGE TESTS"
description = "Run SurrealQL language tests with the SurrealKV engine"
env = { _TEST_API_ENGINE = "surrealkv", _TEST_LANG_FEATURES = "backend-surrealkv" }
run_task = { name = [
"test-lang",
], fork = true, parallel = false }
[tasks.ci-lang-test-tikv]
category = "CI - LANGUAGE TESTS"
description = "Run SurrealQL language tests with the TiKV engine"
env = { _TEST_API_ENGINE = "tikv", _TEST_LANG_FEATURES = "backend-tikv" }
run_task = { name = [
"start-tikv",
"test-lang",
"stop-tikv",
], fork = true, parallel = false }
# --------------------------------------------------
# Language upgrade tests
# --------------------------------------------------
#
# These tasks drive the language-tests `upgrade` subcommand through the
# adjacent-pair chain defined in LANG_UPGRADE_VERSIONS. The runner spawns
# the from-version surreal binary, replays each test's imports, stops it,
# spawns the to-version binary against the same data directory, and runs
# the test query — catching any regression in how on-disk state is read.
#
# Binaries for tagged versions are downloaded from download.surrealdb.com
# into language-tests/.binary_cache/ (cached across CI runs). The trailing
# `..` token in the version list cargo-builds the current checkout.
[tasks.test-lang-upgrade]
private = true
category = "CI - LANGUAGE TESTS"
description = "Run SurrealQL language upgrade tests, hopping through adjacent version pairs"
script = """
#!/bin/bash -ex
# Override _TEST_LANG_UPGRADE_JOBS to tune per-runner concurrency (default 12).
cd language-tests
cargo build --features "${_TEST_LANG_FEATURES}"
IFS=',' read -ra V <<< "${LANG_UPGRADE_VERSIONS}"
for ((i=0; i<${#V[@]}-1; i++)); do
echo "=== Upgrade hop: ${V[$i]} -> ${V[$((i+1))]} (backend=${_TEST_API_ENGINE}) ==="
./target/debug/surrealql-test --color always upgrade \\
--from "${V[$i]}" --to "${V[$((i+1))]}" \\
--backend "${_TEST_API_ENGINE}" \\
--allow-download --no-wip \\
--jobs "${_TEST_LANG_UPGRADE_JOBS:-12}"
done
"""
[tasks.ci-lang-upgrade-test-surrealkv]
category = "CI - LANGUAGE TESTS"
description = "Run language upgrade tests with the SurrealKV backend"
env = { _TEST_API_ENGINE = "surrealkv", _TEST_LANG_FEATURES = "upgrade" }
run_task = "test-lang-upgrade"
[tasks.ci-lang-upgrade-test-rocksdb]
category = "CI - LANGUAGE TESTS"
description = "Run language upgrade tests with the RocksDB backend"
env = { _TEST_API_ENGINE = "rocksdb", _TEST_LANG_FEATURES = "upgrade,backend-rocksdb" }
run_task = "test-lang-upgrade"
[tasks.ci-lang-upgrade-test-all]
category = "CI - LANGUAGE TESTS"
description = "Run language upgrade tests on all supported backends"
dependencies = [
"ci-lang-upgrade-test-surrealkv",
"ci-lang-upgrade-test-rocksdb",
]
# --------------------------------------------------
# Workspace tests
# --------------------------------------------------
[tasks.ci-workspace-test]
category = "CI - WORKSPACE TESTS"
description = "Run workspace library tests"
command = "cargo"
args = [
"nextest",
"run",
"--locked",
"--no-default-features",
"--features",
"allocator,allocation-tracking,storage-mem,storage-rocksdb,scripting,http,jwks,surrealism,gql",
"--workspace",
"--exclude", "demo",
"--exclude", "surrealdb-profiling",
"--",
"--skip", "api_integration",
"--skip", "cli_integration",
"--skip", "http_integration",
"--skip", "ws_integration",
"--skip", "ml_integration",
"--skip", "graphql_integration",
"--skip", "gql_integration",
"--skip", "database_upgrade",
]
# --------------------------------------------------
# Workspace tests
# --------------------------------------------------
[tasks.ci-workspace-full]
category = "CI - WORKSPACE TESTS"
description = "Run full workspace tests"
command = "cargo"
args = [
"nextest",
"run",
"--locked",
"--no-default-features",
"--features",
"allocator,allocation-tracking,storage-mem,scripting,http,jwks,cli,graphql,gql",
"--workspace",
]
[tasks.ci-workspace-full-with-server]
env = { _START_SURREALDB_PATH = "memory" }
category = "CI - WORKSPACE TESTS"
description = "Run full workspace tests, with a local SurrealDB server"
run_task = { name = [
"start-surrealdb",
"ci-workspace-full",
"stop-surrealdb",
], fork = true }
# --------------------------------------------------
# Coverage checks
# --------------------------------------------------
[tasks.ci-workspace-coverage]
category = "CI - WORKSPACE TESTS"
description = "Run full workspace tests with code coverage"
command = "cargo"
env = { LLVM_PROFILE_FILE = "target/llvm-cov-target/%p-%m.profraw" }
args = [
"llvm-cov",
"nextest",
"--lcov",
"--output-path",
"lcov.info",
"--locked",
"--no-default-features",
"--features",
"allocator,allocation-tracking,storage-mem,scripting,http,jwks",
"--workspace",
# Exclude surrealism packages due to wasmtime complexity and stdin loops
"--exclude", "surrealism-runtime",
"--exclude", "surrealism",
"--exclude", "surrealism-macros",
"--exclude", "surrealism-types",
"--exclude", "demo",
]
[tasks.ci-workspace-coverage-with-server]
env = { _START_SURREALDB_PATH = "memory" }
category = "CI - WORKSPACE TESTS"
description = "Run full workspace tests with code coverage, and a local SurrealDB server"
run_task = { name = [
"start-surrealdb",
"ci-workspace-coverage",
"stop-surrealdb",
], fork = true }
[tasks.ci-lang-test-coverage]
category = "CI - COVERAGE"
description = "Run language tests with code coverage for core crates"
script = """
#!/bin/bash -ex
cd language-tests
# Set up LLVM coverage instrumentation environment
eval "$(cargo llvm-cov show-env --export-prefix)"
# Clean previous coverage artifacts
cargo llvm-cov clean --workspace
# Build language-tests with instrumentation
cargo build
# Run the language tests (this exercises surrealdb-core)
./target/debug/surrealql-test --color always run --no-wip --jobs 3 --backend memory
# Generate coverage report, excluding the harness code
cargo llvm-cov report \
--lcov \
--output-path ../language-tests-lcov.info \
--ignore-filename-regex 'language-tests/src/'
"""
# --------------------------------------------------
# Services
# --------------------------------------------------
[tasks.build-surrealdb]
category = "CI - BUILD"
private = true
command = "cargo"
args = [
"build",
"--locked",
"--no-default-features",
"--features",
"storage-mem",
]
[tasks.start-surrealdb]
category = "CI - SERVICES"
description = "Start a local SurrealDB server"
dependencies = ["build-surrealdb"]
script = """
#!/bin/bash -ex
target/debug/surreal start ${_START_SURREALDB_PATH} --allow-all --deny-guests &>/tmp/surrealdb-${_TEST_API_ENGINE}.log &
echo $! > /tmp/surreal-${_TEST_API_ENGINE}.pid
set +e
echo "Waiting for surreal to be ready..."
tries=0
while [[ $tries < 5 ]]; do
target/debug/surreal is-ready 2>/dev/null && echo "Ready!" && exit 0 || sleep 1
tries=$((tries + 1))
done
echo "ERROR: Surreal is unhealthy!"
exit 1
"""
[tasks.stop-surrealdb]
category = "CI - SERVICES"
description = "Stop the local SurrealDB server"
script = """
#!/bin/bash -ex
kill $(cat /tmp/surreal-${_TEST_API_ENGINE}.pid) || true
sleep 5
kill -9 $(cat /tmp/surreal-${_TEST_API_ENGINE}.pid) || true
"""
[tasks.start-tikv]
category = "CI - SERVICES"
description = "Start a local TiKV playground"
script = """
#!/bin/bash -ex
echo "Installing TiKV playground..."
${HOME}/.tiup/bin/tiup install pd tikv playground
echo "Cleaning TiKV playground..."
${HOME}/.tiup/bin/tiup clean --all
killall -q tiup-playground || true
rm -rf ${HOME}/.tiup/data/testing
echo "Starting TiKV playground..."
nohup ${HOME}/.tiup/bin/tiup playground --mode tikv-slim --kv 1 --pd 1 --db 0 --ticdc 0 --tiflash 0 --without-monitor --tag "testing" > /tmp/tiup.log &
set +e
tries=0
echo "Waiting for TiKV playground to start..."
while [[ $tries -lt 5 ]]; do
sleep 5
echo "Displaying playground status..."
if ! ${HOME}/.tiup/bin/tiup playground display >/dev/null; then
tries=$((tries + 1));
continue
fi
exit 0;
done
echo "PANIC: Couldn't start TiKV playground! Here are the logs for the last attempt:"
cat /tmp/tiup.log
exit 1
"""
[tasks.stop-tikv]
category = "CI - SERVICES"
description = "Stop the local TiKV playground"
script = """
#!/bin/bash -ex
echo "Cleaning TiKV playground..."
${HOME}/.tiup/bin/tiup clean --all
killall -q tiup-playground || true
rm -rf ${HOME}/.tiup/data/testing
set +e
tries=0
echo "Waiting for TiKV playground to stop..."
while [[ $tries -lt 5 ]]; do
sleep 5
echo "Displaying playground status..."
if ${HOME}/.tiup/bin/tiup playground display >/dev/null; then
tries=$((tries + 1));
continue
fi
exit 0;
done
echo "PANIC: Couldn't stop TiKV playground! Here are the logs for the last attempt:"
cat /tmp/tiup.log
exit 1
"""
# --------------------------------------------------
# Benchmarks
# --------------------------------------------------
[tasks.ci-bench]
category = "CI - BENCHMARK"
description = "Run SurrealDB benchmarks"
command = "cargo"
args = [
"bench",
"--quiet",
"--package",
"surrealdb",
"--no-default-features",
"--features",
"kv-mem,scripting,http,jwks",
"${@}",
]
[tasks.bench-target]
private = true
category = "CI - BENCHMARK"
command = "cargo"
args = [
"bench",
"--package",
"surrealdb",
"--bench",
"sdb",
"--no-default-features",
"--features",
"${BENCH_FEATURES}",
"${@}",
]
[tasks.bench-lib-mem]
category = "CI - BENCHMARK"
description = "Run library benchmarks with the in-memory engine"
env = { BENCH_DATASTORE_TARGET = "lib-mem" }
run_task = { name = ["bench-target"] }
[tasks.bench-lib-rocksdb]
category = "CI - BENCHMARK"
description = "Run library benchmarks with the RocksDB engine"
env = { BENCH_DATASTORE_TARGET = "lib-rocksdb" }
run_task = { name = ["bench-target"] }
[tasks.bench-lib-surrealkv]
category = "CI - BENCHMARK"
description = "Run library benchmarks with the SurrealKV engine"
env = { BENCH_DATASTORE_TARGET = "lib-surrealkv" }
run_task = { name = ["bench-target"] }
[tasks.bench-sdk-mem]
category = "CI - BENCHMARK"
description = "Run SDK benchmarks with the in-memory engine"
env = { BENCH_DATASTORE_TARGET = "sdk-mem" }
run_task = { name = ["bench-target"] }
[tasks.bench-sdk-rocksdb]
category = "CI - BENCHMARK"
description = "Run SDK benchmarks with the RocksDB engine"
env = { BENCH_DATASTORE_TARGET = "sdk-rocksdb" }
run_task = { name = ["bench-target"] }
[tasks.bench-sdk-surrealkv]
category = "CI - BENCHMARK"
description = "Run SDK benchmarks with the SurrealKV engine"
env = { BENCH_DATASTORE_TARGET = "sdk-surrealkv" }