@@ -17,6 +17,10 @@ concurrency:
1717 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.inputs.pr_number || format('sha-{0}', github.sha) }}
1818 cancel-in-progress : true
1919
20+ permissions :
21+ contents : read
22+ pull-requests : read
23+
2024jobs :
2125 smoketests :
2226 needs : [lints]
@@ -175,13 +179,6 @@ jobs:
175179 }
176180 cargo ci smoketests -- --test-threads=1
177181
178- - name : Check for changes
179- run : |
180- tools/check-diff.sh crates/smoketests || {
181- echo 'Error: There is a diff in the smoketests directory.'
182- exit 1
183- }
184-
185182 test :
186183 needs : [lints]
187184 name : Test Suite
@@ -266,10 +263,6 @@ jobs:
266263
267264 wasm-bindgen --version
268265
269- - name : Build typescript module sdk
270- working-directory : crates/bindings-typescript
271- run : pnpm build
272-
273266 # Source emsdk environment to make emcc (Emscripten compiler) available in PATH.
274267 - name : Run tests
275268 run : |
@@ -303,6 +296,15 @@ jobs:
303296 with :
304297 global-json-file : global.json
305298
299+ - name : Set up Node.js
300+ uses : actions/setup-node@v4
301+ with :
302+ node-version : 22
303+
304+ - uses : pnpm/action-setup@v4
305+ with :
306+ run_install : true
307+
306308 - name : Run ci lint
307309 run : cargo ci lint
308310
@@ -340,24 +342,8 @@ jobs:
340342 - uses : dsherret/rust-toolchain-file@v1
341343 - name : Set default rust toolchain
342344 run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
343- - name : Set up Python env
344- run : |
345- test -d venv || python3 -m venv venv
346- venv/bin/pip3 install argparse toml
347345 - name : Run checks
348- run : |
349- set -ueo pipefail
350- FAILED=0
351- ROOTS=(spacetimedb spacetimedb-sdk)
352- CRATES=$(venv/bin/python3 tools/find-publish-list.py --recursive --directories --quiet "${ROOTS[@]}")
353- for crate_dir in $CRATES; do
354- if ! venv/bin/python3 tools/crate-publish-checks.py "${crate_dir}"; then
355- FAILED=$(( $FAILED + 1 ))
356- fi
357- done
358- if [ $FAILED -gt 0 ]; then
359- exit 1
360- fi
346+ run : cargo ci publish-checks
361347
362348 update :
363349 name : Test spacetimedb-update flow (${{ matrix.target }})
@@ -387,28 +373,10 @@ jobs:
387373 shell : bash
388374 run : sudo apt install -y libssl-dev
389375
390- - name : Build spacetimedb-update
391- run : cargo build --features github-token-auth --target ${{ matrix.target }} -p spacetimedb-update
392- if : runner.os == 'Windows'
393-
394- - name : Run self-install
395- env :
396- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
397- shell : bash
398- run : |
399- ROOT_DIR="$(mktemp -d)"
400- # NOTE(bfops): We need the `github-token-auth` feature because we otherwise tend to get ratelimited when we try to fetch `/releases/latest`.
401- # My best guess is that, on the GitHub runners, the "anonymous" ratelimit is shared by *all* users of that runner (I think this because it
402- # happens very frequently on the `macos-runner`, but we haven't seen it on any others).
403- cargo run --features github-token-auth --target ${{ matrix.target }} -p spacetimedb-update -- self-install --root-dir="${ROOT_DIR}" --yes
404- "${ROOT_DIR}"/spacetime --root-dir="${ROOT_DIR}" help
405- if : runner.os == 'Windows'
406-
407376 - name : Test spacetimedb-update
408377 env :
409378 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
410379 run : cargo ci update-flow --target=${{ matrix.target }} --github-token-auth
411- if : runner.os != 'Windows'
412380
413381 unreal_engine_tests :
414382 name : Unreal Engine Tests
@@ -1145,3 +1113,151 @@ jobs:
11451113 - name : Verify crates/smoketests/tests/smoketests/mod.rs lists all entries
11461114 run : |
11471115 cargo ci smoketests check-mod-list
1116+
1117+ docs-build :
1118+ name : Docs build
1119+ runs-on : spacetimedb-new-runner-2
1120+ steps :
1121+ - name : Checkout repository
1122+ uses : actions/checkout@v3
1123+
1124+ - name : Set up Node.js
1125+ uses : actions/setup-node@v3
1126+ with :
1127+ node-version : ' 22'
1128+
1129+ - uses : pnpm/action-setup@v4
1130+ with :
1131+ run_install : true
1132+
1133+ - name : Get pnpm store directory
1134+ working-directory : sdks/typescript
1135+ shell : bash
1136+ run : |
1137+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
1138+
1139+ - uses : actions/cache@v4
1140+ name : Setup pnpm cache
1141+ with :
1142+ path : ${{ env.STORE_PATH }}
1143+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
1144+ restore-keys : |
1145+ ${{ runner.os }}-pnpm-store-
1146+
1147+ - uses : dsherret/rust-toolchain-file@v1
1148+ - name : Set default rust toolchain
1149+ run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
1150+
1151+ - name : Docusaurus build
1152+ run : cargo ci docs
1153+
1154+ typescript-test :
1155+ name : TypeScript - Tests
1156+ runs-on : spacetimedb-new-runner-2
1157+ steps :
1158+ - name : Checkout repository
1159+ uses : actions/checkout@v4
1160+
1161+ - name : Set up Node.js
1162+ uses : actions/setup-node@v4
1163+ with :
1164+ node-version : 22
1165+
1166+ - uses : pnpm/action-setup@v4
1167+ with :
1168+ run_install : true
1169+
1170+ - name : Get pnpm store directory
1171+ shell : bash
1172+ working-directory : crates/bindings-typescript
1173+ run : |
1174+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
1175+
1176+ - uses : actions/cache@v4
1177+ name : Setup pnpm cache
1178+ with :
1179+ path : ${{ env.STORE_PATH }}
1180+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
1181+ restore-keys : |
1182+ ${{ runner.os }}-pnpm-store-
1183+
1184+ # - name: Extract SpacetimeDB branch name from file
1185+ # id: extract-branch
1186+ # run: |
1187+ # # Define the path to the branch file
1188+ # BRANCH_FILE=".github/spacetimedb-branch.txt"
1189+
1190+ # # Default to master if file doesn't exist
1191+ # if [ ! -f "$BRANCH_FILE" ]; then
1192+ # echo "::notice::No SpacetimeDB branch file found, using 'master'"
1193+ # echo "branch=master" >> $GITHUB_OUTPUT
1194+ # exit 0
1195+ # fi
1196+
1197+ # # Read and trim whitespace from the file
1198+ # branch=$(cat "$BRANCH_FILE" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
1199+
1200+ # # Fallback to master if empty
1201+ # if [ -z "$branch" ]; then
1202+ # echo "::warning::SpacetimeDB branch file is empty, using 'master'"
1203+ # branch="master"
1204+ # fi
1205+
1206+ # echo "branch=$branch" >> $GITHUB_OUTPUT
1207+ # echo "Using SpacetimeDB branch from file: $branch"
1208+
1209+ - name : Install Rust toolchain
1210+ uses : dsherret/rust-toolchain-file@v1
1211+ - name : Set default rust toolchain
1212+ run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
1213+
1214+ - name : Cache Rust dependencies
1215+ uses : Swatinem/rust-cache@v2
1216+ with :
1217+ workspaces : ${{ github.workspace }}
1218+ shared-key : spacetimedb
1219+ # Let the main CI job save the cache since it builds the most things
1220+ save-if : false
1221+ prefix-key : v1
1222+
1223+ # # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a.
1224+ # # ChatGPT suspects that this could be due to different build invocations using the same target dir,
1225+ # # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with
1226+ # # `cargo build --manifest-path` (which apparently build different dependency trees).
1227+ # # However, we've been unable to fix it so... /shrug
1228+ # - name: Check v8 outputs
1229+ # run: |
1230+ # find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true
1231+ # if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then
1232+ # echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
1233+ # cargo clean -p v8 || true
1234+ # cargo build -p v8
1235+ # fi
1236+ # if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then
1237+ # echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
1238+ # cargo clean --release -p v8 || true
1239+ # cargo build --release -p v8
1240+ # fi
1241+
1242+ # - name: Install SpacetimeDB CLI from the local checkout
1243+ # run: |
1244+ # export CARGO_HOME="$HOME/.cargo"
1245+ # echo "$CARGO_HOME/bin" >> "$GITHUB_PATH"
1246+ # cargo install --force --path crates/cli --locked --message-format=short
1247+ # cargo install --force --path crates/standalone --locked --message-format=short
1248+ # # Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
1249+ # ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime
1250+ # # Clear any existing information
1251+ # spacetime server clear -y
1252+
1253+ - name : Run TypeScript tests
1254+ run : cargo ci typescript-test
1255+
1256+ # - name: Run quickstart-chat tests
1257+ # working-directory: examples/quickstart-chat
1258+ # run: pnpm test
1259+ #
1260+ # # Run this step always, even if the previous steps fail
1261+ # - name: Print rows in the user table
1262+ # if: always()
1263+ # run: spacetime sql quickstart-chat "SELECT * FROM user"
0 commit comments