@@ -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]
@@ -98,10 +102,6 @@ jobs:
98102 cd $env:USERPROFILE\emsdk
99103 .\emsdk install 4.0.21
100104 .\emsdk activate 4.0.21
101- # Add emscripten to PATH for subsequent steps and subprocesses
102- $emsdkPath = "$env:USERPROFILE\emsdk\upstream\emscripten"
103- Add-Content -Path $env:GITHUB_PATH -Value $emsdkPath
104- Write-Host "Added $emsdkPath to PATH"
105105
106106 - name : Install psql (Windows)
107107 if : runner.os == 'Windows'
@@ -338,24 +338,8 @@ jobs:
338338 - uses : dsherret/rust-toolchain-file@v1
339339 - name : Set default rust toolchain
340340 run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
341- - name : Set up Python env
342- run : |
343- test -d venv || python3 -m venv venv
344- venv/bin/pip3 install argparse toml
345341 - name : Run checks
346- run : |
347- set -ueo pipefail
348- FAILED=0
349- ROOTS=(spacetimedb spacetimedb-sdk)
350- CRATES=$(venv/bin/python3 tools/find-publish-list.py --recursive --directories --quiet "${ROOTS[@]}")
351- for crate_dir in $CRATES; do
352- if ! venv/bin/python3 tools/crate-publish-checks.py "${crate_dir}"; then
353- FAILED=$(( $FAILED + 1 ))
354- fi
355- done
356- if [ $FAILED -gt 0 ]; then
357- exit 1
358- fi
342+ run : cargo ci publish-checks
359343
360344 update :
361345 name : Test spacetimedb-update flow (${{ matrix.target }})
@@ -385,28 +369,10 @@ jobs:
385369 shell : bash
386370 run : sudo apt install -y libssl-dev
387371
388- - name : Build spacetimedb-update
389- run : cargo build --features github-token-auth --target ${{ matrix.target }} -p spacetimedb-update
390- if : runner.os == 'Windows'
391-
392- - name : Run self-install
393- env :
394- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
395- shell : bash
396- run : |
397- ROOT_DIR="$(mktemp -d)"
398- # NOTE(bfops): We need the `github-token-auth` feature because we otherwise tend to get ratelimited when we try to fetch `/releases/latest`.
399- # 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
400- # happens very frequently on the `macos-runner`, but we haven't seen it on any others).
401- cargo run --features github-token-auth --target ${{ matrix.target }} -p spacetimedb-update -- self-install --root-dir="${ROOT_DIR}" --yes
402- "${ROOT_DIR}"/spacetime --root-dir="${ROOT_DIR}" help
403- if : runner.os == 'Windows'
404-
405372 - name : Test spacetimedb-update
406373 env :
407374 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
408375 run : cargo ci update-flow --target=${{ matrix.target }} --github-token-auth
409- if : runner.os != 'Windows'
410376
411377 unreal_engine_tests :
412378 name : Unreal Engine Tests
@@ -1143,3 +1109,151 @@ jobs:
11431109 - name : Verify crates/smoketests/tests/smoketests/mod.rs lists all entries
11441110 run : |
11451111 cargo ci smoketests check-mod-list
1112+
1113+ docs-build :
1114+ name : Docs build
1115+ runs-on : spacetimedb-new-runner-2
1116+ steps :
1117+ - name : Checkout repository
1118+ uses : actions/checkout@v3
1119+
1120+ - name : Set up Node.js
1121+ uses : actions/setup-node@v3
1122+ with :
1123+ node-version : ' 22'
1124+
1125+ - uses : pnpm/action-setup@v4
1126+ with :
1127+ run_install : true
1128+
1129+ - name : Get pnpm store directory
1130+ working-directory : sdks/typescript
1131+ shell : bash
1132+ run : |
1133+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
1134+
1135+ - uses : actions/cache@v4
1136+ name : Setup pnpm cache
1137+ with :
1138+ path : ${{ env.STORE_PATH }}
1139+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
1140+ restore-keys : |
1141+ ${{ runner.os }}-pnpm-store-
1142+
1143+ - uses : dsherret/rust-toolchain-file@v1
1144+ - name : Set default rust toolchain
1145+ run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
1146+
1147+ - name : Docusaurus build
1148+ run : cargo ci docs
1149+
1150+ typescript-test :
1151+ name : TypeScript - Tests
1152+ runs-on : spacetimedb-new-runner-2
1153+ steps :
1154+ - name : Checkout repository
1155+ uses : actions/checkout@v4
1156+
1157+ - name : Set up Node.js
1158+ uses : actions/setup-node@v4
1159+ with :
1160+ node-version : 22
1161+
1162+ - uses : pnpm/action-setup@v4
1163+ with :
1164+ run_install : true
1165+
1166+ - name : Get pnpm store directory
1167+ shell : bash
1168+ working-directory : crates/bindings-typescript
1169+ run : |
1170+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
1171+
1172+ - uses : actions/cache@v4
1173+ name : Setup pnpm cache
1174+ with :
1175+ path : ${{ env.STORE_PATH }}
1176+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
1177+ restore-keys : |
1178+ ${{ runner.os }}-pnpm-store-
1179+
1180+ # - name: Extract SpacetimeDB branch name from file
1181+ # id: extract-branch
1182+ # run: |
1183+ # # Define the path to the branch file
1184+ # BRANCH_FILE=".github/spacetimedb-branch.txt"
1185+
1186+ # # Default to master if file doesn't exist
1187+ # if [ ! -f "$BRANCH_FILE" ]; then
1188+ # echo "::notice::No SpacetimeDB branch file found, using 'master'"
1189+ # echo "branch=master" >> $GITHUB_OUTPUT
1190+ # exit 0
1191+ # fi
1192+
1193+ # # Read and trim whitespace from the file
1194+ # branch=$(cat "$BRANCH_FILE" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
1195+
1196+ # # Fallback to master if empty
1197+ # if [ -z "$branch" ]; then
1198+ # echo "::warning::SpacetimeDB branch file is empty, using 'master'"
1199+ # branch="master"
1200+ # fi
1201+
1202+ # echo "branch=$branch" >> $GITHUB_OUTPUT
1203+ # echo "Using SpacetimeDB branch from file: $branch"
1204+
1205+ - name : Install Rust toolchain
1206+ uses : dsherret/rust-toolchain-file@v1
1207+ - name : Set default rust toolchain
1208+ run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
1209+
1210+ - name : Cache Rust dependencies
1211+ uses : Swatinem/rust-cache@v2
1212+ with :
1213+ workspaces : ${{ github.workspace }}
1214+ shared-key : spacetimedb
1215+ # Let the main CI job save the cache since it builds the most things
1216+ save-if : false
1217+ prefix-key : v1
1218+
1219+ # # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a.
1220+ # # ChatGPT suspects that this could be due to different build invocations using the same target dir,
1221+ # # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with
1222+ # # `cargo build --manifest-path` (which apparently build different dependency trees).
1223+ # # However, we've been unable to fix it so... /shrug
1224+ # - name: Check v8 outputs
1225+ # run: |
1226+ # find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true
1227+ # if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then
1228+ # echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
1229+ # cargo clean -p v8 || true
1230+ # cargo build -p v8
1231+ # fi
1232+ # if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then
1233+ # echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
1234+ # cargo clean --release -p v8 || true
1235+ # cargo build --release -p v8
1236+ # fi
1237+
1238+ # - name: Install SpacetimeDB CLI from the local checkout
1239+ # run: |
1240+ # export CARGO_HOME="$HOME/.cargo"
1241+ # echo "$CARGO_HOME/bin" >> "$GITHUB_PATH"
1242+ # cargo install --force --path crates/cli --locked --message-format=short
1243+ # cargo install --force --path crates/standalone --locked --message-format=short
1244+ # # Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
1245+ # ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime
1246+ # # Clear any existing information
1247+ # spacetime server clear -y
1248+
1249+ - name : Run TypeScript tests
1250+ run : cargo ci typescript-test
1251+
1252+ # - name: Run quickstart-chat tests
1253+ # working-directory: examples/quickstart-chat
1254+ # run: pnpm test
1255+ #
1256+ # # Run this step always, even if the previous steps fail
1257+ # - name: Print rows in the user table
1258+ # if: always()
1259+ # run: spacetime sql quickstart-chat "SELECT * FROM user"
0 commit comments