@@ -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]
2731 - name : Linux
2832 runner : spacetimedb-new-runner-2
2933 - name : Windows
30- runner : windows-latest
34+ runner : spacetimedb- windows-runner
3135 runs-on : ${{ matrix.runner }}
3236 timeout-minutes : 120
3337 env :
@@ -171,13 +175,6 @@ jobs:
171175 }
172176 cargo ci smoketests -- --test-threads=1
173177
174- - name : Check for changes
175- run : |
176- tools/check-diff.sh crates/smoketests || {
177- echo 'Error: There is a diff in the smoketests directory.'
178- exit 1
179- }
180-
181178 test :
182179 needs : [lints]
183180 name : Test Suite
@@ -262,10 +259,6 @@ jobs:
262259
263260 wasm-bindgen --version
264261
265- - name : Build typescript module sdk
266- working-directory : crates/bindings-typescript
267- run : pnpm build
268-
269262 # Source emsdk environment to make emcc (Emscripten compiler) available in PATH.
270263 - name : Run tests
271264 run : |
@@ -299,6 +292,15 @@ jobs:
299292 with :
300293 global-json-file : global.json
301294
295+ - name : Set up Node.js
296+ uses : actions/setup-node@v4
297+ with :
298+ node-version : 22
299+
300+ - uses : pnpm/action-setup@v4
301+ with :
302+ run_install : true
303+
302304 - name : Run ci lint
303305 run : cargo ci lint
304306
@@ -336,24 +338,8 @@ jobs:
336338 - uses : dsherret/rust-toolchain-file@v1
337339 - name : Set default rust toolchain
338340 run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
339- - name : Set up Python env
340- run : |
341- test -d venv || python3 -m venv venv
342- venv/bin/pip3 install argparse toml
343341 - name : Run checks
344- run : |
345- set -ueo pipefail
346- FAILED=0
347- ROOTS=(spacetimedb spacetimedb-sdk)
348- CRATES=$(venv/bin/python3 tools/find-publish-list.py --recursive --directories --quiet "${ROOTS[@]}")
349- for crate_dir in $CRATES; do
350- if ! venv/bin/python3 tools/crate-publish-checks.py "${crate_dir}"; then
351- FAILED=$(( $FAILED + 1 ))
352- fi
353- done
354- if [ $FAILED -gt 0 ]; then
355- exit 1
356- fi
342+ run : cargo ci publish-checks
357343
358344 update :
359345 name : Test spacetimedb-update flow (${{ matrix.target }})
@@ -383,28 +369,10 @@ jobs:
383369 shell : bash
384370 run : sudo apt install -y libssl-dev
385371
386- - name : Build spacetimedb-update
387- run : cargo build --features github-token-auth --target ${{ matrix.target }} -p spacetimedb-update
388- if : runner.os == 'Windows'
389-
390- - name : Run self-install
391- env :
392- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
393- shell : bash
394- run : |
395- ROOT_DIR="$(mktemp -d)"
396- # NOTE(bfops): We need the `github-token-auth` feature because we otherwise tend to get ratelimited when we try to fetch `/releases/latest`.
397- # 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
398- # happens very frequently on the `macos-runner`, but we haven't seen it on any others).
399- cargo run --features github-token-auth --target ${{ matrix.target }} -p spacetimedb-update -- self-install --root-dir="${ROOT_DIR}" --yes
400- "${ROOT_DIR}"/spacetime --root-dir="${ROOT_DIR}" help
401- if : runner.os == 'Windows'
402-
403372 - name : Test spacetimedb-update
404373 env :
405374 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
406375 run : cargo ci update-flow --target=${{ matrix.target }} --github-token-auth
407- if : runner.os != 'Windows'
408376
409377 unreal_engine_tests :
410378 name : Unreal Engine Tests
@@ -919,15 +887,16 @@ jobs:
919887 const targetRepo = process.env.TARGET_REPO;
920888 // Use the ref for pull requests because the head sha is brittle (github does some extra dance where it merges in master).
921889 const publicRef = (context.eventName === 'pull_request') ? context.payload.pull_request.head.ref : context.sha;
890+ const publicPrNumber = context.payload.pull_request?.number ?? context.payload.inputs?.pr_number;
922891 const preDispatch = new Date().toISOString();
923-
892+
924893 // Dispatch the workflow in the target repository
925894 await github.rest.actions.createWorkflowDispatch({
926895 owner: targetOwner,
927896 repo: targetRepo,
928897 workflow_id: workflowId,
929898 ref: targetRef,
930- inputs : { public_ref: publicRef }
899+ inputs: { public_ref: publicRef, public_pr_number: String(publicPrNumber) }
931900 });
932901
933902 const sleep = (ms) => new Promise(r => setTimeout(r, ms));
@@ -1056,36 +1025,6 @@ jobs:
10561025 - name : Check global.json policy
10571026 run : cargo ci global-json-policy
10581027
1059- warn-python-smoketests :
1060- name : Check for Python smoketest edits
1061- runs-on : ubuntu-latest
1062- if : github.event_name == 'pull_request'
1063- permissions :
1064- contents : read
1065- steps :
1066- - name : Checkout sources
1067- uses : actions/checkout@v4
1068- with :
1069- fetch-depth : 0
1070-
1071- - name : Fail if Python smoketests were modified
1072- run : |
1073- MERGE_BASE="$(git merge-base origin/${{ github.base_ref }} HEAD)"
1074- PYTHON_SMOKETEST_CHANGES="$(git diff --name-only "$MERGE_BASE" HEAD -- 'smoketests/**.py')"
1075-
1076- if [ -n "$PYTHON_SMOKETEST_CHANGES" ]; then
1077- echo "::error::This PR modifies legacy Python smoketests. Please add new tests to the Rust smoketests in crates/smoketests/ instead."
1078- echo ""
1079- echo "Changed files:"
1080- echo "$PYTHON_SMOKETEST_CHANGES"
1081- echo ""
1082- echo "The Python smoketests are being replaced by Rust smoketests."
1083- echo "See crates/smoketests/DEVELOP.md for instructions on adding Rust smoketests."
1084- exit 1
1085- fi
1086-
1087- echo "No Python smoketest changes detected."
1088-
10891028 smoketests_mod_rs_complete :
10901029 name : Check smoketests/mod.rs is complete
10911030 runs-on : ubuntu-latest
@@ -1141,3 +1080,151 @@ jobs:
11411080 - name : Verify crates/smoketests/tests/smoketests/mod.rs lists all entries
11421081 run : |
11431082 cargo ci smoketests check-mod-list
1083+
1084+ docs-build :
1085+ name : Docs build
1086+ runs-on : spacetimedb-new-runner-2
1087+ steps :
1088+ - name : Checkout repository
1089+ uses : actions/checkout@v3
1090+
1091+ - name : Set up Node.js
1092+ uses : actions/setup-node@v3
1093+ with :
1094+ node-version : ' 22'
1095+
1096+ - uses : pnpm/action-setup@v4
1097+ with :
1098+ run_install : true
1099+
1100+ - name : Get pnpm store directory
1101+ working-directory : sdks/typescript
1102+ shell : bash
1103+ run : |
1104+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
1105+
1106+ - uses : actions/cache@v4
1107+ name : Setup pnpm cache
1108+ with :
1109+ path : ${{ env.STORE_PATH }}
1110+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
1111+ restore-keys : |
1112+ ${{ runner.os }}-pnpm-store-
1113+
1114+ - uses : dsherret/rust-toolchain-file@v1
1115+ - name : Set default rust toolchain
1116+ run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
1117+
1118+ - name : Docusaurus build
1119+ run : cargo ci docs
1120+
1121+ typescript-test :
1122+ name : TypeScript - Tests
1123+ runs-on : spacetimedb-new-runner-2
1124+ steps :
1125+ - name : Checkout repository
1126+ uses : actions/checkout@v4
1127+
1128+ - name : Set up Node.js
1129+ uses : actions/setup-node@v4
1130+ with :
1131+ node-version : 22
1132+
1133+ - uses : pnpm/action-setup@v4
1134+ with :
1135+ run_install : true
1136+
1137+ - name : Get pnpm store directory
1138+ shell : bash
1139+ working-directory : crates/bindings-typescript
1140+ run : |
1141+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
1142+
1143+ - uses : actions/cache@v4
1144+ name : Setup pnpm cache
1145+ with :
1146+ path : ${{ env.STORE_PATH }}
1147+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
1148+ restore-keys : |
1149+ ${{ runner.os }}-pnpm-store-
1150+
1151+ # - name: Extract SpacetimeDB branch name from file
1152+ # id: extract-branch
1153+ # run: |
1154+ # # Define the path to the branch file
1155+ # BRANCH_FILE=".github/spacetimedb-branch.txt"
1156+
1157+ # # Default to master if file doesn't exist
1158+ # if [ ! -f "$BRANCH_FILE" ]; then
1159+ # echo "::notice::No SpacetimeDB branch file found, using 'master'"
1160+ # echo "branch=master" >> $GITHUB_OUTPUT
1161+ # exit 0
1162+ # fi
1163+
1164+ # # Read and trim whitespace from the file
1165+ # branch=$(cat "$BRANCH_FILE" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
1166+
1167+ # # Fallback to master if empty
1168+ # if [ -z "$branch" ]; then
1169+ # echo "::warning::SpacetimeDB branch file is empty, using 'master'"
1170+ # branch="master"
1171+ # fi
1172+
1173+ # echo "branch=$branch" >> $GITHUB_OUTPUT
1174+ # echo "Using SpacetimeDB branch from file: $branch"
1175+
1176+ - name : Install Rust toolchain
1177+ uses : dsherret/rust-toolchain-file@v1
1178+ - name : Set default rust toolchain
1179+ run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
1180+
1181+ - name : Cache Rust dependencies
1182+ uses : Swatinem/rust-cache@v2
1183+ with :
1184+ workspaces : ${{ github.workspace }}
1185+ shared-key : spacetimedb
1186+ # Let the main CI job save the cache since it builds the most things
1187+ save-if : false
1188+ prefix-key : v1
1189+
1190+ # # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a.
1191+ # # ChatGPT suspects that this could be due to different build invocations using the same target dir,
1192+ # # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with
1193+ # # `cargo build --manifest-path` (which apparently build different dependency trees).
1194+ # # However, we've been unable to fix it so... /shrug
1195+ # - name: Check v8 outputs
1196+ # run: |
1197+ # find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true
1198+ # if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then
1199+ # echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
1200+ # cargo clean -p v8 || true
1201+ # cargo build -p v8
1202+ # fi
1203+ # if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then
1204+ # echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
1205+ # cargo clean --release -p v8 || true
1206+ # cargo build --release -p v8
1207+ # fi
1208+
1209+ # - name: Install SpacetimeDB CLI from the local checkout
1210+ # run: |
1211+ # export CARGO_HOME="$HOME/.cargo"
1212+ # echo "$CARGO_HOME/bin" >> "$GITHUB_PATH"
1213+ # cargo install --force --path crates/cli --locked --message-format=short
1214+ # cargo install --force --path crates/standalone --locked --message-format=short
1215+ # # Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
1216+ # ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime
1217+ # # Clear any existing information
1218+ # spacetime server clear -y
1219+
1220+ - name : Run TypeScript tests
1221+ run : cargo ci typescript-test
1222+
1223+ # - name: Run quickstart-chat tests
1224+ # working-directory: examples/quickstart-chat
1225+ # run: pnpm test
1226+ #
1227+ # # Run this step always, even if the previous steps fail
1228+ # - name: Print rows in the user table
1229+ # if: always()
1230+ # run: spacetime sql quickstart-chat "SELECT * FROM user"
0 commit comments