From 8d1d37c1d09bd5d95ee964a5a3bb660f4a76acf4 Mon Sep 17 00:00:00 2001 From: John Detter <4099508+jdetter@users.noreply.github.com> Date: Wed, 26 Nov 2025 12:54:07 -0600 Subject: [PATCH 1/8] Split Unity and csharp tests into different workflows --- .github/workflows/csharp-test.yml | 71 +-------------- .github/workflows/unity-test.yml | 141 ++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/unity-test.yml diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 2e3d72c75ce..b9be4714700 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -1,4 +1,4 @@ -name: C#/Unity - Test Suite +name: C# - Test Suite on: push: @@ -20,7 +20,7 @@ jobs: --cgroupns=host # Cancel any previous testsuites running on the same PR and/or ref. concurrency: - group: unity-test-${{ github.event.pull_request.number || github.ref }} + group: csharp-test-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true timeout-minutes: 30 env: @@ -59,14 +59,6 @@ jobs: working-directory: sdks/csharp run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln - # Now, setup the Unity tests. - - - name: Patch spacetimedb dependency in Cargo.toml - working-directory: demo/Blackholio/server-rust - run: | - sed -i "s|spacetimedb *=.*|spacetimedb = \{ path = \"../../../crates/bindings\" \}|" Cargo.toml - cat Cargo.toml - - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable @@ -103,25 +95,6 @@ jobs: exit 1 } - - name: Generate client bindings - working-directory: demo/Blackholio/server-rust - run: bash ./generate.sh -y - - - name: Check for changes - run: | - tools/check-diff.sh demo/Blackholio/client-unity/Assets/Scripts/autogen || { - echo 'Error: Bindings are dirty. Please run `demo/Blackholio/server-rust/generate.sh`.' - exit 1 - } - - - name: Check Unity meta files - uses: DeNA/unity-meta-check@v3 - with: - enable_pr_comment: ${{ github.event_name == 'pull_request' }} - target_path: sdks/csharp - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Start SpacetimeDB run: | spacetime start & @@ -134,43 +107,3 @@ jobs: echo 'Error: Bindings are dirty. Please run `sdks/csharp/tools~/gen-regression-tests.sh`.' exit 1 } - - - name: Publish unity-tests module to SpacetimeDB - working-directory: demo/Blackholio/server-rust - run: | - spacetime logout && spacetime login --server-issued-login local - bash ./publish.sh - - - name: Patch com.clockworklabs.spacetimedbsdk dependency in manifest.json - working-directory: demo/Blackholio/client-unity/Packages - run: | - # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. - # Note: Pointing to a local directory does not work, because our earlier steps nuke our meta files, which then causes Unity to not properly respect the DLLs (e.g. - # codegen does not work properly). - yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "https://github.com/clockworklabs/SpacetimeDB.git?path=sdks/csharp#${{ github.head_ref }}"' manifest.json - cat manifest.json - - - uses: actions/cache@v3 - with: - path: demo/Blackholio/client-unity/Library - key: Unity-${{ github.head_ref }} - restore-keys: Unity- - - # We need this to support "Docker in Docker" - - name: Start Docker daemon - run: /usr/local/bin/start-docker.sh - - name: Run Unity tests - uses: game-ci/unity-test-runner@v4 - with: - unityVersion: 2022.3.32f1 # Adjust Unity version to a valid tag - projectPath: demo/Blackholio/client-unity # Path to the Unity project subdirectory - githubToken: ${{ secrets.GITHUB_TOKEN }} - testMode: playmode - useHostNetwork: true - env: - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} - # Skip if this is an external contribution. - # The license secrets will be empty, so the step would fail anyway. - if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }} diff --git a/.github/workflows/unity-test.yml b/.github/workflows/unity-test.yml new file mode 100644 index 00000000000..135a8c57b72 --- /dev/null +++ b/.github/workflows/unity-test.yml @@ -0,0 +1,141 @@ +name: Unity - Test Suite + +on: + push: + branches: + - master + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || format('sha-{0}', github.sha) }} + cancel-in-progress: true + +jobs: + unity-testsuite: + runs-on: spacetimedb-new-runner + container: + image: localhost:5000/spacetimedb-ci:latest + options: >- + --privileged + --cgroupns=host + # Cancel any previous testsuites running on the same PR and/or ref. + concurrency: + group: unity-test-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + timeout-minutes: 30 + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + steps: + - name: Checkout repository + id: checkout-stdb + uses: actions/checkout@v4 + + # Run cheap .NET tests first. If those fail, no need to run expensive Unity tests. + + - name: Setup dotnet + uses: actions/setup-dotnet@v3 + with: + global-json-file: global.json + + - name: Override NuGet packages + run: | + dotnet pack crates/bindings-csharp/BSATN.Runtime + dotnet pack crates/bindings-csharp/Runtime + + # 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. + cd sdks/csharp + ./tools~/write-nuget-config.sh ../.. + + # Now, setup the Unity tests. + - name: Patch spacetimedb dependency in Cargo.toml + working-directory: demo/Blackholio/server-rust + run: | + sed -i "s|spacetimedb *=.*|spacetimedb = \{ path = \"../../../crates/bindings\" \}|" Cargo.toml + cat Cargo.toml + + - 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). + ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime + + - name: Generate client bindings + working-directory: demo/Blackholio/server-rust + run: bash ./generate.sh -y + + - name: Check for changes + run: | + tools/check-diff.sh demo/Blackholio/client-unity/Assets/Scripts/autogen || { + echo 'Error: Bindings are dirty. Please run `demo/Blackholio/server-rust/generate.sh`.' + exit 1 + } + + - name: Check Unity meta files + uses: DeNA/unity-meta-check@v3 + with: + enable_pr_comment: ${{ github.event_name == 'pull_request' }} + target_path: sdks/csharp + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + - name: Start SpacetimeDB + run: | + spacetime start & + disown + + - name: Publish unity-tests module to SpacetimeDB + working-directory: demo/Blackholio/server-rust + run: | + spacetime logout && spacetime login --server-issued-login local + bash ./publish.sh + + - name: Patch com.clockworklabs.spacetimedbsdk dependency in manifest.json + working-directory: demo/Blackholio/client-unity/Packages + run: | + # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. + # Note: Pointing to a local directory does not work, because our earlier steps nuke our meta files, which then causes Unity to not properly respect the DLLs (e.g. + # codegen does not work properly). + yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "https://github.com/clockworklabs/SpacetimeDB.git?path=sdks/csharp#${{ github.head_ref }}"' manifest.json + cat manifest.json + + - uses: actions/cache@v3 + with: + path: demo/Blackholio/client-unity/Library + key: Unity-${{ github.head_ref }} + restore-keys: Unity- + + # We need this to support "Docker in Docker" + - name: Start Docker daemon + run: /usr/local/bin/start-docker.sh + - name: Run Unity tests + uses: game-ci/unity-test-runner@v4 + with: + unityVersion: 2022.3.32f1 # Adjust Unity version to a valid tag + projectPath: demo/Blackholio/client-unity # Path to the Unity project subdirectory + githubToken: ${{ secrets.GITHUB_TOKEN }} + testMode: playmode + useHostNetwork: true + env: + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} + # Skip if this is an external contribution. + # The license secrets will be empty, so the step would fail anyway. + if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }} From 815d00c8aae89a14acd72e98624c2639aa602b68 Mon Sep 17 00:00:00 2001 From: John Detter <4099508+jdetter@users.noreply.github.com> Date: Wed, 26 Nov 2025 13:48:15 -0600 Subject: [PATCH 2/8] Move everything under ci.yml --- .github/workflows/ci.yml | 218 +++++++++++++++++++++++++++++++ .github/workflows/unity-test.yml | 141 -------------------- 2 files changed, 218 insertions(+), 141 deletions(-) delete mode 100644 .github/workflows/unity-test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 420b406e6b7..7085b693fe4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -523,3 +523,221 @@ jobs: echo "It looks like the CLI docs have changed:" exit 1 fi + + unity-testsuite: + runs-on: spacetimedb-new-runner + container: + image: localhost:5000/spacetimedb-ci:latest + options: >- + --privileged + --cgroupns=host + timeout-minutes: 30 + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + steps: + - name: Checkout repository + id: checkout-stdb + uses: actions/checkout@v4 + + # Run cheap .NET tests first. If those fail, no need to run expensive Unity tests. + + - name: Setup dotnet + uses: actions/setup-dotnet@v3 + with: + global-json-file: global.json + + - name: Override NuGet packages + run: | + dotnet pack crates/bindings-csharp/BSATN.Runtime + dotnet pack crates/bindings-csharp/Runtime + + # 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. + cd sdks/csharp + ./tools~/write-nuget-config.sh ../.. + + # Now, setup the Unity tests. + - name: Patch spacetimedb dependency in Cargo.toml + working-directory: demo/Blackholio/server-rust + run: | + sed -i "s|spacetimedb *=.*|spacetimedb = \{ path = \"../../../crates/bindings\" \}|" Cargo.toml + cat Cargo.toml + + - 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). + ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime + + - name: Generate client bindings + working-directory: demo/Blackholio/server-rust + run: bash ./generate.sh -y + + - name: Check for changes + run: | + tools/check-diff.sh demo/Blackholio/client-unity/Assets/Scripts/autogen || { + echo 'Error: Bindings are dirty. Please run `demo/Blackholio/server-rust/generate.sh`.' + exit 1 + } + + - name: Check Unity meta files + uses: DeNA/unity-meta-check@v3 + with: + enable_pr_comment: ${{ github.event_name == 'pull_request' }} + target_path: sdks/csharp + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + - name: Start SpacetimeDB + run: | + spacetime start & + disown + + - name: Publish unity-tests module to SpacetimeDB + working-directory: demo/Blackholio/server-rust + run: | + spacetime logout && spacetime login --server-issued-login local + bash ./publish.sh + + - name: Patch com.clockworklabs.spacetimedbsdk dependency in manifest.json + working-directory: demo/Blackholio/client-unity/Packages + run: | + # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. + # Note: Pointing to a local directory does not work, because our earlier steps nuke our meta files, which then causes Unity to not properly respect the DLLs (e.g. + # codegen does not work properly). + yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "https://github.com/clockworklabs/SpacetimeDB.git?path=sdks/csharp#${{ github.head_ref }}"' manifest.json + cat manifest.json + + - uses: actions/cache@v3 + with: + path: demo/Blackholio/client-unity/Library + key: Unity-${{ github.head_ref }} + restore-keys: Unity- + + # We need this to support "Docker in Docker" + - name: Start Docker daemon + run: /usr/local/bin/start-docker.sh + - name: Run Unity tests + uses: game-ci/unity-test-runner@v4 + with: + unityVersion: 2022.3.32f1 # Adjust Unity version to a valid tag + projectPath: demo/Blackholio/client-unity # Path to the Unity project subdirectory + githubToken: ${{ secrets.GITHUB_TOKEN }} + testMode: playmode + useHostNetwork: true + env: + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} + # Skip if this is an external contribution. + # The license secrets will be empty, so the step would fail anyway. + if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }} + + csharp-testsuite: + runs-on: spacetimedb-new-runner + container: + image: localhost:5000/spacetimedb-ci:latest + options: >- + --privileged + --cgroupns=host + timeout-minutes: 30 + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + steps: + - name: Checkout repository + id: checkout-stdb + uses: actions/checkout@v4 + + # Run cheap .NET tests first. If those fail, no need to run expensive Unity tests. + + - name: Setup dotnet + uses: actions/setup-dotnet@v3 + with: + global-json-file: global.json + + - name: Override NuGet packages + run: | + dotnet pack crates/bindings-csharp/BSATN.Runtime + dotnet pack crates/bindings-csharp/Runtime + + # 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. + cd sdks/csharp + ./tools~/write-nuget-config.sh ../.. + + - name: Run .NET tests + working-directory: sdks/csharp + run: dotnet test -warnaserror + + - name: Verify C# formatting + working-directory: sdks/csharp + run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln + + - 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). + ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime + + - name: Check quickstart-chat bindings are up to date + working-directory: sdks/csharp + run: | + bash tools~/gen-quickstart.sh + "${GITHUB_WORKSPACE}"/tools/check-diff.sh examples~/quickstart-chat || { + echo 'Error: quickstart-chat bindings have changed. Please run `sdks/csharp/tools~/gen-quickstart.sh`.' + exit 1 + } + + - name: Check client-api bindings are up to date + working-directory: sdks/csharp + run: | + bash tools~/gen-client-api.sh + "${GITHUB_WORKSPACE}"/tools/check-diff.sh src/SpacetimeDB/ClientApi || { + echo 'Error: Client API bindings are dirty. Please run `sdks/csharp/tools~/gen-client-api.sh`.' + exit 1 + } + + - name: Start SpacetimeDB + run: | + spacetime start & + disown + + - name: Run regression tests + run: | + bash sdks/csharp/tools~/run-regression-tests.sh + tools/check-diff.sh sdks/csharp/examples~/regression-tests || { + echo 'Error: Bindings are dirty. Please run `sdks/csharp/tools~/gen-regression-tests.sh`.' + exit 1 + } diff --git a/.github/workflows/unity-test.yml b/.github/workflows/unity-test.yml deleted file mode 100644 index 135a8c57b72..00000000000 --- a/.github/workflows/unity-test.yml +++ /dev/null @@ -1,141 +0,0 @@ -name: Unity - Test Suite - -on: - push: - branches: - - master - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || format('sha-{0}', github.sha) }} - cancel-in-progress: true - -jobs: - unity-testsuite: - runs-on: spacetimedb-new-runner - container: - image: localhost:5000/spacetimedb-ci:latest - options: >- - --privileged - --cgroupns=host - # Cancel any previous testsuites running on the same PR and/or ref. - concurrency: - group: unity-test-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - timeout-minutes: 30 - env: - CARGO_TARGET_DIR: ${{ github.workspace }}/target - steps: - - name: Checkout repository - id: checkout-stdb - uses: actions/checkout@v4 - - # Run cheap .NET tests first. If those fail, no need to run expensive Unity tests. - - - name: Setup dotnet - uses: actions/setup-dotnet@v3 - with: - global-json-file: global.json - - - name: Override NuGet packages - run: | - dotnet pack crates/bindings-csharp/BSATN.Runtime - dotnet pack crates/bindings-csharp/Runtime - - # 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. - cd sdks/csharp - ./tools~/write-nuget-config.sh ../.. - - # Now, setup the Unity tests. - - name: Patch spacetimedb dependency in Cargo.toml - working-directory: demo/Blackholio/server-rust - run: | - sed -i "s|spacetimedb *=.*|spacetimedb = \{ path = \"../../../crates/bindings\" \}|" Cargo.toml - cat Cargo.toml - - - 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). - ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime - - - name: Generate client bindings - working-directory: demo/Blackholio/server-rust - run: bash ./generate.sh -y - - - name: Check for changes - run: | - tools/check-diff.sh demo/Blackholio/client-unity/Assets/Scripts/autogen || { - echo 'Error: Bindings are dirty. Please run `demo/Blackholio/server-rust/generate.sh`.' - exit 1 - } - - - name: Check Unity meta files - uses: DeNA/unity-meta-check@v3 - with: - enable_pr_comment: ${{ github.event_name == 'pull_request' }} - target_path: sdks/csharp - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - - name: Start SpacetimeDB - run: | - spacetime start & - disown - - - name: Publish unity-tests module to SpacetimeDB - working-directory: demo/Blackholio/server-rust - run: | - spacetime logout && spacetime login --server-issued-login local - bash ./publish.sh - - - name: Patch com.clockworklabs.spacetimedbsdk dependency in manifest.json - working-directory: demo/Blackholio/client-unity/Packages - run: | - # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. - # Note: Pointing to a local directory does not work, because our earlier steps nuke our meta files, which then causes Unity to not properly respect the DLLs (e.g. - # codegen does not work properly). - yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "https://github.com/clockworklabs/SpacetimeDB.git?path=sdks/csharp#${{ github.head_ref }}"' manifest.json - cat manifest.json - - - uses: actions/cache@v3 - with: - path: demo/Blackholio/client-unity/Library - key: Unity-${{ github.head_ref }} - restore-keys: Unity- - - # We need this to support "Docker in Docker" - - name: Start Docker daemon - run: /usr/local/bin/start-docker.sh - - name: Run Unity tests - uses: game-ci/unity-test-runner@v4 - with: - unityVersion: 2022.3.32f1 # Adjust Unity version to a valid tag - projectPath: demo/Blackholio/client-unity # Path to the Unity project subdirectory - githubToken: ${{ secrets.GITHUB_TOKEN }} - testMode: playmode - useHostNetwork: true - env: - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} - # Skip if this is an external contribution. - # The license secrets will be empty, so the step would fail anyway. - if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }} From 2e6992e6dd1ebe1979720580c525e3d067394240 Mon Sep 17 00:00:00 2001 From: John Detter <4099508+jdetter@users.noreply.github.com> Date: Wed, 26 Nov 2025 13:49:42 -0600 Subject: [PATCH 3/8] Potential fix for code scanning alert no. 126: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com> --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7085b693fe4..1ed91da5284 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -525,6 +525,8 @@ jobs: fi unity-testsuite: + permissions: + contents: read runs-on: spacetimedb-new-runner container: image: localhost:5000/spacetimedb-ci:latest From 9a60bd227520cebd49bee8f062b09e803ba78054 Mon Sep 17 00:00:00 2001 From: John Detter <4099508+jdetter@users.noreply.github.com> Date: Wed, 26 Nov 2025 13:50:50 -0600 Subject: [PATCH 4/8] Remove csharp-test.yml --- .github/workflows/csharp-test.yml | 109 ------------------------------ 1 file changed, 109 deletions(-) delete mode 100644 .github/workflows/csharp-test.yml diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml deleted file mode 100644 index b9be4714700..00000000000 --- a/.github/workflows/csharp-test.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: C# - Test Suite - -on: - push: - branches: - - master - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || format('sha-{0}', github.sha) }} - cancel-in-progress: true - -jobs: - unity-testsuite: - runs-on: spacetimedb-new-runner - container: - image: localhost:5000/spacetimedb-ci:latest - options: >- - --privileged - --cgroupns=host - # Cancel any previous testsuites running on the same PR and/or ref. - concurrency: - group: csharp-test-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - timeout-minutes: 30 - env: - CARGO_TARGET_DIR: ${{ github.workspace }}/target - steps: - - name: Checkout repository - id: checkout-stdb - uses: actions/checkout@v4 - - # Run cheap .NET tests first. If those fail, no need to run expensive Unity tests. - - - name: Setup dotnet - uses: actions/setup-dotnet@v3 - with: - global-json-file: global.json - - - name: Override NuGet packages - run: | - dotnet pack crates/bindings-csharp/BSATN.Runtime - dotnet pack crates/bindings-csharp/Runtime - - # 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. - cd sdks/csharp - ./tools~/write-nuget-config.sh ../.. - - - name: Run .NET tests - working-directory: sdks/csharp - run: dotnet test -warnaserror - - - name: Verify C# formatting - working-directory: sdks/csharp - run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln - - - 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). - ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime - - - name: Check quickstart-chat bindings are up to date - working-directory: sdks/csharp - run: | - bash tools~/gen-quickstart.sh - "${GITHUB_WORKSPACE}"/tools/check-diff.sh examples~/quickstart-chat || { - echo 'Error: quickstart-chat bindings have changed. Please run `sdks/csharp/tools~/gen-quickstart.sh`.' - exit 1 - } - - - name: Check client-api bindings are up to date - working-directory: sdks/csharp - run: | - bash tools~/gen-client-api.sh - "${GITHUB_WORKSPACE}"/tools/check-diff.sh src/SpacetimeDB/ClientApi || { - echo 'Error: Client API bindings are dirty. Please run `sdks/csharp/tools~/gen-client-api.sh`.' - exit 1 - } - - - name: Start SpacetimeDB - run: | - spacetime start & - disown - - - name: Run regression tests - run: | - bash sdks/csharp/tools~/run-regression-tests.sh - tools/check-diff.sh sdks/csharp/examples~/regression-tests || { - echo 'Error: Bindings are dirty. Please run `sdks/csharp/tools~/gen-regression-tests.sh`.' - exit 1 - } From cd190210ce958536c50cc94b8e31aa3f93f68083 Mon Sep 17 00:00:00 2001 From: John Detter <4099508+jdetter@users.noreply.github.com> Date: Wed, 26 Nov 2025 14:27:53 -0600 Subject: [PATCH 5/8] Allow the unity testsuite job to write to the PR (it needs to write the status results) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cffe5c6541e..e1f4a34ff46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -527,7 +527,7 @@ jobs: unity-testsuite: permissions: - contents: read + contents: write runs-on: spacetimedb-new-runner container: image: localhost:5000/spacetimedb-ci:latest From 06c99f43f673b0ee3dc20409ac280322458d81b9 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 26 Nov 2025 12:30:21 -0800 Subject: [PATCH 6/8] [jdetter/split-unity-and-csharp-tests]: fix permissions --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1f4a34ff46..a24aed314be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -527,7 +527,8 @@ jobs: unity-testsuite: permissions: - contents: write + contents: read + checks: write runs-on: spacetimedb-new-runner container: image: localhost:5000/spacetimedb-ci:latest From 22694b7b37cdd85311d22cf7583494325ac21cad Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 26 Nov 2025 12:30:30 -0800 Subject: [PATCH 7/8] [jdetter/split-unity-and-csharp-tests]: don't upload artifacts --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a24aed314be..55b6f3841dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -645,6 +645,7 @@ jobs: githubToken: ${{ secrets.GITHUB_TOKEN }} testMode: playmode useHostNetwork: true + uploadArtifacts: false env: UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} From 83c302967a6e1d431010ab673ff54ae922246a0a Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 26 Nov 2025 12:50:20 -0800 Subject: [PATCH 8/8] [jdetter/split-unity-and-csharp-tests]: fix warning --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55b6f3841dc..912741d6514 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -645,7 +645,7 @@ jobs: githubToken: ${{ secrets.GITHUB_TOKEN }} testMode: playmode useHostNetwork: true - uploadArtifacts: false + artifactsPath: "" env: UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}