Reuse TxState, stashing in CommittedState btw txes
#4063
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: TypeScript - Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| merge_group: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || format('sha-{0}', github.sha) }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-test: | |
| runs-on: spacetimedb-new-runner | |
| container: | |
| image: localhost:5000/spacetimedb-ci:latest | |
| options: --privileged | |
| env: | |
| CARGO_TARGET_DIR: ${{ github.workspace }}/target | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: true | |
| - name: Get pnpm store directory | |
| shell: bash | |
| working-directory: crates/bindings-typescript | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - uses: actions/cache@v4 | |
| name: Setup pnpm cache | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Build module library and SDK | |
| working-directory: crates/bindings-typescript | |
| run: pnpm build | |
| - name: Run module library and SDK tests | |
| working-directory: crates/bindings-typescript | |
| run: pnpm test | |
| # - name: Extract SpacetimeDB branch name from file | |
| # id: extract-branch | |
| # run: | | |
| # # Define the path to the branch file | |
| # BRANCH_FILE=".github/spacetimedb-branch.txt" | |
| # # Default to master if file doesn't exist | |
| # if [ ! -f "$BRANCH_FILE" ]; then | |
| # echo "::notice::No SpacetimeDB branch file found, using 'master'" | |
| # echo "branch=master" >> $GITHUB_OUTPUT | |
| # exit 0 | |
| # fi | |
| # # Read and trim whitespace from the file | |
| # branch=$(cat "$BRANCH_FILE" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') | |
| # # Fallback to master if empty | |
| # if [ -z "$branch" ]; then | |
| # echo "::warning::SpacetimeDB branch file is empty, using 'master'" | |
| # branch="master" | |
| # fi | |
| # echo "branch=$branch" >> $GITHUB_OUTPUT | |
| # echo "Using SpacetimeDB branch from file: $branch" | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: ${{ github.workspace }} | |
| shared-key: spacetimedb | |
| # Let the main CI job save the cache since it builds the most things | |
| save-if: false | |
| - name: Install SpacetimeDB CLI from the local checkout | |
| run: | | |
| cargo install --force --path crates/cli --locked --message-format=short | |
| cargo install --force --path crates/standalone --locked --message-format=short | |
| # Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules). | |
| rm -f $CARGO_HOME/bin/spacetime | |
| ln -s $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime | |
| # Clear any existing information | |
| spacetime server clear -y | |
| - name: Generate client bindings | |
| working-directory: modules/quickstart-chat | |
| run: | | |
| spacetime generate --lang typescript --out-dir ../../crates/bindings-typescript/examples/quickstart-chat/src/module_bindings | |
| cd ../../crates/bindings-typescript | |
| pnpm format | |
| - name: Check for changes | |
| working-directory: crates/bindings-typescript | |
| run: | | |
| "${GITHUB_WORKSPACE}"/tools/check-diff.sh examples/quickstart-chat/src/module_bindings || { | |
| echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch." | |
| exit 1 | |
| } | |
| # - name: Start SpacetimeDB | |
| # run: | | |
| # spacetime start & | |
| # disown | |
| # - name: Publish module to SpacetimeDB | |
| # working-directory: SpacetimeDB/modules/quickstart-chat | |
| # run: | | |
| # spacetime logout && spacetime login --server-issued-login local | |
| # spacetime publish -s local quickstart-chat -c -y | |
| # - name: Publish module to SpacetimeDB | |
| # working-directory: SpacetimeDB/modules/quickstart-chat | |
| # run: | | |
| # spacetime logs quickstart-chat | |
| - name: Check that quickstart-chat builds | |
| working-directory: crates/bindings-typescript/examples/quickstart-chat | |
| run: pnpm build | |
| # - name: Run quickstart-chat tests | |
| # working-directory: examples/quickstart-chat | |
| # run: pnpm test | |
| # | |
| # # Run this step always, even if the previous steps fail | |
| # - name: Print rows in the user table | |
| # if: always() | |
| # run: spacetime sql quickstart-chat "SELECT * FROM user" |