Skip to content

polyfill react native #931

polyfill react native

polyfill react native #931

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- master
pull_request:
jobs:
compile-and-test:
runs-on: ubuntu-latest
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:
version: 9.7
run_install: true
- name: Get pnpm store directory
shell: bash
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: Compile
run: pnpm compile
- name: Run sdk tests
working-directory: packages/sdk
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: Checkout SpacetimeDB
uses: actions/checkout@v4
with:
repository: clockworklabs/SpacetimeDB
# ref: ${{ steps.extract-branch.outputs.branch }}
path: SpacetimeDB
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: SpacetimeDB/modules/quickstart-chat
shared-key: quickstart-chat-test
- name: Install SpacetimeDB CLI from the local checkout
run: |
cargo install --force --path SpacetimeDB/crates/cli --locked --message-format=short
cargo install --force --path SpacetimeDB/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 $HOME/.cargo/bin/spacetime
ln -s $HOME/.cargo/bin/spacetimedb-cli $HOME/.cargo/bin/spacetime
# Clear any existing information
spacetime server clear -y
env:
# Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice.
CARGO_TARGET_DIR: SpacetimeDB/modules/quickstart-chat/target
- name: Generate client bindings
working-directory: SpacetimeDB/modules/quickstart-chat
run: |
spacetime generate --lang typescript --out-dir ../../../examples/quickstart-chat/src/module_bindings
pnpm lint --write
- name: Check for changes
run: |
# This was copied from SpacetimeDB/tools/check-diff.sh.
# It's required because `spacetime generate` creates lines with the SpacetimeDB commit
# version, which would make this `git diff` check very brittle if included.
PATTERN='^// This was generated using spacetimedb cli version.*'
if ! git diff --exit-code --ignore-matching-lines="$PATTERN" -- examples/quickstart-chat/src/module_bindings; then
echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch."
exit 1
fi
# - 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: 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"