CI - Merge xtask-smoketest into cargo ci smoketests (#4185)

# Description of Changes

Just merging two CI packages into one.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- [x] CI passes
- [x] `cargo ci smoketests prepare` still just builds the binaries

---------

Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: = <cloutiertyler@gmail.com>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
This commit is contained in:
Zeke Foppa
2026-02-05 16:17:06 -08:00
committed by GitHub
parent 34a7645ff7
commit 21cf6afe54
7 changed files with 61 additions and 85 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ rustflags = ["--cfg", "tokio_unstable"]
bump-versions = "run -p upgrade-version --"
llm = "run --package xtask-llm-benchmark --bin llm_benchmark --"
ci = "run -p ci --"
smoketest = "run -p xtask-smoketest -- smoketest"
smoketest = "ci smoketests --"
smoketests = "smoketest"
[target.x86_64-pc-windows-msvc]
Generated
-8
View File
@@ -11085,14 +11085,6 @@ dependencies = [
"urlencoding",
]
[[package]]
name = "xtask-smoketest"
version = "0.1.0"
dependencies = [
"anyhow",
"clap 4.5.50",
]
[[package]]
name = "xxhash-rust"
version = "0.8.15"
-1
View File
@@ -61,7 +61,6 @@ members = [
"tools/generate-client-api",
"tools/gen-bindings",
"tools/xtask-llm-benchmark",
"tools/xtask-smoketest",
"crates/bindings-typescript/test-app/server",
"crates/bindings-typescript/test-react-router-app/server",
"crates/query-builder",
+33 -2
View File
@@ -93,14 +93,45 @@ Executes the smoketests suite with some default exclusions.
**Usage:**
```bash
Usage: smoketests [ARGS]...
Usage: smoketests [OPTIONS] [ARGS]... [COMMAND]
```
**Options:**
- `args`: Additional arguments to pass to the smoketests runner. These are usually set by the CI environment, such as `-- --docker`
- `--server`: Run tests against a remote server instead of spawning local servers.
When specified, tests will connect to the given URL instead of starting local server instances. Tests that require local server control (like restart tests) will be skipped.
- `--dotnet`:
- `args`:
- `--help`: Print help (see a summary with '-h')
#### `prepare`
Only build binaries without running tests
Use this before running `cargo test --all` to ensure binaries are built.
**Usage:**
```bash
Usage: prepare
```
**Options:**
- `--help`: Print help (see a summary with '-h')
#### `help`
**Usage:**
```bash
Usage: help [COMMAND]...
```
**Options:**
- `subcommand`:
### `update-flow`
Tests the update flow
+4 -20
View File
@@ -11,6 +11,7 @@ use std::{env, fs};
const README_PATH: &str = "tools/ci/README.md";
mod ci_docs;
mod smoketest;
/// SpacetimeDB CI tasks
///
@@ -236,13 +237,7 @@ enum CiCmd {
/// Runs smoketests
///
/// Executes the smoketests suite with some default exclusions.
Smoketests {
#[arg(
trailing_var_arg = true,
long_help = "Additional arguments to pass to the smoketests runner. These are usually set by the CI environment, such as `-- --docker`"
)]
args: Vec<String>,
},
Smoketests(smoketest::SmoketestsArgs),
/// Tests the update flow
///
/// Tests the self-update flow by building the spacetimedb-update binary for the specified
@@ -481,19 +476,8 @@ fn main() -> Result<()> {
.run()?;
}
Some(CiCmd::Smoketests { args: smoketest_args }) => {
// Use cargo smoketest (alias for xtask-smoketest) which handles:
// - Building binaries first (prevents race conditions)
// - Building precompiled modules
// - Using nextest if available, falling back to cargo test
// - Running in release mode with optimal parallelism
cmd(
"cargo",
["smoketest", "--"]
.into_iter()
.chain(smoketest_args.iter().map(|s| s.as_str()).clone()),
)
.run()?;
Some(CiCmd::Smoketests(args)) => {
smoketest::run(args)?;
}
Some(CiCmd::UpdateFlow {
@@ -1,44 +1,32 @@
#![allow(clippy::disallowed_macros)]
use anyhow::{ensure, Result};
use clap::{Parser, Subcommand};
use clap::{Args, Subcommand};
use std::env;
use std::process::{Command, Stdio};
/// SpacetimeDB development tasks
#[derive(Parser)]
#[command(name = "cargo xtask")]
struct Cli {
#[derive(Args)]
/// This command first builds the spacetimedb-cli and spacetimedb-standalone binaries,
/// then runs the smoketests. This prevents race conditions when running tests in parallel
/// with nextest, where multiple test processes might try to build the same binaries
/// simultaneously.
pub struct SmoketestsArgs {
#[command(subcommand)]
cmd: XtaskCmd,
}
cmd: Option<SmoketestCmd>,
#[derive(Subcommand)]
enum XtaskCmd {
/// Run smoketests with pre-built binaries
/// Run tests against a remote server instead of spawning local servers.
///
/// This command first builds the spacetimedb-cli and spacetimedb-standalone binaries,
/// then runs the smoketests. This prevents race conditions when running tests in parallel
/// with nextest, where multiple test processes might try to build the same binaries
/// simultaneously.
Smoketest {
#[command(subcommand)]
cmd: Option<SmoketestCmd>,
/// When specified, tests will connect to the given URL instead of starting
/// local server instances. Tests that require local server control (like
/// restart tests) will be skipped.
#[arg(long)]
server: Option<String>,
/// Run tests against a remote server instead of spawning local servers.
///
/// When specified, tests will connect to the given URL instead of starting
/// local server instances. Tests that require local server control (like
/// restart tests) will be skipped.
#[arg(long)]
server: Option<String>,
#[arg(long, default_value_t = true, action = clap::ArgAction::Set)]
dotnet: bool,
#[arg(long, default_value_t = true, action = clap::ArgAction::Set)]
dotnet: bool,
/// Additional arguments to pass to the test runner
#[arg(trailing_var_arg = true)]
args: Vec<String>,
},
/// Additional arguments to pass to the test runner
#[arg(trailing_var_arg = true)]
args: Vec<String>,
}
#[derive(Subcommand)]
@@ -49,24 +37,14 @@ enum SmoketestCmd {
Prepare,
}
fn main() -> Result<()> {
let cli = Cli::parse();
match cli.cmd {
XtaskCmd::Smoketest {
cmd: Some(SmoketestCmd::Prepare),
..
} => {
pub fn run(args: SmoketestsArgs) -> Result<()> {
match args.cmd {
Some(SmoketestCmd::Prepare) => {
build_binaries()?;
eprintln!("Binaries ready. You can now run `cargo test --all`.");
Ok(())
}
XtaskCmd::Smoketest {
cmd: None,
server,
args,
dotnet: use_dotnet,
} => run_smoketest(server, use_dotnet, args),
None => run_smoketest(args.server, args.dotnet, args.args),
}
}
-8
View File
@@ -1,8 +0,0 @@
[package]
name = "xtask-smoketest"
version = "0.1.0"
edition.workspace = true
[dependencies]
anyhow.workspace = true
clap.workspace = true