surrealpatch/Makefile.ci.toml

241 lines
7.4 KiB
TOML
Raw Normal View History

[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"
args = ["check", "--locked", "--package", "surrealdb", "--features", "protocol-ws,protocol-http,kv-mem,kv-indxdb,http", "--target", "wasm32-unknown-unknown"]
[tasks.ci-clippy]
category = "CI - CHECK"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
#
# Integration Tests
#
[tasks.ci-cli-integration]
category = "CI - INTEGRATION TESTS"
command = "cargo"
env = { RUST_LOG = "cli_integration=debug" }
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem", "--workspace", "--test", "cli_integration", "--", "--nocapture"]
[tasks.ci-http-integration]
category = "CI - INTEGRATION TESTS"
command = "cargo"
env = { RUST_LOG = "http_integration=debug" }
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem", "--workspace", "--test", "http_integration", "--", "--nocapture"]
[tasks.ci-ws-integration]
category = "CI - INTEGRATION TESTS"
command = "cargo"
env = { RUST_LOG = "ws_integration=debug" }
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem", "--workspace", "--test", "ws_integration", "--", "--nocapture"]
[tasks.ci-workspace-coverage]
category = "CI - INTEGRATION TESTS"
command = "cargo"
args = [
"llvm-cov", "--html", "--locked", "--no-default-features", "--features", "storage-mem,scripting,http", "--workspace", "--",
"--skip", "api_integration",
"--skip", "cli_integration",
"--skip", "http_integration",
"--skip", "ws_integration"
]
[tasks.test-workspace-coverage-complete]
category = "CI - INTEGRATION TESTS"
command = "cargo"
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 }
#
# Tests private tasks
#
[tasks.test-kvs]
private = true
command = "cargo"
args = ["test", "--locked", "--package", "surrealdb", "--no-default-features", "--features", "${_TEST_FEATURES}", "--lib", "kvs"]
[tasks.test-api-integration]
private = true
command = "cargo"
args = ["test", "--locked", "--package", "surrealdb", "--no-default-features", "--features", "${_TEST_FEATURES}", "--test", "api", "api_integration::${_TEST_API_ENGINE}"]
[tasks.ci-api-integration]
env = { _START_SURREALDB_PATH = "fdb:/etc/foundationdb/fdb.cluster" }
private = true
run_task = { name = ["start-surrealdb", "test-api-integration", "stop-surrealdb"], fork = true }
#
# Integration tests with background services
#
[tasks.ci-api-integration-http]
category = "CI - INTEGRATION TESTS"
env = { _TEST_API_ENGINE = "http", _TEST_FEATURES = "protocol-http" }
run_task = "ci-api-integration"
[tasks.ci-api-integration-ws]
category = "CI - INTEGRATION TESTS"
env = { _TEST_API_ENGINE = "ws", _TEST_FEATURES = "protocol-ws" }
run_task = "ci-api-integration"
[tasks.ci-api-integration-any]
category = "CI - INTEGRATION TESTS"
env = { _TEST_API_ENGINE = "any", _TEST_FEATURES = "protocol-http" }
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-tikv-tests]
category = "CI - INTEGRATION TESTS"
env = { _TEST_API_ENGINE = "tikv", _TEST_FEATURES = "kv-tikv" }
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = false }
[tasks.ci-api-integration-tikv]
category = "CI - INTEGRATION TESTS"
run_task = { name = ["start-tikv", "ci-api-integration-tikv-tests", "stop-tikv"], fork = true }
#
# Services
#
[tasks.start-surrealdb]
category = "CI - SERVICES"
dependencies = ["build-surrealdb"]
script = """
#!/bin/bash -ex
target/debug/surreal start ${_START_SURREALDB_PATH} &>/tmp/surrealdb.log &
echo $! > /tmp/surreal.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.pid) || true
sleep 5
kill -9 $(cat /tmp/surreal.pid) || true
"""
[tasks.start-tikv]
category = "CI - SERVICES"
script = """
#!/bin/bash -ex
${HOME}/.tiup/bin/tiup install pd tikv playground
${HOME}/.tiup/bin/tiup playground --mode tikv-slim --kv 3 --without-monitor &>/tmp/tiup.log &
echo $! > /tmp/tiup.pid
set +e
echo "Waiting for tiup playground to be ready..."
tries=0
while [[ $tries < 10 ]]; do
${HOME}/.tiup/bin/tiup playground display >/dev/null && echo "Ready!" && exit 0 || sleep 5
tries=$((tries + 1))
done
set -e
echo "ERROR: TiUP Playground is unhealthy!"
exit 1
"""
[tasks.stop-tikv]
category = "CI - SERVICES"
script = "kill $(cat /tmp/tiup.pid) || true"
#
# Builds
#
[tasks.build-surrealdb]
category = "CI - BUILD"
command = "cargo"
args = ["build", "--locked", "--no-default-features", "--features", "storage-mem,storage-fdb"]
#
# Benchmarks
#
[tasks.bench-run-baseline]
category = "CI - BENCHMARK"
command = "cargo"
args = ["bench", "--quiet", "--package", "surrealdb", "--no-default-features", "--features", "kv-mem,scripting,http", "--", "--save-baseline", "baseline"]
[tasks.bench-save-baseline]
category = "CI - BENCHMARK"
script = "cp -r target/criterion /tmp/criterion"
[tasks.bench-restore-baseline]
category = "CI - BENCHMARK"
script = "mkdir -p target && cp -r /tmp/criterion target/criterion"
[tasks.bench-baseline]
category = "CI - BENCHMARK"
run_task = { name = ["bench-run-baseline", "bench-save-baseline"] }
[tasks.bench-run-changes]
category = "CI - BENCHMARK"
command = "cargo"
args = ["bench", "--quiet", "--package", "surrealdb", "--no-default-features", "--features", "kv-mem,scripting,http", "--", "--save-baseline", "changes"]
[tasks.bench-changes]
category = "CI - BENCHMARK"
run_task = { name = ["bench-restore-baseline", "bench-run-changes"] }
[tasks.bench-compare]
category = "CI - BENCHMARK"
script = "critcmp baseline changes | tee benchmark_results"