Use NonZeroU64
for num_distinct_values
to avoid div-by-zero
#7887
This file contains 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
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 | |
- 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# bindings tests | |
run: dotnet test crates/bindings-csharp | |
sdk_test: | |
name: SDK Tests | |
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: Checkout C# SDK | |
uses: actions/checkout@v4 | |
with: | |
repository: clockworklabs/spacetimedb-csharp-sdk | |
path: spacetimedb-csharp-sdk | |
- name: C# SDK tests | |
run: | | |
( cd crates/bindings-csharp/BSATN.Runtime && dotnet pack ) | |
cd spacetimedb-csharp-sdk | |
# Write out the nuget config file to `nuget.config`. This causes the spacetimedb-csharp-sdk repository | |
# to be aware of the local versions of the `bindings-csharp` packages in SpacetimeDB, and use them if | |
# available. Otherwise, `spacetimedb-csharp-sdk` will use the NuGet versions of the packages. | |
# This means that (if version numbers match) we will test the local versions of the C# packages, even | |
# if they're not pushed to NuGet. | |
# See https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file for more info on the config file, | |
# and https://tldp.org/LDP/abs/html/here-docs.html for more info on this bash feature. | |
cat >nuget.config <<EOF | |
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<packageSources> | |
<!-- Local NuGet repositories --> | |
<add key="Local SpacetimeDB.BSATN.Runtime" value="../crates/bindings-csharp/BSATN.Runtime/bin/Release" /> | |
<!-- Official NuGet.org server --> | |
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" /> | |
</packageSources> | |
</configuration> | |
EOF | |
# clear package caches, so we get fresh ones even if version numbers haven't changed | |
dotnet nuget locals all --clear | |
dotnet test | |
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 |