@@ -22,11 +22,20 @@ jobs:
2222 name : Smoketests
2323 strategy :
2424 matrix :
25+ runner : [spacetimedb-new-runner, windows-latest]
2526 include :
26- - { runner: spacetimedb-runner, smoketest_args: --docker }
27- - { runner: windows-latest, smoketest_args: --no-build-cli }
28- runner : [ spacetimedb-runner, windows-latest ]
27+ - runner : spacetimedb-new-runner
28+ smoketest_args : --docker
29+ container :
30+ image : localhost:5000/spacetimedb-ci:latest
31+ options : --privileged
32+ - runner : windows-latest
33+ smoketest_args : --no-build-cli
34+ container : null
2935 runs-on : ${{ matrix.runner }}
36+ container : ${{ matrix.container }}
37+ env :
38+ CARGO_TARGET_DIR : ${{ github.workspace }}/target
3039 steps :
3140 - name : Find Git ref
3241 env :
4554 with :
4655 ref : ${{ env.GIT_REF }}
4756 - uses : dsherret/rust-toolchain-file@v1
57+ - name : Cache Rust dependencies
58+ uses : Swatinem/rust-cache@v2
59+ with :
60+ workspaces : ${{ github.workspace }}
61+ shared-key : spacetimedb
62+ cache-on-failure : true
63+ cache-all-crates : true
64+ cache-workspace-crates : true
65+
4866 - uses : actions/setup-dotnet@v4
4967 with :
5068 global-json-file : global.json
@@ -63,17 +81,25 @@ jobs:
6381 if : runner.os == 'Windows'
6482 run : choco install psql -y --no-progress
6583 shell : powershell
84+ - name : Build crates
85+ run : cargo build -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
86+ - name : Start Docker daemon
87+ if : runner.os == 'Linux'
88+ run : /usr/local/bin/start-docker.sh
89+
6690 - name : Build and start database (Linux)
6791 if : runner.os == 'Linux'
68- run : docker compose up -d
92+ run : |
93+ # Our .dockerignore omits `target`, which our CI Dockerfile needs.
94+ rm .dockerignore
95+ docker compose -f .github/docker-compose.yml up -d
6996 - name : Build and start database (Windows)
7097 if : runner.os == 'Windows'
7198 run : |
7299 # Fail properly if any individual command fails
73100 $ErrorActionPreference = 'Stop'
74101 $PSNativeCommandUseErrorActionPreference = $true
75102
76- cargo build -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
77103 Start-Process target/debug/spacetimedb-cli.exe -ArgumentList 'start --pg-port 5432'
78104 cd modules
79105 # the sdk-manifests on windows-latest are messed up, so we need to update them
@@ -83,17 +109,23 @@ jobs:
83109 with : { python-version: '3.12' }
84110 if : runner.os == 'Windows'
85111 - name : Install python deps
86- run : python -m pip install psycopg2-binary xmltodict
112+ run : python -m pip install -r smoketests/requirements.txt
87113 - name : Run smoketests
88114 # Note: clear_database and replication only work in private
89115 run : python -m smoketests ${{ matrix.smoketest_args }} -x clear_database replication teams
90116 - name : Stop containers (Linux)
91117 if : always() && runner.os == 'Linux'
92- run : docker compose down
118+ run : docker compose -f .github/docker-compose.yml down
93119
94120 test :
95121 name : Test Suite
96- runs-on : spacetimedb-runner
122+ runs-on : spacetimedb-new-runner
123+ container :
124+ image : localhost:5000/spacetimedb-ci:latest
125+ options : >-
126+ --privileged
127+ env :
128+ CARGO_TARGET_DIR : ${{ github.workspace }}/target
97129 steps :
98130 - name : Find Git ref
99131 env :
@@ -113,6 +145,13 @@ jobs:
113145 ref : ${{ env.GIT_REF }}
114146
115147 - uses : dsherret/rust-toolchain-file@v1
148+ - name : Cache Rust dependencies
149+ uses : Swatinem/rust-cache@v2
150+ with :
151+ workspaces : ${{ github.workspace }}
152+ shared-key : spacetimedb
153+ # Let the smoketests job save the cache since it builds the most things
154+ save-if : false
116155
117156 - uses : actions/setup-dotnet@v3
118157 with :
@@ -140,8 +179,9 @@ jobs:
140179 # Note: Unreal tests will be run separately
141180 run : cargo test --all -- --skip unreal
142181
182+ # The fallocate tests have been flakely when running in parallel
143183 - name : Run fallocate tests
144- run : cargo test -p spacetimedb-durability --features fallocate
184+ run : cargo test -p spacetimedb-durability --features fallocate -- --test-threads=1
145185
146186 - name : Check that the test outputs are up-to-date
147187 run : bash tools/check-diff.sh
@@ -157,14 +197,28 @@ jobs:
157197
158198 lints :
159199 name : Lints
160- runs-on : spacetimedb-runner
200+ runs-on : spacetimedb-new-runner
201+ container :
202+ image : localhost:5000/spacetimedb-ci:latest
203+ options : >-
204+ --privileged
205+ env :
206+ CARGO_TARGET_DIR : ${{ github.workspace }}/target
161207 steps :
162208 - name : Checkout sources
163209 uses : actions/checkout@v3
164210
165211 - uses : dsherret/rust-toolchain-file@v1
166212 - run : echo ::add-matcher::.github/workflows/rust_matcher.json
167213
214+ - name : Cache Rust dependencies
215+ uses : Swatinem/rust-cache@v2
216+ with :
217+ workspaces : ${{ github.workspace }}
218+ shared-key : spacetimedb
219+ # Let the smoketests job save the cache since it builds the most things
220+ save-if : false
221+
168222 - uses : actions/setup-dotnet@v3
169223 with :
170224 global-json-file : global.json
@@ -196,13 +250,27 @@ jobs:
196250
197251 wasm_bindings :
198252 name : Build and test wasm bindings
199- runs-on : spacetimedb-runner
253+ runs-on : spacetimedb-new-runner
254+ container :
255+ image : localhost:5000/spacetimedb-ci:latest
256+ options : >-
257+ --privileged
258+ env :
259+ CARGO_TARGET_DIR : ${{ github.workspace }}/target
200260 steps :
201261 - uses : actions/checkout@v3
202262
203263 - uses : dsherret/rust-toolchain-file@v1
204264 - run : echo ::add-matcher::.github/workflows/rust_matcher.json
205265
266+ - name : Cache Rust dependencies
267+ uses : Swatinem/rust-cache@v2
268+ with :
269+ workspaces : ${{ github.workspace }}
270+ shared-key : spacetimedb
271+ # Let the smoketests job save the cache since it builds the most things
272+ save-if : false
273+
206274 - name : Run bindgen tests
207275 run : cargo test -p spacetimedb-codegen
208276
@@ -221,7 +289,11 @@ jobs:
221289
222290 publish_checks :
223291 name : Check that packages are publishable
224- runs-on : ubuntu-latest
292+ runs-on : spacetimedb-new-runner
293+ container :
294+ image : localhost:5000/spacetimedb-ci:latest
295+ options : >-
296+ --privileged
225297 permissions : read-all
226298 steps :
227299 - uses : actions/checkout@v3
@@ -231,11 +303,12 @@ jobs:
231303 venv/bin/pip3 install argparse toml
232304 - name : Run checks
233305 run : |
306+ set -ueo pipefail
234307 FAILED=0
235- # This definition of ROOTS and invocation of find-publish-list.py is copied from publish-crates.sh
236- ROOTS=(bindings sdk cli standalone )
237- for crate in $(venv/bin/python3 tools/find-publish-list.py --recursive --quiet "${ROOTS[@]}") ; do
238- if ! venv/bin/python3 tools/crate-publish-checks.py "crates/$crate "; then
308+ ROOTS=(spacetimedb spacetimedb-sdk)
309+ CRATES=$(venv/bin/python3 tools/find-publish-list.py --recursive --directories --quiet "${ROOTS[@]}" )
310+ for crate_dir in $CRATES ; do
311+ if ! venv/bin/python3 tools/crate-publish-checks.py "${crate_dir} "; then
239312 FAILED=$(( $FAILED + 1 ))
240313 fi
241314 done
@@ -288,7 +361,7 @@ jobs:
288361 name : Unreal Engine Tests
289362 # 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
290363 # a custom runner.
291- runs-on : spacetimedb-runner
364+ runs-on : spacetimedb-new- runner
292365 # Skip if this is an external contribution. GitHub secrets will be empty, so the step would fail anyway.
293366 if : ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }}
294367 container :
@@ -367,13 +440,19 @@ jobs:
367440
368441 cd "$GITHUB_WORKSPACE/sdks/unreal"
369442 cargo --version
370- cargo test
443+ cargo test -- --test-threads=1
371444 '
372445
373446 cli_docs :
374447 name : Check CLI docs
375448 permissions : read-all
376- runs-on : ubuntu-latest
449+ runs-on : spacetimedb-new-runner
450+ container :
451+ image : localhost:5000/spacetimedb-ci:latest
452+ options : >-
453+ --privileged
454+ env :
455+ CARGO_TARGET_DIR : ${{ github.workspace }}/target
377456 steps :
378457 - name : Find Git ref
379458 env :
@@ -417,6 +496,14 @@ jobs:
417496
418497 - uses : dsherret/rust-toolchain-file@v1
419498
499+ - name : Cache Rust dependencies
500+ uses : Swatinem/rust-cache@v2
501+ with :
502+ workspaces : ${{ github.workspace }}
503+ shared-key : spacetimedb
504+ # Let the smoketests job save the cache since it builds the most things
505+ save-if : false
506+
420507 - name : Check for docs change
421508 run : |
422509 cargo run --features markdown-docs -p spacetimedb-cli > docs/docs/cli-reference.md
0 commit comments