Files
SpacetimeDB/tools/ci/README.md
Ryan 1fd3394972 Add cargo ci dlls command for building C# DLLs and NuGet packages (#4033)
# Description of Changes
* Added a new `cargo ci dlls` subcommand to build/pack the in-repo C#
NuGet packages and the C# SDK.
* `cargo ci dlls` restores `sdks/csharp/SpacetimeDB.ClientSDK.csproj`
using the freshly built local package outputs as to populate
`sdks/csharp/packages/**`.
* Added a Unity `.meta` skeleton under
`sdks/csharp/unity-meta-skeleton~/**` and overlays those `.meta` files
onto the latest restored versioned package directory to keep Unity GUIDs
stable and import settings consistent.
* Unity-specific import fixes are captured in the skeleton overlay
(notably: preventing Unity from importing incompatible TFMs like
`net8.0`, and marking analyzer DLLs with the `RoslynAnalyzer` label so
Unity can recognize them).
# How to use (local)
```bash
# Build/pack + restore local packages into sdks/csharp/packages/**
cargo ci dlls
```
# API and ABI breaking changes
N/A
# Expected complexity level and risk
2 - Local developer tooling + file overlay into restore output; no
runtime/SDK API behavior changes.
# Testing
- [x] `cargo check -p ci`
- [x] Ran `cargo ci dlls` and verified the output under
`sdks/csharp/packages/**` and the various NuGet package locations.
- [x] Tested a Unity project importing the SpacetimeDB SDK after
generating output and confirmed no errors.

---------

Signed-off-by: Ryan <r.ekhoff@clockworklabs.io>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
2026-01-22 18:26:55 +00:00

163 lines
3.6 KiB
Markdown

# 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:**
```bash
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:**
```bash
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:**
```bash
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:**
```bash
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:**
```bash
Usage: dlls
```
**Options:**
- `--help`: Print help (see a summary with '-h')
### `smoketests`
Runs smoketests
Executes the smoketests suite with some default exclusions.
**Usage:**
```bash
Usage: smoketests [ARGS]...
```
**Options:**
- `args`: Additional arguments to pass to the smoketests runner. These are usually set by the CI environment, such as `-- --docker`
- `--help`: Print help (see a summary with '-h')
### `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:**
```bash
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:**
```bash
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:**
```bash
Usage: self-docs [OPTIONS]
```
**Options:**
- `--check`: Only check for changes, do not generate the docs
- `--help`: Print help (see a summary with '-h')
### `help`
**Usage:**
```bash
Usage: help [COMMAND]...
```
**Options:**
- `subcommand`:
---
This document is auto-generated by running:
```bash
cargo ci self-docs
```