Skip to content

Bfops/test debug #20398

Bfops/test debug

Bfops/test debug #20398

Workflow file for this run

on:
pull_request:
push:
branches:
- master
merge_group:
workflow_dispatch:
inputs:
pr_number:
description: "Pull Request Number"
required: false
default: ""
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.inputs.pr_number || format('sha-{0}', github.sha) }}
cancel-in-progress: true
jobs:
test:
name: Test Suite
runs-on: spacetimedb-new-runner-2
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Find Git ref
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER="${{ github.event.inputs.pr_number || null }}"
if test -n "${PR_NUMBER}"; then
GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )"
else
GIT_REF="${{ github.ref }}"
fi
echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ env.GIT_REF }}
- uses: dsherret/rust-toolchain-file@v1
- name: Set default rust toolchain
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ github.workspace }}
shared-key: spacetimedb
# Let the smoketests job save the cache since it builds the most things
save-if: false
prefix-key: v1
- uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- uses: pnpm/action-setup@v4
with:
run_install: true
# Install cmake and emscripten for C++ module compilation tests.
- name: Install cmake and emscripten
run: |
sudo apt-get update
sudo apt-get install -y cmake
git clone https://github.com/emscripten-core/emsdk.git ~/emsdk
cd ~/emsdk
./emsdk install 4.0.21
./emsdk activate 4.0.21
- name: Install wasm-bindgen CLI
run: |
REQUIRED_WASM_BINDGEN_VERSION="$(
awk '
$1 == "name" && $3 == "\"wasm-bindgen\"" { in_pkg = 1; next }
in_pkg && $1 == "version" {
gsub(/"/, "", $3);
print $3;
exit;
}
' Cargo.lock
)"
if [ -z "${REQUIRED_WASM_BINDGEN_VERSION}" ]; then
echo "Failed to determine wasm-bindgen version from Cargo.lock"
exit 1
fi
INSTALLED_WASM_BINDGEN_VERSION="$(wasm-bindgen --version 2>/dev/null | awk '{print $2}' || true)"
if [ "${INSTALLED_WASM_BINDGEN_VERSION}" != "${REQUIRED_WASM_BINDGEN_VERSION}" ]; then
cargo install --locked --force wasm-bindgen-cli --version "${REQUIRED_WASM_BINDGEN_VERSION}"
fi
wasm-bindgen --version
- name: Build typescript module sdk
working-directory: crates/bindings-typescript
run: pnpm build
# Source emsdk environment to make emcc (Emscripten compiler) available in PATH.
- name: Run tests
run: |
source ~/emsdk/emsdk_env.sh
cargo ci test