Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
601ce51
[bfops/ci-caching]: CI - Cache more of our build outputs
bfops Oct 28, 2025
818bdf0
[bfops/ci-caching]: empty commit to bump CI
bfops Oct 28, 2025
85fd6f9
[bfops/ci-caching]: empty commit to bump CI
bfops Oct 28, 2025
20bfe62
[bfops/ci-caching]: empty commit to bump CI
bfops Oct 28, 2025
fa1b9ca
[bfops/ci-caching]: try simpler run
bfops Nov 12, 2025
643ff44
[bfops/ci-caching]: env vars in other workflows
bfops Nov 12, 2025
0a0e222
[bfops/ci-caching]: try cache refactor
bfops Nov 12, 2025
644d5b1
[bfops/ci-caching]: docker slim
bfops Nov 12, 2025
de21a67
[bfops/ci-caching]: back to docker
bfops Nov 12, 2025
0bdfd34
[bfops/ci-caching]: Merge remote-tracking branch 'origin/master' into…
bfops Nov 12, 2025
6a4391f
[bfops/ci-caching]: slim
bfops Nov 13, 2025
db4f1a7
[bfops/ci-caching]: slimmer
bfops Nov 13, 2025
f5e5c06
[bfops/ci-caching]: update correct dockerfile
bfops Nov 13, 2025
bea3a3e
[bfops/ci-caching]: fix
bfops Nov 13, 2025
18f280d
[bfops/ci-caching]: slim down
bfops Nov 13, 2025
3b5e57d
[bfops/ci-caching]: reduce ci
bfops Nov 13, 2025
3adead2
[bfops/ci-caching]: debugging
bfops Nov 13, 2025
bb4aff8
[bfops/ci-caching]: output
bfops Nov 13, 2025
f2d184b
[bfops/ci-caching]: reduce
bfops Nov 13, 2025
beb7dbc
[bfops/ci-caching]: more
bfops Nov 13, 2025
04d575d
[bfops/ci-caching]: fix
bfops Nov 13, 2025
b468015
[bfops/ci-caching]: confusing
bfops Nov 13, 2025
bf00263
[bfops/ci-caching]: maybe
bfops Nov 13, 2025
58c284c
[bfops/ci-caching]: review
bfops Nov 13, 2025
ce882d4
[bfops/ci-caching]: review
bfops Nov 13, 2025
06d5417
[bfops/ci-caching]: maybe?
bfops Nov 13, 2025
7568036
[bfops/ci-caching]: more
bfops Nov 13, 2025
139f853
[bfops/ci-caching]: debug
bfops Nov 13, 2025
1e4f47f
[bfops/ci-caching]: more
bfops Nov 13, 2025
e3efd65
[bfops/ci-caching]: no ignore
bfops Nov 13, 2025
e3afbda
[bfops/ci-caching]: reduce
bfops Nov 13, 2025
22eaec5
[bfops/ci-caching]: remove volume
bfops Nov 13, 2025
7aa773b
[bfops/ci-caching]: fix
bfops Nov 13, 2025
7742d30
[bfops/ci-caching]: logs
bfops Nov 13, 2025
ee08d47
[bfops/ci-caching]: WIP
bfops Nov 13, 2025
d3bb169
[bfops/ci-caching]: update
bfops Nov 13, 2025
0a75792
[bfops/ci-caching]: fix
bfops Nov 13, 2025
dbc13c5
[bfops/ci-caching]: absolute
bfops Nov 13, 2025
2b37cc1
[bfops/ci-caching]: update
bfops Nov 13, 2025
359e55c
[bfops/ci-caching]: cache more
bfops Nov 13, 2025
d167bc0
[bfops/ci-caching]: empty commit to bump CI
bfops Nov 13, 2025
a910289
[bfops/ci-caching]: restore
bfops Nov 14, 2025
6a32b0a
[bfops/ci-caching]: fix target dir
bfops Nov 14, 2025
905892c
[bfops/ci-caching]: tweak
bfops Nov 14, 2025
7b9ea8c
[bfops/ci-caching]: review
bfops Nov 14, 2025
729aff5
[bfops/ci-caching]: stop caching for test spacetimedb-update because …
bfops Nov 14, 2025
c8d92cc
[bfops/ci-caching]: empty
bfops Nov 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
**/target
# we do our own version pinning in the Dockerfile
rust-toolchain.toml
53 changes: 52 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
- { runner: windows-latest, smoketest_args: --no-build-cli }
runner: [ spacetimedb-runner, windows-latest ]
runs-on: ${{ matrix.runner }}
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Find Git ref
env:
Expand All @@ -45,6 +47,15 @@ jobs:
with:
ref: ${{ env.GIT_REF }}
- uses: dsherret/rust-toolchain-file@v1
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ github.workspace }}
shared-key: spacetimedb
cache-on-failure: true
cache-all-crates: true
cache-workspace-crates: true

- uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
Expand All @@ -63,6 +74,8 @@ jobs:
if: runner.os == 'Windows'
run: choco install psql -y --no-progress
shell: powershell
- name: Build crates
run: cargo build -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
- name: Build and start database (Linux)
if: runner.os == 'Linux'
run: docker compose up -d
Expand All @@ -73,7 +86,6 @@ jobs:
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true

cargo build -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
Start-Process target/debug/spacetimedb-cli.exe -ArgumentList 'start --pg-port 5432'
cd modules
# the sdk-manifests on windows-latest are messed up, so we need to update them
Expand All @@ -94,6 +106,8 @@ jobs:
test:
name: Test Suite
runs-on: spacetimedb-runner
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Find Git ref
env:
Expand All @@ -113,6 +127,13 @@ jobs:
ref: ${{ env.GIT_REF }}

- uses: dsherret/rust-toolchain-file@v1
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ github.workspace }}
shared-key: spacetimedb
# Let the smoketests job save the cache since it builds the most things
save-if: false

- uses: actions/setup-dotnet@v3
with:
Expand Down Expand Up @@ -158,13 +179,23 @@ jobs:
lints:
name: Lints
runs-on: spacetimedb-runner
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Checkout sources
uses: actions/checkout@v3

- uses: dsherret/rust-toolchain-file@v1
- run: echo ::add-matcher::.github/workflows/rust_matcher.json

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ github.workspace }}
shared-key: spacetimedb
# Let the smoketests job save the cache since it builds the most things
save-if: false

- uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
Expand Down Expand Up @@ -197,12 +228,22 @@ jobs:
wasm_bindings:
name: Build and test wasm bindings
runs-on: spacetimedb-runner
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
steps:
- uses: actions/checkout@v3

- uses: dsherret/rust-toolchain-file@v1
- run: echo ::add-matcher::.github/workflows/rust_matcher.json

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ github.workspace }}
shared-key: spacetimedb
# Let the smoketests job save the cache since it builds the most things
save-if: false

- name: Run bindgen tests
run: cargo test -p spacetimedb-codegen

Expand Down Expand Up @@ -374,6 +415,8 @@ jobs:
name: Check CLI docs
permissions: read-all
runs-on: ubuntu-latest
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Find Git ref
env:
Expand Down Expand Up @@ -417,6 +460,14 @@ jobs:

- uses: dsherret/rust-toolchain-file@v1

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ github.workspace }}
shared-key: spacetimedb
# Let the smoketests job save the cache since it builds the most things
save-if: false

- name: Check for docs change
run: |
cargo run --features markdown-docs -p spacetimedb-cli > docs/docs/cli-reference.md
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/csharp-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
group: unity-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
timeout-minutes: 30
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Checkout repository
id: checkout-stdb
Expand Down Expand Up @@ -65,26 +67,18 @@ jobs:

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
id: cache-rust-deps
with:
workspaces: demo/Blackholio/server-rust
key: ${{ steps.checkout-stdb.outputs.commit }}
# Cache Rust deps even if unit tests have failed.
cache-on-failure: true
# Cache the CLI as well.
cache-all-crates: true
workspaces: ${{ github.workspace }}
shared-key: spacetimedb
# Let the main CI job save the cache since it builds the most things
save-if: false

- name: Install SpacetimeDB CLI from the local checkout
# Rebuild only if we didn't get a precise cache hit.
if: steps.cache-rust-deps.outputs.cache-hit == 'false'
run: |
cargo install --force --path crates/cli --locked --message-format=short
cargo install --force --path crates/standalone --locked --message-format=short
# Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
ln -sf $HOME/.cargo/bin/spacetimedb-cli $HOME/.cargo/bin/spacetime
env:
# Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice.
CARGO_TARGET_DIR: demo/Blackholio/server-rust/target

- name: Check quickstart-chat bindings are up to date
working-directory: sdks/csharp
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/typescript-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ concurrency:
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target

steps:
- name: Checkout repository
Expand Down Expand Up @@ -81,10 +83,10 @@ jobs:
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
modules/quickstart-chat
shared-key: quickstart-chat-test
workspaces: ${{ github.workspace }}
shared-key: spacetimedb
# Let the main CI job save the cache since it builds the most things
save-if: false

- name: Install SpacetimeDB CLI from the local checkout
run: |
Expand Down
65 changes: 0 additions & 65 deletions Dockerfile

This file was deleted.

45 changes: 4 additions & 41 deletions crates/standalone/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,7 @@
ARG CARGO_PROFILE=release


FROM rust:1.90.0 AS chef
RUN rust_target=$(rustc -vV | awk '/^host:/{ print $2 }') && \
curl https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$rust_target.tgz -fL | tar xz -C $CARGO_HOME/bin
RUN cargo binstall -y cargo-chef@0.1.70
WORKDIR /usr/src/app

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder

RUN cargo binstall -y cargo-watch@8.4.0
RUN cargo binstall -y flamegraph@0.6.2

COPY --from=planner /usr/src/app/recipe.json .

ENV CARGO_INCREMENTAL=0

ARG CARGO_PROFILE=release

RUN cargo chef cook -p spacetimedb-standalone --profile=${CARGO_PROFILE}

COPY . .
RUN cargo build -p spacetimedb-standalone --profile=${CARGO_PROFILE} --locked

FROM builder as env-dev
RUN mkdir -p /stdb/data && ln -s /usr/src/app/crates/standalone/config.toml /stdb/data/config.toml
ENV PATH="/usr/src/app/target/debug:${PATH}"

FROM debian as env-release
RUN apt-get update && \
apt-get install -y ca-certificates libssl-dev && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/src/app/target/release/spacetimedb-standalone /usr/local/bin/
COPY --from=builder /usr/src/app/crates/standalone/config.toml /stdb/data/config.toml

FROM env-${CARGO_PROFILE}
FROM rust:1.90.0
RUN mkdir -p /stdb/data
COPY ./target/debug/spacetimedb-standalone ./target/debug/spacetimedb-cli /usr/local/bin/
COPY ./crates/standalone/config.toml /stdb/data/config.toml

EXPOSE 3000

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
- "5432:5432"
# Tracy
- "8086:8086"
entrypoint: cargo watch -i flamegraphs -i log.conf --why -C crates/standalone -x 'run start --data-dir=/stdb/data --jwt-pub-key-path=/etc/spacetimedb/id_ecdsa.pub --jwt-priv-key-path=/etc/spacetimedb/id_ecdsa --pg-port 5432'
entrypoint: spacetimedb-standalone start --data-dir=/stdb/data --jwt-pub-key-path=/etc/spacetimedb/id_ecdsa.pub --jwt-priv-key-path=/etc/spacetimedb/id_ecdsa --pg-port 5432
privileged: true
environment:
SPACETIMEDB_FLAMEGRAPH_PATH: ../../../../flamegraphs/flamegraph.folded
Expand Down
Loading