@@ -760,6 +760,131 @@ jobs:
760760 UNITY_PASSWORD : ${{ secrets.UNITY_PASSWORD }}
761761 UNITY_SERIAL : ${{ secrets.UNITY_SERIAL }}
762762
763+ godot-testsuite :
764+ needs : [lints]
765+ permissions :
766+ contents : read
767+ runs-on : spacetimedb-new-runner-2
768+ env :
769+ CARGO_TARGET_DIR : ${{ github.workspace }}/target
770+ UseLocalBsatnRuntime : true
771+ steps :
772+ - name : Checkout repository
773+ id : checkout-stdb
774+ uses : actions/checkout@v4
775+
776+ - name : Setup dotnet
777+ uses : actions/setup-dotnet@v3
778+ with :
779+ global-json-file : global.json
780+
781+ - name : Override NuGet packages
782+ run : |
783+ dotnet pack -c Release crates/bindings-csharp/BSATN.Runtime
784+ dotnet pack -c Release crates/bindings-csharp/Runtime
785+
786+ # Write out the nuget config file to `nuget.config`. This causes the spacetimedb-csharp-sdk repository
787+ # to be aware of the local versions of the `bindings-csharp` packages in SpacetimeDB, and use them if
788+ # available. Otherwise, `spacetimedb-csharp-sdk` will use the NuGet versions of the packages.
789+ # This means that (if version numbers match) we will test the local versions of the C# packages, even
790+ # if they're not pushed to NuGet.
791+ # See https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file for more info on the config file.
792+ cd sdks/csharp
793+ ./tools~/write-nuget-config.sh ../..
794+
795+ - name : Restore .NET solution
796+ working-directory : sdks/csharp
797+ run : dotnet restore --configfile NuGet.Config SpacetimeDB.ClientSDK.sln
798+
799+ # Now, setup the Godot tests.
800+ - name : Patch spacetimedb dependency in Cargo.toml
801+ working-directory : demo/Blackholio/server-rust
802+ run : |
803+ sed -i "s|spacetimedb *=.*|spacetimedb = \{ path = \"../../../crates/bindings\" \}|" Cargo.toml
804+ cat Cargo.toml
805+
806+ - name : Install Rust toolchain
807+ uses : dsherret/rust-toolchain-file@v1
808+ - name : Set default rust toolchain
809+ run : rustup default $(rustup show active-toolchain | cut -d' ' -f1)
810+
811+ - name : Cache Rust dependencies
812+ uses : Swatinem/rust-cache@v2
813+ with :
814+ workspaces : ${{ github.workspace }}
815+ shared-key : spacetimedb
816+ # Let the main CI job save the cache since it builds the most things
817+ save-if : false
818+ prefix-key : v1
819+
820+ # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a.
821+ # ChatGPT suspects that this could be due to different build invocations using the same target dir,
822+ # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with
823+ # `cargo build --manifest-path` (which apparently build different dependency trees).
824+ # However, we've been unable to fix it so... /shrug
825+ - name : Check v8 outputs
826+ run : |
827+ find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true
828+ if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then
829+ echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
830+ cargo clean --release -p v8 || true
831+ cargo build --release -p v8
832+ fi
833+
834+ - name : Install SpacetimeDB CLI from the local checkout
835+ run : |
836+ export CARGO_HOME="$HOME/.cargo"
837+ echo "$CARGO_HOME/bin" >> "$GITHUB_PATH"
838+ cargo install --force --path crates/cli --locked --message-format=short
839+ cargo install --force --path crates/standalone --locked --message-format=short
840+ # Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
841+ ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime
842+
843+ - name : Generate client bindings
844+ working-directory : demo/Blackholio/server-rust
845+ run : bash ./generate.sh -y
846+
847+ - name : Check for changes
848+ run : |
849+ tools/check-diff.sh demo/Blackholio/client-godot/module_bindings || {
850+ echo 'Error: Godot bindings are dirty. Please run `demo/Blackholio/server-rust/generate.sh`.'
851+ exit 1
852+ }
853+
854+ - name : Patch SpacetimeDB Godot SDK dependency
855+ working-directory : demo/Blackholio/client-godot
856+ run : |
857+ dotnet remove package SpacetimeDB.ClientSDK.Godot
858+ dotnet add reference ../../../sdks/csharp/SpacetimeDB.ClientSDK.Godot.csproj
859+ cat blackholio.csproj
860+
861+ - name : Setup Godot
862+ uses : chickensoft-games/setup-godot@v2
863+ with :
864+ version : 4.6.2
865+ use-dotnet : true
866+
867+ - name : Restore Godot project
868+ working-directory : demo/Blackholio/client-godot
869+ run : dotnet restore --configfile ../../../NuGet.Config blackholio.csproj
870+
871+ - name : Build Godot project
872+ run : godot --headless --verbose --path demo/Blackholio/client-godot --build-solutions --quit
873+
874+ - name : Start SpacetimeDB
875+ run : |
876+ spacetime start &
877+ disown
878+
879+ - name : Publish godot-tests module to SpacetimeDB
880+ working-directory : demo/Blackholio/server-rust
881+ run : |
882+ spacetime login --server-issued-login local
883+ bash ./publish.sh
884+
885+ - name : Run Godot tests
886+ run : godot --headless --path demo/Blackholio/client-godot --scene res://tests/GodotPlayModeTests.tscn
887+
763888 csharp-testsuite :
764889 needs : [lints]
765890 runs-on : spacetimedb-new-runner-2
@@ -771,8 +896,6 @@ jobs:
771896 id : checkout-stdb
772897 uses : actions/checkout@v4
773898
774- # Run cheap .NET tests first. If those fail, no need to run expensive Unity tests.
775-
776899 - name : Setup dotnet
777900 uses : actions/setup-dotnet@v3
778901 with :
0 commit comments