Skip to content

Commit 28e764c

Browse files
authored
Merge branch 'master' into drogus/fix-basic-rust-template
2 parents ced72fc + 05ecc80 commit 28e764c

27 files changed

Lines changed: 1104 additions & 652 deletions

File tree

.github/workflows/ci.yml

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ 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+
3038
steps:
3139
- name: Find Git ref
3240
env:
@@ -63,6 +71,10 @@ jobs:
6371
if: runner.os == 'Windows'
6472
run: choco install psql -y --no-progress
6573
shell: powershell
74+
- name: Start Docker daemon
75+
if: runner.os == 'Linux'
76+
run: /usr/local/bin/start-docker.sh
77+
6678
- name: Build and start database (Linux)
6779
if: runner.os == 'Linux'
6880
run: docker compose up -d
@@ -93,7 +105,11 @@ jobs:
93105

94106
test:
95107
name: Test Suite
96-
runs-on: spacetimedb-runner
108+
runs-on: spacetimedb-new-runner
109+
container:
110+
image: localhost:5000/spacetimedb-ci:latest
111+
options: >-
112+
--privileged
97113
steps:
98114
- name: Find Git ref
99115
env:
@@ -140,8 +156,9 @@ jobs:
140156
#Note: Unreal tests will be run separately
141157
run: cargo test --all -- --skip unreal
142158

159+
# The fallocate tests have been flakely when running in parallel
143160
- name: Run fallocate tests
144-
run: cargo test -p spacetimedb-durability --features fallocate
161+
run: cargo test -p spacetimedb-durability --features fallocate -- --test-threads=1
145162

146163
- name: Check that the test outputs are up-to-date
147164
run: bash tools/check-diff.sh
@@ -157,7 +174,11 @@ jobs:
157174

158175
lints:
159176
name: Lints
160-
runs-on: spacetimedb-runner
177+
runs-on: spacetimedb-new-runner
178+
container:
179+
image: localhost:5000/spacetimedb-ci:latest
180+
options: >-
181+
--privileged
161182
steps:
162183
- name: Checkout sources
163184
uses: actions/checkout@v3
@@ -196,7 +217,11 @@ jobs:
196217
197218
wasm_bindings:
198219
name: Build and test wasm bindings
199-
runs-on: spacetimedb-runner
220+
runs-on: spacetimedb-new-runner
221+
container:
222+
image: localhost:5000/spacetimedb-ci:latest
223+
options: >-
224+
--privileged
200225
steps:
201226
- uses: actions/checkout@v3
202227

@@ -221,7 +246,11 @@ jobs:
221246

222247
publish_checks:
223248
name: Check that packages are publishable
224-
runs-on: ubuntu-latest
249+
runs-on: spacetimedb-new-runner
250+
container:
251+
image: localhost:5000/spacetimedb-ci:latest
252+
options: >-
253+
--privileged
225254
permissions: read-all
226255
steps:
227256
- uses: actions/checkout@v3
@@ -231,11 +260,12 @@ jobs:
231260
venv/bin/pip3 install argparse toml
232261
- name: Run checks
233262
run: |
263+
set -ueo pipefail
234264
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
265+
ROOTS=(spacetimedb spacetimedb-sdk)
266+
CRATES=$(venv/bin/python3 tools/find-publish-list.py --recursive --directories --quiet "${ROOTS[@]}")
267+
for crate_dir in $CRATES; do
268+
if ! venv/bin/python3 tools/crate-publish-checks.py "${crate_dir}"; then
239269
FAILED=$(( $FAILED + 1 ))
240270
fi
241271
done
@@ -288,7 +318,7 @@ jobs:
288318
name: Unreal Engine Tests
289319
# 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
290320
# a custom runner.
291-
runs-on: spacetimedb-runner
321+
runs-on: spacetimedb-new-runner
292322
# Skip if this is an external contribution. GitHub secrets will be empty, so the step would fail anyway.
293323
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }}
294324
container:
@@ -367,13 +397,17 @@ jobs:
367397
368398
cd "$GITHUB_WORKSPACE/sdks/unreal"
369399
cargo --version
370-
cargo test
400+
cargo test -- --test-threads=1
371401
'
372402
373403
cli_docs:
374404
name: Check CLI docs
375405
permissions: read-all
376-
runs-on: ubuntu-latest
406+
runs-on: spacetimedb-new-runner
407+
container:
408+
image: localhost:5000/spacetimedb-ci:latest
409+
options: >-
410+
--privileged
377411
steps:
378412
- name: Find Git ref
379413
env:

.github/workflows/csharp-test.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ concurrency:
1212

1313
jobs:
1414
unity-testsuite:
15-
runs-on: spacetimedb-runner
15+
runs-on: spacetimedb-new-runner
16+
container:
17+
image: localhost:5000/spacetimedb-ci:latest
18+
options: >-
19+
--privileged
20+
--cgroupns=host
1621
# Cancel any previous testsuites running on the same PR and/or ref.
1722
concurrency:
1823
group: unity-test-${{ github.event.pull_request.number || github.ref }}
@@ -81,7 +86,7 @@ jobs:
8186
cargo install --force --path crates/cli --locked --message-format=short
8287
cargo install --force --path crates/standalone --locked --message-format=short
8388
# Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
84-
ln -sf $HOME/.cargo/bin/spacetimedb-cli $HOME/.cargo/bin/spacetime
89+
ln -sf $CARGO_HOME/bin/spacetimedb-cli $CARGO_HOME/bin/spacetime
8590
env:
8691
# Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice.
8792
CARGO_TARGET_DIR: demo/Blackholio/server-rust/target
@@ -157,6 +162,9 @@ jobs:
157162
key: Unity-${{ github.head_ref }}
158163
restore-keys: Unity-
159164

165+
# We need this to support "Docker in Docker"
166+
- name: Start Docker daemon
167+
run: /usr/local/bin/start-docker.sh
160168
- name: Run Unity tests
161169
uses: game-ci/unity-test-runner@v4
162170
with:

.github/workflows/discord-posts.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
if: github.event.pull_request.merged == true &&
1111
github.event.pull_request.base.ref == 'master'
1212
env:
13-
CHECK_NAME: Internal Tests
1413
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1514
steps:
1615
- name: Set up GitHub CLI
@@ -21,31 +20,31 @@ jobs:
2120
sudo apt-get update
2221
sudo apt-get install -y gh
2322
24-
- name: Fetch Check Run Results
25-
run: |
26-
RESULT="$(gh pr checks "${{github.event.pull_request.html_url}}" --json 'workflow,state' |
27-
jq -r ".[] | select(.workflow==\"${CHECK_NAME}\").state")"
28-
29-
if [ -z "$RESULT" ]; then
30-
RESULT="The check did not run!"
31-
fi
32-
33-
echo "CHECK_RESULT=${RESULT}" >> $GITHUB_ENV
34-
3523
- name: Send Discord notification
3624
env:
3725
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
3826
PR_TITLE: ${{ github.event.pull_request.title }}
3927
PR_NUMBER: ${{ github.event.pull_request.number }}
4028
PR_URL: ${{ github.event.pull_request.html_url }}
41-
CHECK_RESULT: ${{ env.CHECK_RESULT }}
4229
MENTION_ON_FAILURE: ${{ secrets.DEV_OPS_ROLE_ID }}
4330
run: |
4431
message="PR merged: [(#${PR_NUMBER}) ${PR_TITLE}](<${PR_URL}>)"
45-
message+=$'\n'
46-
message+="${CHECK_NAME} result: ${CHECK_RESULT}"
4732
# Note that anything besides success is treated as a failure (e.g. if the check did not run at all, or if it is still pending).
48-
if [[ "${CHECK_RESULT}" != "SUCCESS" ]]; then
33+
FAILED_CHECKS="$(
34+
gh pr checks "${{github.event.pull_request.html_url}}" \
35+
--json 'workflow,state,name' |
36+
jq '.[]
37+
| select(.workflow != "Discord notifications")
38+
| select(.state != "SUCCESS" and .state != "NEUTRAL")
39+
' |
40+
jq -r '"\(.workflow) / \(.name): \(.state)"'
41+
)"
42+
message+=$'\n'
43+
if [[ -z "${FAILED_CHECKS}" ]]; then
44+
message+='All checks passed.'
45+
else
46+
message+="${FAILED_CHECKS}"
47+
message+=$'\n'
4948
# This uses special Discord syntax for pinging a particular role.
5049
# Note the '&' - this is the difference between pinging a *role* and pinging a *person*.
5150
message+=" (cc <@&${MENTION_ON_FAILURE}>)"

.github/workflows/internal-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
script: |
2727
const targetOwner = 'clockworklabs';
2828
const targetRepo = 'SpacetimeDBPrivate';
29-
const workflowId = 'internal-tests.yml';
29+
const workflowId = 'ci.yml';
3030
const targetRef = 'master';
3131
// Use the ref for pull requests because the head sha is brittle (github does some extra dance where it merges in master).
3232
const publicRef = (context.eventName === 'pull_request') ? context.payload.pull_request.head.ref : context.sha;
@@ -63,7 +63,7 @@ jobs:
6363
per_page: 50,
6464
});
6565
66-
const expectedName = `Internal Tests [${publicRef}]`;
66+
const expectedName = `CI [public_ref=${publicRef}]`;
6767
const candidates = runsResp.data.workflow_runs
6868
.filter(r => r.name === expectedName && new Date(r.created_at) >= new Date(preDispatch))
6969
.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ enum-map = "2.6.3"
175175
env_logger = "0.10"
176176
ethnum = { version = "1.5.0", features = ["serde"] }
177177
flate2 = "1.0.24"
178+
flume = { version = "0.11", default-features = false, features = ["async"] }
178179
foldhash = "0.1.4"
179180
fs-err = "2.9.0"
180181
fs_extra = "1.3.0"

crates/cli/src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub async fn database_identity(
2323
}
2424
spacetime_dns(config, name_or_identity, server)
2525
.await?
26-
.with_context(|| format!("the dns resolution of `{name_or_identity}` failed."))
26+
.with_context(|| format!("failed to find database `{name_or_identity}`."))
2727
}
2828

2929
pub(crate) trait ResponseExt: Sized {

0 commit comments

Comments
 (0)