Skip to content

Commit c9a899e

Browse files
committed
Debug
1 parent 5d6a89b commit c9a899e

File tree

1 file changed

+44
-39
lines changed

1 file changed

+44
-39
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 39 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,10 +44,6 @@ 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
5147
- name: Build and start database (Linux)
5248
if: runner.os == 'Linux'
5349
run: docker compose up -d
@@ -58,13 +54,11 @@ jobs:
5854
Start-Process target/debug/spacetimedb-cli.exe start
5955
cd modules
6056
# the sdk-manifests on windows-latest are messed up, so we need to update them
61-
dotnet workload config --update-mode manifests
57+
dotnet workload config --update-mode workload-set
6258
dotnet workload update
6359
- uses: actions/setup-python@v5
6460
with: { python-version: '3.12' }
6561
if: runner.os == 'Windows'
66-
- name: Install psycopg2
67-
run: python -m pip install psycopg2-binary
6862
- name: Run smoketests
6963
# Note: clear_database and replication only work in private
7064
run: python -m smoketests ${{ matrix.smoketest_args }} -x clear_database replication
@@ -247,7 +241,7 @@ jobs:
247241
name: Unreal Engine Tests
248242
# 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
249243
# a custom runner.
250-
runs-on: ubuntu-latest
244+
runs-on: spacetimedb-runner
251245
container:
252246
image: ghcr.io/epicgames/unreal-engine:dev-5.6
253247
credentials:
@@ -259,7 +253,7 @@ jobs:
259253
password: ${{ secrets.GHCR_TOKEN }}
260254
# Run as root because otherwise we get permission denied for various directories inside the container. I tried doing dances to allow it to run
261255
# without this (reassigning env vars and stuff), but was unable to get it to work and it felt like an uphill battle.
262-
# options: --user 0:0
256+
options: --user 0:0
263257
steps:
264258
# 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
265259
# commits though.
@@ -285,8 +279,42 @@ jobs:
285279
env:
286280
UE_ROOT_PATH: /home/ue4/UnrealEngine
287281
run: |
288-
cargo test
282+
# Ensure these mounts are owned by the user we'll run as
283+
for p in "$GITHUB_WORKSPACE" "$RUNNER_TEMP" "$RUNNER_TOOL_CACHE"; do
284+
[ -n "${p:-}" ] && [ -d "$p" ] && chown -R 1001:1001 "$p" || true
285+
done
289286
287+
# Create the build user if needed
288+
getent group 1001 >/dev/null || groupadd -g 1001 runnergrp
289+
getent passwd 1001 >/dev/null || useradd -u 1001 -g 1001 -m -s /bin/bash runnerusr
290+
291+
# Use the runner's tool cache so Rust persists across runs
292+
export CARGO_HOME="${RUNNER_TOOL_CACHE:-/tmp}/cargo"
293+
export RUSTUP_HOME="${RUNNER_TOOL_CACHE:-/tmp}/rustup"
294+
mkdir -p "$CARGO_HOME" "$RUSTUP_HOME"
295+
chown -R 1001:1001 "$CARGO_HOME" "$RUSTUP_HOME"
296+
297+
# Make sure curl exists
298+
apt-get update
299+
apt-get install -y curl ca-certificates
300+
301+
# Install rustup + toolchain for the 1001 user (rust-toolchain.toml will be honored)
302+
sudo -E -H -u runnerusr bash -lc '
303+
set -euxo pipefail
304+
export CARGO_HOME='"$CARGO_HOME"'
305+
export RUSTUP_HOME='"$RUSTUP_HOME"'
306+
export PATH="$CARGO_HOME/bin:$PATH"
307+
if ! command -v cargo >/dev/null 2>&1; then
308+
curl -sSf https://sh.rustup.rs | sh -s -- -y
309+
fi
310+
# Preload the toolchain requested by rust-toolchain.toml
311+
cd "$GITHUB_WORKSPACE"
312+
export PATH="$CARGO_HOME/bin:$PATH"
313+
rustup show >/dev/null
314+
cd "$GITHUB_WORKSPACE/sdks/unreal"
315+
cargo --version
316+
cargo test
317+
'
290318
cli_docs:
291319
name: Check CLI docs
292320
permissions: read-all
@@ -304,46 +332,23 @@ jobs:
304332
GIT_REF="${{ github.ref }}"
305333
fi
306334
echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
307-
308335
- name: Checkout sources
309336
uses: actions/checkout@v4
310337
with:
311338
ref: ${{ env.GIT_REF }}
312-
313-
- name: Set up Node.js
314-
uses: actions/setup-node@v4
315-
with:
316-
node-version: 18
317-
318-
- uses: pnpm/action-setup@v4
319-
with:
320-
run_install: true
321-
322-
- name: Get pnpm store directory
323-
shell: bash
324-
working-directory: sdks/typescript
325-
run: |
326-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
327-
328-
- uses: actions/cache@v4
329-
name: Setup pnpm cache
330-
with:
331-
path: ${{ env.STORE_PATH }}
332-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
333-
restore-keys: |
334-
${{ runner.os }}-pnpm-store-
335-
336339
- uses: dsherret/rust-toolchain-file@v1
337-
338340
- name: Check for docs change
339341
run: |
340342
cargo run --features markdown-docs -p spacetimedb-cli > docs/docs/cli-reference.md
341-
pnpm format
343+
cd docs
344+
# This is needed because our website doesn't render markdown quite properly.
345+
# See the README in docs for more details.
346+
sed -i'' -E 's!^(##) `(.*)`$!\1 \2!' docs/cli-reference.md
347+
sed -i'' -E 's!^(######) \*\*(.*)\*\*$!\1 <b>\2</b>!' docs/cli-reference.md
342348
git status
343349
if git diff --exit-code HEAD; then
344350
echo "No docs changes detected"
345351
else
346352
echo "It looks like the CLI docs have changed:"
347353
exit 1
348354
fi
349-

0 commit comments

Comments
 (0)