Zeke Foppa 6d9cf691f2
CI - rustfmt instead of cargo fmt (#4595)
# Description of Changes

`cargo ci lint` was running `cargo fmt`, but that didn't pick up all
files. As a result, our pre-commit hook (which just runs `rustfmt` on
any changed `.rs` files) would change otherwise-untouched files in merge
commits.

This PR addresses that discrepancy by having `cargo ci lint` run
`rustfmt` on all tracked `.rs` files.

The entire diff is just `rustfmt` changes except for the changes in
`tools/ci/src/main.rs`.

# API and ABI breaking changes

<!-- If this is an API or ABI breaking change, please apply the
corresponding GitHub label. -->

# Expected complexity level and risk

2

# Testing

- [x] `cargo ci lint` fails
- [x] `cargo ci lint` passes after running `rustfmt` on everything
- [x] `cargo fmt --all` doesn't cause any diff after doing the above

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-03-10 05:58:54 +00:00
..
2025-12-17 17:34:49 +00:00

SpacetimeDB's cargo ci

Overview

This document provides an overview of the cargo ci command-line tool, and documentation for each of its subcommands and options.

cargo ci

SpacetimeDB CI tasks

This tool provides several subcommands for automating CI workflows in SpacetimeDB.

It may be invoked via cargo ci <subcommand>, or simply cargo ci to run all subcommands in sequence. It is mostly designed to be run in CI environments via the github workflows, but can also be run locally

Usage:

Usage: cargo ci [OPTIONS] [COMMAND]

Options:

  • --skip: Skip specified subcommands when running all

When no subcommand is specified, all subcommands are run in sequence. This option allows specifying subcommands to skip when running all. For example, to skip the unreal-tests subcommand, use --skip unreal-tests.

  • --help: Print help (see a summary with '-h')

test

Runs tests

Runs rust tests, codegens csharp sdk and runs csharp tests. This does not include Unreal tests. This expects to run in a clean git state.

Usage:

Usage: test

Options:

  • --help: Print help (see a summary with '-h')

lint

Lints the codebase

Runs rustfmt, clippy, csharpier and generates rust docs to ensure there are no warnings.

Usage:

Usage: lint

Options:

  • --help: Print help (see a summary with '-h')

wasm-bindings

Tests Wasm bindings

Runs tests for the codegen crate and builds a test module with the wasm bindings.

Usage:

Usage: wasm-bindings

Options:

  • --help: Print help (see a summary with '-h')

dlls

Builds and packs C# DLLs and NuGet packages for local Unity workflows

Packs the in-repo C# NuGet packages and restores the C# SDK to populate sdks/csharp/packages/**. Then overlays Unity .meta skeleton files from sdks/csharp/unity-meta-skeleton~/** onto the restored versioned package directory, so Unity can associate stable meta files with the most recently built package.

Usage:

Usage: dlls

Options:

  • --help: Print help (see a summary with '-h')

smoketests

Runs smoketests

Executes the smoketests suite with some default exclusions.

Usage:

Usage: smoketests [OPTIONS] [ARGS]... [COMMAND]

Options:

  • --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:

Usage: prepare

Options:

  • --help: Print help (see a summary with '-h')

check-mod-list

Usage:

Usage: check-mod-list

Options:

  • --help:

help

Usage:

Usage: help [COMMAND]...

Options:

  • subcommand:

update-flow

Tests the update flow

Tests the self-update flow by building the spacetimedb-update binary for the specified target, by default the current target, and performing a self-install into a temporary directory.

Usage:

Usage: update-flow [OPTIONS]

Options:

  • --target: Target triple to build for, by default the current target. Used by github workflows to check the update flow on multiple platforms.
  • --github-token-auth: Whether to enable github token authentication feature when building the update binary. By default this is disabled.
  • --help: Print help (see a summary with '-h')

cli-docs

Usage:

Usage: cli-docs [OPTIONS]

Options:

  • --spacetime-path: specify a custom path to the SpacetimeDB repository root (where the main Cargo.toml is located)
  • --help: Print help (see a summary with '-h')

self-docs

Usage:

Usage: self-docs [OPTIONS]

Options:

  • --check: Only check for changes, do not generate the docs
  • --help: Print help (see a summary with '-h')

global-json-policy

Usage:

Usage: global-json-policy

Options:

  • --help:

help

Usage:

Usage: help [COMMAND]...

Options:

  • subcommand:

This document is auto-generated by running:

cargo ci self-docs