@@ -1134,3 +1134,198 @@ jobs:
11341134 - name : Verify crates/smoketests/tests/smoketests/mod.rs lists all entries
11351135 run : |
11361136 cargo ci smoketests check-mod-list
1137+
1138+ docs-build :
1139+ name : Docs build
1140+ runs-on : spacetimedb-new-runner-2
1141+ steps :
1142+ - name : Checkout repository
1143+ uses : actions/checkout@v3
1144+
1145+ - name : Set up Node.js
1146+ uses : actions/setup-node@v3
1147+ with :
1148+ node-version : ' 22'
1149+
1150+ - uses : pnpm/action-setup@v4
1151+ with :
1152+ run_install : true
1153+
1154+ - name : Get pnpm store directory
1155+ working-directory : sdks/typescript
1156+ shell : bash
1157+ run : |
1158+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
1159+
1160+ - uses : actions/cache@v4
1161+ name : Setup pnpm cache
1162+ with :
1163+ path : ${{ env.STORE_PATH }}
1164+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
1165+ restore-keys : |
1166+ ${{ runner.os }}-pnpm-store-
1167+
1168+ - name : Install dependencies
1169+ working-directory : docs
1170+ run : pnpm install
1171+
1172+ - name : Docusaurus build
1173+ working-directory : docs
1174+ run : pnpm build
1175+
1176+ typescript-test :
1177+ name : TypeScript - Tests
1178+ runs-on : spacetimedb-new-runner-2
1179+ steps :
1180+ - name : Checkout repository
1181+ uses : actions/checkout@v4
1182+
1183+ - name : Set up Node.js
1184+ uses : actions/setup-node@v4
1185+ with :
1186+ node-version : 22
1187+
1188+ - uses : pnpm/action-setup@v4
1189+ with :
1190+ run_install : true
1191+
1192+ - name : Get pnpm store directory
1193+ shell : bash
1194+ working-directory : crates/bindings-typescript
1195+ run : |
1196+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
1197+
1198+ - uses : actions/cache@v4
1199+ name : Setup pnpm cache
1200+ with :
1201+ path : ${{ env.STORE_PATH }}
1202+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
1203+ restore-keys : |
1204+ ${{ runner.os }}-pnpm-store-
1205+
1206+ - name : Build module library and SDK
1207+ working-directory : crates/bindings-typescript
1208+ run : pnpm build
1209+
1210+ - name : Run module library and SDK tests
1211+ working-directory : crates/bindings-typescript
1212+ run : pnpm test
1213+
1214+ # - name: Extract SpacetimeDB branch name from file
1215+ # id: extract-branch
1216+ # run: |
1217+ # # Define the path to the branch file
1218+ # BRANCH_FILE=".github/spacetimedb-branch.txt"
1219+
1220+ # # Default to master if file doesn't exist
1221+ # if [ ! -f "$BRANCH_FILE" ]; then
1222+ # echo "::notice::No SpacetimeDB branch file found, using 'master'"
1223+ # echo "branch=master" >> $GITHUB_OUTPUT
1224+ # exit 0
1225+ # fi
1226+
1227+ # # Read and trim whitespace from the file
1228+ # branch=$(cat "$BRANCH_FILE" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
1229+
1230+ # # Fallback to master if empty
1231+ # if [ -z "$branch" ]; then
1232+ # echo "::warning::SpacetimeDB branch file is empty, using 'master'"
1233+ # branch="master"
1234+ # fi
1235+
1236+ # echo "branch=$branch" >> $GITHUB_OUTPUT
1237+ # echo "Using SpacetimeDB branch from file: $branch"
1238+
1239+ - name : Install Rust toolchain
1240+ uses : dsherret/rust-toolchain-file@v1
1241+ - name : Set default rust toolchain
1242+ run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
1243+
1244+ - name : Cache Rust dependencies
1245+ uses : Swatinem/rust-cache@v2
1246+ with :
1247+ workspaces : ${{ github.workspace }}
1248+ shared-key : spacetimedb
1249+ # Let the main CI job save the cache since it builds the most things
1250+ save-if : false
1251+ prefix-key : v1
1252+
1253+ # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a.
1254+ # ChatGPT suspects that this could be due to different build invocations using the same target dir,
1255+ # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with
1256+ # `cargo build --manifest-path` (which apparently build different dependency trees).
1257+ # However, we've been unable to fix it so... /shrug
1258+ - name : Check v8 outputs
1259+ run : |
1260+ find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true
1261+ if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then
1262+ echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
1263+ cargo clean -p v8 || true
1264+ cargo build -p v8
1265+ fi
1266+ if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then
1267+ echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
1268+ cargo clean --release -p v8 || true
1269+ cargo build --release -p v8
1270+ fi
1271+
1272+ - name : Install SpacetimeDB CLI from the local checkout
1273+ run : |
1274+ export CARGO_HOME="$HOME/.cargo"
1275+ echo "$CARGO_HOME/bin" >> "$GITHUB_PATH"
1276+ cargo install --force --path crates/cli --locked --message-format=short
1277+ cargo install --force --path crates/standalone --locked --message-format=short
1278+ # Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
1279+ ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime
1280+ # Clear any existing information
1281+ spacetime server clear -y
1282+
1283+ - name : Generate client bindings
1284+ working-directory : templates/chat-react-ts
1285+ run : |
1286+ pnpm generate
1287+
1288+ - name : Check for changes
1289+ working-directory : templates/chat-react-ts
1290+ run : |
1291+ "${GITHUB_WORKSPACE}"/tools/check-diff.sh src/module_bindings || {
1292+ echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch."
1293+ exit 1
1294+ }
1295+
1296+ # - name: Start SpacetimeDB
1297+ # run: |
1298+ # spacetime start &
1299+ # disown
1300+
1301+ # - name: Publish module to SpacetimeDB
1302+ # working-directory: SpacetimeDB/templates/quickstart-chat-typescript/spacetimedb
1303+ # run: |
1304+ # spacetime logout && spacetime login --server-issued-login local
1305+ # spacetime publish -s local quickstart-chat -c -y
1306+
1307+ # - name: Publish module to SpacetimeDB
1308+ # working-directory: SpacetimeDB/templates/quickstart-chat-typescript/spacetimedb
1309+ # run: |
1310+ # spacetime logs quickstart-chat
1311+
1312+ - name : Check that quickstart-chat builds
1313+ working-directory : templates/chat-react-ts
1314+ run : pnpm build
1315+
1316+ - name : Check that templates build
1317+ working-directory : templates/
1318+ run : pnpm -r --filter "./**" run build
1319+
1320+ - name : Check that subdirectories build
1321+ working-directory : crates/bindings-typescript
1322+ run : pnpm -r --filter "./**" run build
1323+
1324+ # - name: Run quickstart-chat tests
1325+ # working-directory: examples/quickstart-chat
1326+ # run: pnpm test
1327+ #
1328+ # # Run this step always, even if the previous steps fail
1329+ # - name: Print rows in the user table
1330+ # if: always()
1331+ # run: spacetime sql quickstart-chat "SELECT * FROM user"
0 commit comments