Skip to content

Commit ba27106

Browse files
committed
Merge remote-tracking branch 'origin/master' into phoebe/wasmtime-async
2 parents 54b7d5a + 34d8cd4 commit ba27106

916 files changed

Lines changed: 82948 additions & 2959 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.

.github/workflows/ci.yml

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
include:
2222
- { runner: spacetimedb-runner, smoketest_args: --docker }
2323
- { runner: windows-latest, smoketest_args: --no-build-cli }
24-
runner: [spacetimedb-runner, windows-latest]
24+
runner: [ spacetimedb-runner, windows-latest ]
2525
runs-on: ${{ matrix.runner }}
2626
steps:
2727
- name: Find Git ref
@@ -44,6 +44,10 @@ jobs:
4444
- uses: actions/setup-dotnet@v4
4545
with:
4646
global-json-file: modules/global.json
47+
- name: Install psql (Windows)
48+
if: runner.os == 'Windows'
49+
run: choco install psql -y --no-progress
50+
shell: powershell
4751
- name: Build and start database (Linux)
4852
if: runner.os == 'Linux'
4953
run: docker compose up -d
@@ -54,11 +58,13 @@ jobs:
5458
Start-Process target/debug/spacetimedb-cli.exe start
5559
cd modules
5660
# the sdk-manifests on windows-latest are messed up, so we need to update them
57-
dotnet workload config --update-mode workload-set
61+
dotnet workload config --update-mode manifests
5862
dotnet workload update
5963
- uses: actions/setup-python@v5
6064
with: { python-version: '3.12' }
6165
if: runner.os == 'Windows'
66+
- name: Install psycopg2
67+
run: python -m pip install psycopg2-binary
6268
- name: Run smoketests
6369
# Note: clear_database and replication only work in private
6470
run: python -m smoketests ${{ matrix.smoketest_args }} -x clear_database replication
@@ -97,9 +103,10 @@ jobs:
97103
run: |
98104
sudo mkdir /stdb
99105
sudo chmod 777 /stdb
100-
106+
101107
- name: Run cargo test
102-
run: cargo test --all
108+
#Note: Unreal tests will be run separately
109+
run: cargo test --all -- --skip unreal
103110

104111
- name: Check that the test outputs are up-to-date
105112
run: bash tools/check-diff.sh
@@ -237,6 +244,90 @@ jobs:
237244
cargo run --features github-token-auth --target ${{ matrix.target }} -p spacetimedb-update -- self-install --root-dir="${ROOT_DIR}" --yes
238245
"${ROOT_DIR}"/spacetime --root-dir="${ROOT_DIR}" help
239246
247+
unreal_engine_tests:
248+
name: Unreal Engine Tests
249+
# This can't go on e.g. ubuntu-latest because that runner runs out of disk space. ChatGPT suggested that the general solution tends to be to use
250+
# a custom runner.
251+
runs-on: spacetimedb-runner
252+
container:
253+
image: ghcr.io/epicgames/unreal-engine:dev-5.6
254+
credentials:
255+
# Note(bfops): I don't think that `github.actor` needs to match the user that the token is for, because I'm using a token for my account and
256+
# it seems to be totally happy.
257+
# However, the token needs to be for a user that has access to the EpicGames org (see
258+
# https://dev.epicgames.com/documentation/en-us/unreal-engine/downloading-source-code-in-unreal-engine?application_version=5.6)
259+
username: ${{ github.actor }}
260+
password: ${{ secrets.GHCR_TOKEN }}
261+
# Run as root because otherwise we get permission denied for various directories inside the container. I tried doing dances to allow it to run
262+
# without this (reassigning env vars and stuff), but was unable to get it to work and it felt like an uphill battle.
263+
options: --user 0:0
264+
steps:
265+
# 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
266+
# commits though.
267+
# - name: Find Git ref
268+
# env:
269+
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
270+
# shell: bash
271+
# run: |
272+
# PR_NUMBER="${{ github.event.inputs.pr_number || null }}"
273+
# if test -n "${PR_NUMBER}"; then
274+
# GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )"
275+
# else
276+
# GIT_REF="${{ github.ref }}"
277+
# fi
278+
# echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
279+
- name: Checkout sources
280+
uses: actions/checkout@v4
281+
with:
282+
ref: ${{ env.GIT_REF }}
283+
- uses: dsherret/rust-toolchain-file@v1
284+
- name: Run Unreal Engine tests
285+
working-directory: sdks/unreal
286+
env:
287+
UE_ROOT_PATH: /home/ue4/UnrealEngine
288+
run: |
289+
290+
apt-get update
291+
apt-get install -y acl curl ca-certificates
292+
293+
REPO="$GITHUB_WORKSPACE"
294+
# Let ue4 read/write the workspace & tool caches without changing ownership
295+
for p in "$REPO" "${RUNNER_TEMP:-/__t}" "${RUNNER_TOOL_CACHE:-/__t}"; do
296+
[ -d "$p" ] && setfacl -R -m u:ue4:rwX -m d:u:ue4:rwX "$p" || true
297+
done
298+
299+
# Rust tool caches live under the runner tool cache so they persist
300+
export CARGO_HOME="${RUNNER_TOOL_CACHE:-/__t}/cargo"
301+
export RUSTUP_HOME="${RUNNER_TOOL_CACHE:-/__t}/rustup"
302+
mkdir -p "$CARGO_HOME" "$RUSTUP_HOME"
303+
chown -R ue4:ue4 "$CARGO_HOME" "$RUSTUP_HOME"
304+
305+
# Make sure the UE build script is executable (and parents traversable)
306+
UE_DIR="${UE_ROOT_PATH:-/home/ue4/UnrealEngine}"
307+
chmod a+rx "$UE_DIR" "$UE_DIR/Engine" "$UE_DIR/Engine/Build" "$UE_DIR/Engine/Build/BatchFiles/Linux" || true
308+
chmod a+rx "$UE_DIR/Engine/Build/BatchFiles/Linux/Build.sh" || true
309+
310+
# Run the build & tests as ue4 (who owns the UE tree)
311+
sudo -E -H -u ue4 env \
312+
HOME=/home/ue4 \
313+
XDG_CONFIG_HOME=/home/ue4/.config \
314+
CARGO_HOME="$CARGO_HOME" \
315+
RUSTUP_HOME="$RUSTUP_HOME" \
316+
PATH="$CARGO_HOME/bin:$PATH" \
317+
bash -lc '
318+
set -euxo pipefail
319+
# Install rustup for ue4 if needed (uses the shared caches)
320+
if ! command -v cargo >/dev/null 2>&1; then
321+
curl -sSf https://sh.rustup.rs | sh -s -- -y
322+
fi
323+
rustup show >/dev/null
324+
git config --global --add safe.directory "$GITHUB_WORKSPACE" || true
325+
326+
cd "$GITHUB_WORKSPACE/sdks/unreal"
327+
cargo --version
328+
cargo test
329+
'
330+
240331
cli_docs:
241332
name: Check CLI docs
242333
permissions: read-all

.github/workflows/typescript-lint.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
run_install: true
2626

2727
- name: Get pnpm store directory
28-
working-directory: sdks/typescript
2928
shell: bash
3029
run: |
3130
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
@@ -39,5 +38,4 @@ jobs:
3938
${{ runner.os }}-pnpm-store-
4039
4140
- name: Lint
42-
working-directory: sdks/typescript
4341
run: pnpm lint

.github/workflows/typescript-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
run: pnpm build
5252

5353
- name: Run SDK tests
54-
working-directory: sdks/typescript/packages/sdk
54+
working-directory: sdks/typescript
5555
run: pnpm test
5656

5757
# - name: Extract SpacetimeDB branch name from file

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,6 @@ new.json
216216
# Keys
217217
*.pem
218218
.ok.sql
219+
220+
# Test data
221+
!crates/core/testdata/

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ pnpm-lock.yaml
33
dist
44
target
55
.github
6+
coverage

0 commit comments

Comments
 (0)