CI - Clean up several scripts and call sites related to codegen (#3363)

# Description of Changes

* Small cleanups in `tools/check-diff.sh`
* Use `tools/check-diff.sh` wherever appropriate
* Simplify the `sdks/csharp/tools~/gen-*.sh` files after the repo merge

# API and ABI breaking changes

None.

# Expected complexity level and risk

1

# Testing

- [x] CI still passes

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
This commit is contained in:
Zeke Foppa
2025-10-10 07:23:18 -07:00
committed by GitHub
parent 619b8ce021
commit 1aa4084762
9 changed files with 21 additions and 37 deletions
+7 -15
View File
@@ -83,15 +83,11 @@ jobs:
CARGO_TARGET_DIR: demo/Blackholio/server-rust/target
- name: Check quickstart-chat bindings are up to date
working-directory: sdks/csharp/examples~/quickstart-chat
working-directory: sdks/csharp
run: |
bash ../../tools~/gen-quickstart.sh "${GITHUB_WORKSPACE}"
# This was copied from 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.*'
git diff --exit-code --ignore-matching-lines="$PATTERN" -- . || {
echo "Error: quickstart-chat bindings have changed. Please regenerate the bindings and commit them to this branch."
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
}
@@ -101,12 +97,8 @@ jobs:
- name: Check for changes
run: |
# This was copied from 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.*'
git diff --exit-code --ignore-matching-lines="$PATTERN" -- demo/Blackholio/client-unity/Assets/Scripts/autogen || {
echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch."
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
}
@@ -124,7 +116,7 @@ jobs:
disown
- name: Run regression tests
run: bash sdks/csharp/tools~/run-regression-tests.sh .
run: bash sdks/csharp/tools~/run-regression-tests.sh
- name: Publish unity-tests module to SpacetimeDB
working-directory: demo/Blackholio/server-rust
+2 -6
View File
@@ -102,14 +102,10 @@ jobs:
- name: Check for changes
working-directory: crates/bindings-typescript
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
"${GITHUB_WORKSPACE}"/tools/check-diff.sh examples/quickstart-chat/src/module_bindings || {
echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch."
exit 1
fi
}
# - name: Start SpacetimeDB
# run: |
@@ -3,8 +3,8 @@ See [SpacetimeDB](https://github.com/clockworklabs/SpacetimeDB)/modules/quicksta
## Regenerating bindings
To regenerate bindings: clone SpacetimeDB next to this repo, then in the root of this repo:
To regenerate bindings: clone SpacetimeDB next to this repo, then in `sdks/csharp` of this repo:
```bash
tools~/gen-quickstart.sh ../SpacetimeDB
```
tools~/gen-quickstart.sh
```
+1 -1
View File
@@ -2,9 +2,9 @@
set -ueo pipefail
STDB_PATH="$1"
SDK_PATH="$(dirname "$0")/.."
SDK_PATH="$(realpath "$SDK_PATH")"
STDB_PATH="$SDK_PATH/../.."
cargo build --manifest-path "$STDB_PATH/crates/standalone/Cargo.toml"
+1 -1
View File
@@ -2,9 +2,9 @@
set -ueo pipefail
STDB_PATH="$1"
SDK_PATH="$(dirname "$0")/.."
SDK_PATH="$(realpath "$SDK_PATH")"
STDB_PATH="$SDK_PATH/../.."
cargo build --manifest-path "$STDB_PATH/crates/standalone/Cargo.toml"
cargo run --manifest-path "$STDB_PATH/crates/cli/Cargo.toml" -- generate -y -l csharp -o "$SDK_PATH/examples~/quickstart-chat/client/module_bindings" --project-path "$SDK_PATH/examples~/quickstart-chat/server"
+1 -1
View File
@@ -2,9 +2,9 @@
set -ueo pipefail
STDB_PATH="$1"
SDK_PATH="$(dirname "$0")/.."
SDK_PATH="$(realpath "$SDK_PATH")"
STDB_PATH="$SDK_PATH/../.."
cargo build --manifest-path "$STDB_PATH/crates/standalone/Cargo.toml"
cargo run --manifest-path "$STDB_PATH/crates/cli/Cargo.toml" -- generate -y -l csharp -o "$SDK_PATH/examples~/regression-tests/client/module_bindings" --project-path "$SDK_PATH/examples~/regression-tests/server"
+3 -3
View File
@@ -4,12 +4,12 @@
set -ueo pipefail
STDB_PATH="$1"
SDK_PATH="$(dirname "$0")/.."
SDK_PATH="$(realpath "$SDK_PATH")"
STDB_PATH="$SDK_PATH/../.."
# Regenerate Bindings
"$SDK_PATH/tools~/gen-regression-tests.sh" "$STDB_PATH"
"$SDK_PATH/tools~/gen-regression-tests.sh"
# Build and run SpacetimeDB server
cargo build --manifest-path "$STDB_PATH/crates/standalone/Cargo.toml"
@@ -27,4 +27,4 @@ cargo run --manifest-path "$STDB_PATH/crates/cli/Cargo.toml" call republish-test
cd "$SDK_PATH/examples~/regression-tests/client" && dotnet run -c Debug
# Run client for republishing module test
cd "$SDK_PATH/examples~/regression-tests/republishing/client" && dotnet run -c Debug
cd "$SDK_PATH/examples~/regression-tests/republishing/client" && dotnet run -c Debug
+3 -3
View File
@@ -9,9 +9,9 @@ SDK_PATH="$(dirname "$0")/.."
SDK_PATH="$(realpath "$SDK_PATH")"
"$SDK_PATH/tools~/write-nuget-config.sh" "$STDB_PATH"
"$SDK_PATH/tools~/gen-client-api.sh" "$STDB_PATH"
"$SDK_PATH/tools~/gen-quickstart.sh" "$STDB_PATH"
"$SDK_PATH/tools~/gen-regression-tests.sh" "$STDB_PATH"
"$SDK_PATH/tools~/gen-client-api.sh"
"$SDK_PATH/tools~/gen-quickstart.sh"
"$SDK_PATH/tools~/gen-regression-tests.sh"
dotnet nuget locals all --clear
dotnet pack "$STDB_PATH/crates/bindings-csharp"
rm -rf "$SDK_PATH/packages"
-4
View File
@@ -4,13 +4,9 @@
SUBDIR="${1:-.}" # Default to '.' (the whole repo) if no argument given
# We need to figure out the root to make this work when called from a directory within the repo.
GIT_ROOT="$(git rev-parse --show-toplevel)"
# We have a comment in every generated file that has the version and git hash, so these would change with every commit.
# We ignore them to avoid having to regen files for every commit unrelated to code gen.
PATTERN='^// This was generated using spacetimedb cli version.*'
failed=0
git diff --exit-code --ignore-matching-lines="$PATTERN" -- "$SUBDIR"