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