Skip to content

Commit 502384e

Browse files
Merge remote-tracking branch 'upstream/master'
2 parents 2787392 + df035c4 commit 502384e

266 files changed

Lines changed: 15563 additions & 6800 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ rustflags = ["--cfg", "tokio_unstable"]
33

44
[alias]
55
bump-versions = "run -p upgrade-version --"
6+
ci = "run -p ci --"
67

78
[target.x86_64-pc-windows-msvc]
89
# Use a different linker. Otherwise, the build fails with some obscure linker error that

.github/workflows/ci.yml

Lines changed: 70 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ jobs:
6060
with:
6161
workspaces: ${{ github.workspace }}
6262
shared-key: spacetimedb
63-
cache-on-failure: true
63+
cache-on-failure: false
6464
cache-all-crates: true
6565
cache-workspace-crates: true
66+
prefix-key: v1
6667

6768
- uses: actions/setup-dotnet@v4
6869
with:
@@ -113,7 +114,7 @@ jobs:
113114
run: python -m pip install -r smoketests/requirements.txt
114115
- name: Run smoketests
115116
# Note: clear_database and replication only work in private
116-
run: python -m smoketests ${{ matrix.smoketest_args }} -x clear_database replication teams
117+
run: cargo ci smoketests -- ${{ matrix.smoketest_args }} -x clear_database replication teams
117118
- name: Stop containers (Linux)
118119
if: always() && runner.os == 'Linux'
119120
run: docker compose -f .github/docker-compose.yml down
@@ -153,6 +154,7 @@ jobs:
153154
shared-key: spacetimedb
154155
# Let the smoketests job save the cache since it builds the most things
155156
save-if: false
157+
prefix-key: v1
156158

157159
- uses: actions/setup-dotnet@v3
158160
with:
@@ -167,34 +169,12 @@ jobs:
167169
with:
168170
run_install: true
169171

170-
- name: Create /stdb dir
171-
run: |
172-
sudo mkdir /stdb
173-
sudo chmod 777 /stdb
174-
175172
- name: Build typescript module sdk
176173
working-directory: crates/bindings-typescript
177174
run: pnpm build
178175

179-
- name: Run cargo test
180-
#Note: Unreal tests will be run separately
181-
run: cargo test --all -- --skip unreal
182-
183-
# The fallocate tests have been flakely when running in parallel
184-
- name: Run fallocate tests
185-
run: cargo test -p spacetimedb-durability --features fallocate -- --test-threads=1
186-
187-
- name: Check that the test outputs are up-to-date
188-
run: bash tools/check-diff.sh
189-
190-
- name: Ensure C# autogen bindings are up-to-date
191-
run: |
192-
cargo run -p spacetimedb-codegen --example regen-csharp-moduledef
193-
bash tools/check-diff.sh crates/bindings-csharp
194-
195-
- name: C# bindings tests
196-
working-directory: crates/bindings-csharp
197-
run: dotnet test -warnaserror
176+
- name: Run tests
177+
run: cargo ci test
198178

199179
lints:
200180
name: Lints
@@ -219,35 +199,14 @@ jobs:
219199
shared-key: spacetimedb
220200
# Let the smoketests job save the cache since it builds the most things
221201
save-if: false
202+
prefix-key: v1
222203

223204
- uses: actions/setup-dotnet@v3
224205
with:
225206
global-json-file: global.json
226207

227-
- name: Run cargo fmt
228-
run: cargo fmt --all -- --check
229-
230-
- name: Run cargo clippy
231-
run: cargo clippy --all --tests --benches -- -D warnings
232-
233-
- name: Run C# formatting check
234-
working-directory: crates/bindings-csharp
235-
run: |
236-
dotnet tool restore
237-
dotnet csharpier --check .
238-
239-
- name: Run `cargo doc` for bindings crate
240-
# `bindings` is the only crate we care strongly about documenting,
241-
# since we link to its docs.rs from our website.
242-
# We won't pass `--no-deps`, though,
243-
# since we want everything reachable through it to also work.
244-
# This includes `sats` and `lib`.
245-
working-directory: crates/bindings
246-
env:
247-
# Make `cargo doc` exit with error on warnings, most notably broken links
248-
RUSTDOCFLAGS: '--deny warnings'
249-
run: |
250-
cargo doc
208+
- name: Run ci lint
209+
run: cargo ci lint
251210

252211
wasm_bindings:
253212
name: Build and test wasm bindings
@@ -271,22 +230,10 @@ jobs:
271230
shared-key: spacetimedb
272231
# Let the smoketests job save the cache since it builds the most things
273232
save-if: false
233+
prefix-key: v1
274234

275235
- name: Run bindgen tests
276-
run: cargo test -p spacetimedb-codegen
277-
278-
# Make sure the `Cargo.lock` file reflects the latest available versions.
279-
# This is what users would end up with on a fresh module, so we want to
280-
# catch any compile errors arising from a different transitive closure
281-
# of dependencies than what is in the workspace lock file.
282-
#
283-
# For context see also: https://github.com/clockworklabs/SpacetimeDB/pull/2714
284-
- name: Update dependencies
285-
run: cargo update
286-
287-
- name: Build module-test
288-
run: cargo run -p spacetimedb-cli -- build --project-path modules/module-test
289-
236+
run: cargo ci wasm-bindings
290237

291238
publish_checks:
292239
name: Check that packages are publishable
@@ -350,6 +297,7 @@ jobs:
350297

351298
- name: Build spacetimedb-update
352299
run: cargo build --features github-token-auth --target ${{ matrix.target }} -p spacetimedb-update
300+
if: runner.os == 'Windows'
353301

354302
- name: Run self-install
355303
env:
@@ -362,6 +310,13 @@ jobs:
362310
# happens very frequently on the `macos-runner`, but we haven't seen it on any others).
363311
cargo run --features github-token-auth --target ${{ matrix.target }} -p spacetimedb-update -- self-install --root-dir="${ROOT_DIR}" --yes
364312
"${ROOT_DIR}"/spacetime --root-dir="${ROOT_DIR}" help
313+
if: runner.os == 'Windows'
314+
315+
- name: Test spacetimedb-update
316+
env:
317+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
318+
run: cargo ci update-flow --target=${{ matrix.target }} --github-token-auth
319+
if: runner.os != 'Windows'
365320

366321
unreal_engine_tests:
367322
name: Unreal Engine Tests
@@ -386,20 +341,20 @@ jobs:
386341
# without this (reassigning env vars and stuff), but was unable to get it to work and it felt like an uphill battle.
387342
options: --user 0:0
388343
steps:
389-
# Uncomment this before merging so that it will run properly if run manually through the GH actions flow. It was playing weird with rolled back
390-
# commits though.
391-
# - name: Find Git ref
392-
# env:
393-
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
394-
# shell: bash
395-
# run: |
396-
# PR_NUMBER="${{ github.event.inputs.pr_number || null }}"
397-
# if test -n "${PR_NUMBER}"; then
398-
# GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )"
399-
# else
400-
# GIT_REF="${{ github.ref }}"
401-
# fi
402-
# echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
344+
# Uncomment this before merging so that it will run properly if run manually through the GH actions flow. It was playing weird with rolled back
345+
# commits though.
346+
# - name: Find Git ref
347+
# env:
348+
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
349+
# shell: bash
350+
# run: |
351+
# PR_NUMBER="${{ github.event.inputs.pr_number || null }}"
352+
# if test -n "${PR_NUMBER}"; then
353+
# GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )"
354+
# else
355+
# GIT_REF="${{ github.ref }}"
356+
# fi
357+
# echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
403358
- name: Checkout sources
404359
uses: actions/checkout@v4
405360
with:
@@ -452,6 +407,33 @@ jobs:
452407
cargo test -- --test-threads=1
453408
'
454409
410+
ci_command_docs:
411+
name: Check CI command docs
412+
runs-on: ubuntu-latest
413+
steps:
414+
- name: Find Git ref
415+
env:
416+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
417+
shell: bash
418+
run: |
419+
PR_NUMBER="${{ github.event.inputs.pr_number || null }}"
420+
if test -n "${PR_NUMBER}"; then
421+
GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )"
422+
else
423+
GIT_REF="${{ github.ref }}"
424+
fi
425+
echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
426+
427+
- name: Checkout sources
428+
uses: actions/checkout@v4
429+
with:
430+
ref: ${{ env.GIT_REF }}
431+
432+
- uses: dsherret/rust-toolchain-file@v1
433+
434+
- name: Check for docs change
435+
run: cargo ci self-docs --check
436+
455437
cli_docs:
456438
name: Check CLI docs
457439
permissions: read-all
@@ -512,18 +494,11 @@ jobs:
512494
shared-key: spacetimedb
513495
# Let the smoketests job save the cache since it builds the most things
514496
save-if: false
497+
prefix-key: v1
515498

516499
- name: Check for docs change
517500
run: |
518-
cargo run --features markdown-docs -p spacetimedb-cli > docs/docs/cli-reference.md
519-
pnpm format
520-
git status
521-
if git diff --exit-code HEAD -- docs/docs/cli-reference.md; then
522-
echo "No docs changes detected"
523-
else
524-
echo "It looks like the CLI docs have changed:"
525-
exit 1
526-
fi
501+
cargo ci cli-docs
527502
528503
unity-testsuite:
529504
# Skip if this is an external contribution.
@@ -575,7 +550,7 @@ jobs:
575550
cat Cargo.toml
576551
577552
- name: Install Rust toolchain
578-
uses: dtolnay/rust-toolchain@stable
553+
uses: dsherret/rust-toolchain-file@v1
579554

580555
- name: Cache Rust dependencies
581556
uses: Swatinem/rust-cache@v2
@@ -584,6 +559,7 @@ jobs:
584559
shared-key: spacetimedb
585560
# Let the main CI job save the cache since it builds the most things
586561
save-if: false
562+
prefix-key: v1
587563

588564
- name: Install SpacetimeDB CLI from the local checkout
589565
run: |
@@ -609,7 +585,7 @@ jobs:
609585
enable_pr_comment: ${{ github.event_name == 'pull_request' }}
610586
target_path: sdks/csharp
611587
env:
612-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
588+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
613589

614590
- name: Start SpacetimeDB
615591
run: |
@@ -643,12 +619,12 @@ jobs:
643619
- name: Run Unity tests
644620
uses: game-ci/unity-test-runner@v4
645621
with:
646-
unityVersion: 2022.3.32f1 # Adjust Unity version to a valid tag
647-
projectPath: demo/Blackholio/client-unity # Path to the Unity project subdirectory
622+
unityVersion: 2022.3.32f1 # Adjust Unity version to a valid tag
623+
projectPath: demo/Blackholio/client-unity # Path to the Unity project subdirectory
648624
githubToken: ${{ secrets.GITHUB_TOKEN }}
649625
testMode: playmode
650626
useHostNetwork: true
651-
artifactsPath: ""
627+
artifactsPath: ''
652628
env:
653629
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
654630
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
@@ -699,7 +675,7 @@ jobs:
699675
run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln
700676

701677
- name: Install Rust toolchain
702-
uses: dtolnay/rust-toolchain@stable
678+
uses: dsherret/rust-toolchain-file@v1
703679

704680
- name: Cache Rust dependencies
705681
uses: Swatinem/rust-cache@v2
@@ -708,6 +684,7 @@ jobs:
708684
shared-key: spacetimedb
709685
# Let the main CI job save the cache since it builds the most things
710686
save-if: false
687+
prefix-key: v1
711688

712689
- name: Install SpacetimeDB CLI from the local checkout
713690
run: |

.github/workflows/typescript-test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
# echo "Using SpacetimeDB branch from file: $branch"
8282

8383
- name: Install Rust toolchain
84-
uses: dtolnay/rust-toolchain@stable
84+
uses: dsherret/rust-toolchain-file@v1
8585

8686
- name: Cache Rust dependencies
8787
uses: Swatinem/rust-cache@v2
@@ -90,6 +90,7 @@ jobs:
9090
shared-key: spacetimedb
9191
# Let the main CI job save the cache since it builds the most things
9292
save-if: false
93+
prefix-key: v1
9394

9495
- name: Install SpacetimeDB CLI from the local checkout
9596
run: |

0 commit comments

Comments
 (0)