mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-22 15:41:56 -04:00
117 lines
3.2 KiB
YAML
117 lines
3.2 KiB
YAML
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
merge_group:
|
|
workflow_dispatch:
|
|
inputs:
|
|
pr_number:
|
|
description: 'Pull Request Number'
|
|
required: false
|
|
default: ''
|
|
|
|
name: CI
|
|
|
|
jobs:
|
|
docker_smoketests:
|
|
name: Smoketests
|
|
runs-on: spacetimedb-runner
|
|
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: Start containers
|
|
run: docker compose up -d
|
|
- name: Run smoketests
|
|
run: python -m smoketests --docker -x zz_docker
|
|
# These cannot run in parallel, even though the script tries to handle it
|
|
# TODO: Fix flaky tests https://github.com/clockworklabs/SpacetimeDB/issues/630
|
|
# - name: Run restarting smoketests
|
|
# run: python -m smoketests --docker zz_docker
|
|
- name: Stop containers
|
|
if: always()
|
|
run: docker compose down
|
|
|
|
test:
|
|
name: Test Suite
|
|
runs-on: spacetimedb-runner
|
|
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
|
|
|
|
- uses: actions/setup-dotnet@v3
|
|
with:
|
|
dotnet-version: "8.x"
|
|
|
|
- name: Create /stdb dir
|
|
run: |
|
|
sudo mkdir /stdb
|
|
sudo chmod 777 /stdb
|
|
|
|
- name: Run cargo test
|
|
run: cargo test --all
|
|
|
|
- name: C# SDK tests
|
|
run: dotnet test crates/bindings-csharp
|
|
|
|
lints:
|
|
name: Lints
|
|
runs-on: spacetimedb-runner
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
|
|
- uses: dsherret/rust-toolchain-file@v1
|
|
- run: echo ::add-matcher::.github/workflows/rust_matcher.json
|
|
|
|
- name: Run cargo fmt
|
|
run: cargo fmt --all -- --check
|
|
|
|
- name: Run cargo clippy
|
|
run: cargo clippy --all --tests --benches -- -D warnings
|
|
|
|
wasm_bindings:
|
|
name: Build and test wasm bindings
|
|
runs-on: spacetimedb-runner
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dsherret/rust-toolchain-file@v1
|
|
- run: echo ::add-matcher::.github/workflows/rust_matcher.json
|
|
|
|
- name: Build rust-wasm-test
|
|
run: cargo run -p spacetimedb-cli -- build --project-path modules/rust-wasm-test
|
|
|
|
- name: Run bindgen tests
|
|
run: cargo test -p spacetimedb-cli
|