9f97f0bc48
Co-authored-by: Mees Delzenne <mees.delzenne@gmail.com> Co-authored-by: Gerard Guillemas Martos <gguillemas@users.noreply.github.com>
332 lines
12 KiB
TOML
332 lines
12 KiB
TOML
[tasks.ci-format]
|
|
category = "CI - CHECK"
|
|
dependencies = ["cargo-fmt", "cargo-fmt-unlinked"]
|
|
|
|
[tasks.ci-check]
|
|
category = "CI - CHECK"
|
|
command = "cargo"
|
|
args = ["check", "--locked", "--workspace"]
|
|
|
|
[tasks.ci-check-wasm]
|
|
category = "CI - CHECK"
|
|
command = "cargo"
|
|
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = ["check", "--locked", "--package", "surrealdb", "--features", "protocol-ws,protocol-http,kv-mem,kv-indxdb,http,jwks", "--target", "wasm32-unknown-unknown"]
|
|
|
|
[tasks.ci-clippy]
|
|
category = "CI - CHECK"
|
|
command = "cargo"
|
|
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = ["clippy", "--all-targets", "--features", "storage-mem,storage-rocksdb,storage-speedb,storage-tikv,storage-fdb,scripting,http,jwks", "--tests", "--benches", "--examples", "--bins", "--", "-D", "warnings"]
|
|
|
|
#
|
|
# Integration Tests
|
|
#
|
|
|
|
[tasks.ci-cli-integration]
|
|
category = "CI - INTEGRATION TESTS"
|
|
command = "cargo"
|
|
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable", 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", "--workspace", "--test", "cli_integration", "--", "cli_integration"]
|
|
|
|
[tasks.ci-http-integration]
|
|
category = "CI - INTEGRATION TESTS"
|
|
command = "cargo"
|
|
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable", RUST_LOG = { value = "http_integration=debug", condition = { env_not_set = ["RUST_LOG"] } } }
|
|
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem,http-compression,jwks", "--workspace", "--test", "http_integration", "--", "http_integration"]
|
|
|
|
[tasks.ci-ws-integration]
|
|
category = "WS - INTEGRATION TESTS"
|
|
command = "cargo"
|
|
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable", 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 = "ML - INTEGRATION TESTS"
|
|
command = "cargo"
|
|
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable", 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", "--nocapture"]
|
|
|
|
[tasks.ci-workspace-coverage]
|
|
category = "CI - INTEGRATION TESTS"
|
|
command = "cargo"
|
|
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = [
|
|
"llvm-cov", "--html", "--locked", "--no-default-features", "--features", "storage-mem,scripting,http,jwks", "--workspace", "--",
|
|
"--skip", "api_integration",
|
|
"--skip", "cli_integration",
|
|
"--skip", "http_integration",
|
|
"--skip", "ws_integration",
|
|
"--skip", "database_upgrade"
|
|
]
|
|
|
|
[tasks.test-workspace-coverage-complete]
|
|
category = "CI - INTEGRATION TESTS"
|
|
command = "cargo"
|
|
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = ["llvm-cov", "--html", "--locked", "--no-default-features", "--features", "protocol-ws,protocol-http,kv-mem,kv-rocksdb", "--workspace"]
|
|
|
|
[tasks.ci-workspace-coverage-complete]
|
|
env = { _START_SURREALDB_PATH = "memory" }
|
|
category = "CI - INTEGRATION TESTS"
|
|
run_task = { name = ["start-surrealdb", "test-workspace-coverage-complete", "stop-surrealdb"], fork = true }
|
|
|
|
[tasks.ci-database-upgrade]
|
|
env = { _TEST_FEATURES = "storage-rocksdb" }
|
|
category = "CI - DATABASE UPGRADE TESTS"
|
|
run_task = { name = ["test-database-upgrade"], fork = true }
|
|
|
|
#
|
|
# Tests private tasks
|
|
#
|
|
|
|
[tasks.test-kvs]
|
|
private = true
|
|
command = "cargo"
|
|
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = ["test", "--locked", "--package", "surrealdb", "--no-default-features", "--features", "${_TEST_FEATURES}", "--lib", "kvs"]
|
|
|
|
|
|
[tasks.test-api-integration]
|
|
private = true
|
|
command = "cargo"
|
|
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = ["test", "--locked", "--package", "surrealdb", "--no-default-features", "--features", "${_TEST_FEATURES}", "--test", "api", "api_integration::${_TEST_API_ENGINE}"]
|
|
|
|
[tasks.ci-api-integration]
|
|
env = { RUST_BACKTRACE = 1, _START_SURREALDB_PATH = "memory", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
private = true
|
|
run_task = { name = ["start-surrealdb", "test-api-integration", "stop-surrealdb"], fork = true }
|
|
|
|
[tasks.test-database-upgrade]
|
|
private = true
|
|
command = "cargo"
|
|
env = { RUST_BACKTRACE = 1, RUST_LOG = "info", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = ["test", "--locked", "--no-default-features", "--features", "${_TEST_FEATURES}", "--workspace", "--test", "database_upgrade", "--", "database_upgrade", "--show-output"]
|
|
|
|
|
|
#
|
|
# Integration tests with background services
|
|
#
|
|
|
|
[tasks.ci-api-integration-http]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "http", _TEST_FEATURES = "protocol-http", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
run_task = "ci-api-integration"
|
|
|
|
[tasks.ci-api-integration-ws]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "ws", _TEST_FEATURES = "protocol-ws", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
run_task = "ci-api-integration"
|
|
|
|
[tasks.ci-api-integration-any]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "any", _TEST_FEATURES = "protocol-http", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
run_task = "ci-api-integration"
|
|
|
|
#
|
|
# Integration tests without background services
|
|
#
|
|
[tasks.ci-api-integration-mem]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "mem", _TEST_FEATURES = "kv-mem" }
|
|
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = true }
|
|
|
|
[tasks.ci-api-integration-file]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "file", _TEST_FEATURES = "kv-rocksdb" }
|
|
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = true }
|
|
|
|
[tasks.ci-api-integration-rocksdb]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "rocksdb", _TEST_FEATURES = "kv-rocksdb" }
|
|
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = true }
|
|
|
|
[tasks.ci-api-integration-speedb]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "speedb", _TEST_FEATURES = "kv-speedb" }
|
|
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = true }
|
|
|
|
[tasks.ci-api-integration-fdb]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "fdb", _TEST_FEATURES = "kv-fdb-7_1" }
|
|
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = false }
|
|
|
|
[tasks.ci-api-integration-surrealkv]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "surrealkv", _TEST_FEATURES = "kv-surrealkv" }
|
|
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = false }
|
|
|
|
[tasks.ci-api-integration-tikv]
|
|
category = "CI - INTEGRATION TESTS"
|
|
env = { _TEST_API_ENGINE = "tikv", _TEST_FEATURES = "kv-tikv" }
|
|
run_task = { name = ["start-tikv", "test-kvs", "test-api-integration", "stop-tikv"], fork = true, parallel = false }
|
|
|
|
|
|
#
|
|
# Services
|
|
#
|
|
[tasks.start-surrealdb]
|
|
category = "CI - SERVICES"
|
|
dependencies = ["build-surrealdb"]
|
|
script = """
|
|
#!/bin/bash -ex
|
|
|
|
|
|
target/debug/surreal start ${_START_SURREALDB_PATH} --allow-all &>/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"
|
|
script = """
|
|
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"
|
|
env = { SURREAL_LINK = "https://github.com/surrealdb/surrealdb/releases/download/v1.2.0/surreal-v1.2.0.linux-amd64.tgz" }
|
|
script = """
|
|
#!/bin/bash -ex
|
|
|
|
if [ ! -f "/tmp/test_surreal" ]; then
|
|
echo "Downloading surrealdb for startup test"
|
|
curl -L $SURREAL_LINK | tar -xzO > /tmp/test_surreal
|
|
chmod +x /tmp/test_surreal
|
|
fi
|
|
|
|
${HOME}/.tiup/bin/tiup install pd tikv playground
|
|
|
|
playground_attempts=0
|
|
while [[ $playground_attempts -lt 5 ]]; do
|
|
nohup ${HOME}/.tiup/bin/tiup playground --mode tikv-slim --kv 1 --pd 1 --db 0 --ticdc 0 --tiflash 0 --without-monitor > /tmp/tiup.log &
|
|
|
|
echo $! > /tmp/tiup.pid
|
|
|
|
set +e
|
|
echo "Waiting for tiup playground to be ready..."
|
|
tries=0
|
|
while [[ $tries -lt 10 ]]; do
|
|
if ! ${HOME}/.tiup/bin/tiup playground display >/dev/null; then
|
|
tries=$((tries + 1));
|
|
sleep 5;
|
|
continue
|
|
fi
|
|
if echo "create __tikv_test_thing" | /tmp/test_surreal sql --hide-welcome --endpoint tikv://127.0.0.1:2379 > /dev/null; then
|
|
echo "TIKV started correctly";
|
|
exit 0;
|
|
fi
|
|
sleep 5;
|
|
tries=$((tries + 1))
|
|
done
|
|
set -e
|
|
|
|
echo "ERROR: TiUP Playground is unhealthy! Try again..."
|
|
${HOME}/.tiup/bin/tiup clean --all
|
|
|
|
|
|
playground_attempts=$((playground_attempts + 1))
|
|
done
|
|
|
|
echo "PANIC: Couldn't start tiup playground! Here are the logs for the last attempt:"
|
|
cat /tmp/tiup.log
|
|
|
|
exit 1
|
|
"""
|
|
|
|
[tasks.stop-tikv]
|
|
category = "CI - SERVICES"
|
|
script = """
|
|
${HOME}/.tiup/bin/tiup clean --all
|
|
"""
|
|
|
|
#
|
|
# Builds
|
|
#
|
|
|
|
[tasks.build-surrealdb]
|
|
category = "CI - BUILD"
|
|
command = "cargo"
|
|
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = ["build", "--locked", "--no-default-features", "--features", "storage-mem"]
|
|
|
|
#
|
|
# Benchmarks - Common
|
|
#
|
|
[tasks.ci-bench]
|
|
category = "CI - BENCHMARK"
|
|
command = "cargo"
|
|
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = ["bench", "--quiet", "--package", "surrealdb", "--no-default-features", "--features", "kv-mem,scripting,http,jwks", "${@}"]
|
|
|
|
#
|
|
# Benchmarks - SDB - Per Target
|
|
#
|
|
[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-fdb-7_1,kv-surrealkv", condition = { env_not_set = ["BENCH_FEATURES"] } }
|
|
RUSTFLAGS = "--cfg surrealdb_unstable"
|
|
|
|
[tasks.bench-target]
|
|
private = true
|
|
category = "CI - BENCHMARK - SurrealDB Target"
|
|
command = "cargo"
|
|
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
|
args = ["bench", "--package", "surrealdb", "--bench", "sdb", "--no-default-features", "--features", "${BENCH_FEATURES}", "${@}"]
|
|
|
|
[tasks.bench-lib-mem]
|
|
category = "CI - BENCHMARK - SurrealDB Target"
|
|
env = { BENCH_DATASTORE_TARGET = "lib-mem" }
|
|
run_task = { name = ["bench-target"] }
|
|
|
|
[tasks.bench-lib-rocksdb]
|
|
category = "CI - BENCHMARK - SurrealDB Target"
|
|
env = { BENCH_DATASTORE_TARGET = "lib-rocksdb" }
|
|
run_task = { name = ["bench-target"] }
|
|
|
|
[tasks.bench-lib-fdb]
|
|
category = "CI - BENCHMARK - SurrealDB Target"
|
|
env = { BENCH_DATASTORE_TARGET = "lib-fdb" }
|
|
run_task = { name = ["bench-target"] }
|
|
|
|
[tasks.bench-sdk-mem]
|
|
category = "CI - BENCHMARK - SurrealDB Target"
|
|
env = { BENCH_DATASTORE_TARGET = "sdk-mem" }
|
|
run_task = { name = ["bench-target"] }
|
|
|
|
[tasks.bench-sdk-rocksdb]
|
|
category = "CI - BENCHMARK - SurrealDB Target"
|
|
env = { BENCH_DATASTORE_TARGET = "sdk-rocksdb" }
|
|
run_task = { name = ["bench-target"] }
|
|
|
|
[tasks.bench-sdk-fdb]
|
|
category = "CI - BENCHMARK - SurrealDB Target"
|
|
env = { BENCH_DATASTORE_TARGET = "sdk-fdb" }
|
|
run_task = { name = ["bench-target"] }
|
|
|
|
[tasks.bench-sdk-ws]
|
|
category = "CI - BENCHMARK - SurrealDB Target"
|
|
env = { BENCH_DATASTORE_TARGET = "sdk-ws" }
|
|
run_task = { name = ["bench-target"] }
|
|
|
|
[tasks.bench-lib-surrealkv]
|
|
category = "CI - BENCHMARK - SurrealDB Target"
|
|
env = { BENCH_DATASTORE_TARGET = "lib-surrealkv" }
|
|
run_task = { name = ["bench-target"] }
|