Skip to content

Commit 3083c32

Browse files
committed
Merge remote-tracking branch 'origin/master' into kim/cloud/dev
2 parents cf10037 + b391d73 commit 3083c32

1,149 files changed

Lines changed: 80244 additions & 41095 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: 65 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,15 @@ jobs:
101101
102102
- name: Install psql (Windows)
103103
if: runner.os == 'Windows'
104-
run: choco install psql -y --no-progress
105-
shell: powershell
104+
shell: pwsh
105+
run: |
106+
# Fail properly if any individual command fails
107+
$ErrorActionPreference = 'Stop'
108+
$PSNativeCommandUseErrorActionPreference = $true
109+
choco install psql -y --no-progress
110+
# Check for existence, since `choco` doesn't seem to fail the step if it fails to install..
111+
# See https://github.com/clockworklabs/SpacetimeDB/pull/4399 for more background.
112+
Get-Command psql
106113
107114
- name: Update dotnet workloads
108115
if: runner.os == 'Windows'
@@ -171,132 +178,6 @@ jobs:
171178
exit 1
172179
}
173180
174-
smoketests-python:
175-
needs: [lints]
176-
name: Smoketests (Python Legacy) (${{matrix.name}})
177-
strategy:
178-
matrix:
179-
include:
180-
- name: Linux
181-
runner: spacetimedb-new-runner-2
182-
smoketest_args: --docker
183-
- name: Windows
184-
runner: windows-latest
185-
smoketest_args: --no-build-cli
186-
runs-on: ${{ matrix.runner }}
187-
timeout-minutes: 120
188-
env:
189-
CARGO_TARGET_DIR: ${{ github.workspace }}/target
190-
steps:
191-
- name: Find Git ref
192-
env:
193-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
194-
shell: bash
195-
run: |
196-
PR_NUMBER="${{ github.event.inputs.pr_number || null }}"
197-
if test -n "${PR_NUMBER}"; then
198-
GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )"
199-
else
200-
GIT_REF="${{ github.ref }}"
201-
fi
202-
echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
203-
- name: Checkout sources
204-
uses: actions/checkout@v4
205-
with:
206-
ref: ${{ env.GIT_REF }}
207-
- uses: dsherret/rust-toolchain-file@v1
208-
- name: Set default rust toolchain
209-
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
210-
- name: Cache Rust dependencies
211-
uses: Swatinem/rust-cache@v2
212-
with:
213-
workspaces: ${{ github.workspace }}
214-
shared-key: spacetimedb
215-
cache-on-failure: false
216-
cache-all-crates: true
217-
cache-workspace-crates: true
218-
prefix-key: v1
219-
220-
# This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a.
221-
# ChatGPT suspects that this could be due to different build invocations using the same target dir,
222-
# and this makes sense to me because we only see it in this job where we mix `cargo build -p` with
223-
# `cargo build --manifest-path` (which apparently build different dependency trees).
224-
# However, we've been unable to fix it so... /shrug
225-
- name: Check v8 outputs
226-
shell: bash
227-
run: |
228-
find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true
229-
if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then
230-
echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
231-
cargo clean -p v8 || true
232-
cargo build -p v8
233-
fi
234-
235-
- uses: actions/setup-dotnet@v4
236-
with:
237-
global-json-file: global.json
238-
239-
- name: Override NuGet packages
240-
shell: bash
241-
run: |
242-
dotnet pack -c Release crates/bindings-csharp/BSATN.Runtime
243-
dotnet pack -c Release crates/bindings-csharp/Runtime
244-
cd sdks/csharp
245-
./tools~/write-nuget-config.sh ../..
246-
247-
# nodejs and pnpm are required for the typescript quickstart smoketest
248-
- name: Set up Node.js
249-
uses: actions/setup-node@v4
250-
with:
251-
node-version: 22
252-
253-
- uses: pnpm/action-setup@v4
254-
with:
255-
run_install: true
256-
257-
- name: Install psql (Windows)
258-
if: runner.os == 'Windows'
259-
run: choco install psql -y --no-progress
260-
shell: powershell
261-
262-
- name: Build crates
263-
run: cargo build -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
264-
265-
- name: Build and start database (Linux)
266-
if: runner.os == 'Linux'
267-
run: |
268-
# Our .dockerignore omits `target`, which our CI Dockerfile needs.
269-
rm .dockerignore
270-
docker compose -f .github/docker-compose.yml up -d
271-
272-
- name: Build and start database (Windows)
273-
if: runner.os == 'Windows'
274-
run: |
275-
# Fail properly if any individual command fails
276-
$ErrorActionPreference = 'Stop'
277-
$PSNativeCommandUseErrorActionPreference = $true
278-
279-
Start-Process target/debug/spacetimedb-cli.exe -ArgumentList 'start --pg-port 5432'
280-
cd modules
281-
# the sdk-manifests on windows-latest are messed up, so we need to update them
282-
dotnet workload config --update-mode manifests
283-
dotnet workload update
284-
285-
- uses: actions/setup-python@v5
286-
with: { python-version: "3.12" }
287-
if: runner.os == 'Windows'
288-
289-
- name: Install python deps
290-
run: python -m pip install -r smoketests/requirements.txt
291-
292-
- name: Run Python smoketests
293-
# Note: clear_database and replication only work in private
294-
run: python -m smoketests ${{ matrix.smoketest_args }} -x clear_database replication teams
295-
296-
- name: Stop containers (Linux)
297-
if: always() && runner.os == 'Linux'
298-
run: docker compose -f .github/docker-compose.yml down
299-
300181
test:
301182
needs: [lints]
302183
name: Test Suite
@@ -1180,3 +1061,59 @@ jobs:
11801061
fi
11811062
11821063
echo "No Python smoketest changes detected."
1064+
1065+
smoketests_mod_rs_complete:
1066+
name: Check smoketests/mod.rs is complete
1067+
runs-on: ubuntu-latest
1068+
permissions:
1069+
contents: read
1070+
env:
1071+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
1072+
steps:
1073+
- name: Find Git ref
1074+
env:
1075+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1076+
shell: bash
1077+
run: |
1078+
PR_NUMBER="${{ github.event.inputs.pr_number || null }}"
1079+
if test -n "${PR_NUMBER}"; then
1080+
GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )"
1081+
else
1082+
GIT_REF="${{ github.ref }}"
1083+
fi
1084+
echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
1085+
- name: Checkout sources
1086+
uses: actions/checkout@v4
1087+
with:
1088+
ref: ${{ env.GIT_REF }}
1089+
- uses: dsherret/rust-toolchain-file@v1
1090+
- name: Set default rust toolchain
1091+
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
1092+
- name: Cache Rust dependencies
1093+
uses: Swatinem/rust-cache@v2
1094+
with:
1095+
workspaces: ${{ github.workspace }}
1096+
shared-key: spacetimedb
1097+
cache-on-failure: false
1098+
cache-all-crates: true
1099+
cache-workspace-crates: true
1100+
prefix-key: v1
1101+
1102+
# This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a.
1103+
# ChatGPT suspects that this could be due to different build invocations using the same target dir,
1104+
# and this makes sense to me because we only see it in this job where we mix `cargo build -p` with
1105+
# `cargo build --manifest-path` (which apparently build different dependency trees).
1106+
# However, we've been unable to fix it so... /shrug
1107+
- name: Check v8 outputs
1108+
shell: bash
1109+
run: |
1110+
find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true
1111+
if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then
1112+
echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
1113+
cargo clean -p v8 || true
1114+
cargo build -p v8
1115+
fi
1116+
1117+
- name: Verify crates/smoketests/tests/smoketests/mod.rs lists all entries
1118+
run: |
1119+
cargo ci smoketests check-mod-list

.github/workflows/package.yml

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ on:
44
push:
55
tags:
66
- '**'
7-
branches:
8-
- master
9-
- release/*
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
1011

1112
jobs:
1213
build-cli:
14+
if: ${{ !(startsWith(github.ref, 'refs/tags/') && matrix.target == 'x86_64-pc-windows-msvc') }}
1315
strategy:
1416
fail-fast: false
1517
matrix:
@@ -85,3 +87,89 @@ jobs:
8587
source_dir: build
8688
endpoint: https://nyc3.digitaloceanspaces.com
8789
destination_dir: ${{ steps.extract_branch.outputs.branch }}
90+
91+
build-cli-windows-signed:
92+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
93+
name: Build and sign CLI for x86_64 Windows
94+
runs-on: [self-hosted, windows, signing]
95+
environment: codesign
96+
concurrency:
97+
group: codesign-${{ github.ref }}
98+
cancel-in-progress: false
99+
100+
steps:
101+
- name: Checkout
102+
uses: actions/checkout@v3
103+
104+
- name: Install Rust
105+
uses: dsherret/rust-toolchain-file@v1
106+
107+
- name: Install rust target
108+
run: rustup target add x86_64-pc-windows-msvc
109+
110+
- name: Compile
111+
run: |
112+
cargo build --release --target x86_64-pc-windows-msvc -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
113+
114+
- name: Write certificate file
115+
shell: powershell
116+
env:
117+
DIGICERT_CERT_B64: ${{ secrets.DIGICERT_CERT_B64 }}
118+
run: |
119+
[IO.File]::WriteAllBytes("digicert.crt", [Convert]::FromBase64String($env:DIGICERT_CERT_B64))
120+
121+
- name: Sign binaries
122+
shell: powershell
123+
env:
124+
DIGICERT_KEYPAIR_ALIAS: ${{ secrets.DIGICERT_KEYPAIR_ALIAS }}
125+
run: |
126+
$ErrorActionPreference = 'Stop'
127+
$targetDir = Join-Path $env:GITHUB_WORKSPACE 'target\x86_64-pc-windows-msvc\release'
128+
$certFile = Join-Path $env:GITHUB_WORKSPACE 'digicert.crt'
129+
130+
$signtool = Get-Command signtool.exe -ErrorAction Stop
131+
132+
$files = @(
133+
(Join-Path $targetDir 'spacetimedb-update.exe'),
134+
(Join-Path $targetDir 'spacetimedb-cli.exe'),
135+
(Join-Path $targetDir 'spacetimedb-standalone.exe')
136+
)
137+
138+
foreach ($file in $files) {
139+
& $signtool.Path sign /csp "DigiCert Signing Manager KSP" /kc $env:DIGICERT_KEYPAIR_ALIAS /f $certFile /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $file
140+
& $signtool.Path verify /v /pa $file
141+
}
142+
143+
- name: Package (windows)
144+
shell: powershell
145+
run: |
146+
$ErrorActionPreference = 'Stop'
147+
New-Item -ItemType Directory -Force -Path build | Out-Null
148+
$releaseDir = Join-Path $env:GITHUB_WORKSPACE 'target\x86_64-pc-windows-msvc\release'
149+
150+
Copy-Item (Join-Path $releaseDir 'spacetimedb-update.exe') (Join-Path $env:GITHUB_WORKSPACE 'build\spacetimedb-update-x86_64-pc-windows-msvc.exe')
151+
Compress-Archive -Force -Path @(
152+
(Join-Path $releaseDir 'spacetimedb-cli.exe'),
153+
(Join-Path $releaseDir 'spacetimedb-standalone.exe')
154+
) -DestinationPath (Join-Path $env:GITHUB_WORKSPACE 'build\spacetime-x86_64-pc-windows-msvc.zip')
155+
156+
- name: Extract branch name
157+
shell: powershell
158+
run: |
159+
$ErrorActionPreference = 'Stop'
160+
$branch = $env:GITHUB_HEAD_REF
161+
if ([string]::IsNullOrEmpty($branch)) {
162+
$branch = $env:GITHUB_REF -replace '^refs/heads/', ''
163+
}
164+
"branch=$branch" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
165+
id: extract_branch
166+
167+
- name: Upload to DO Spaces
168+
uses: shallwefootball/s3-upload-action@master
169+
with:
170+
aws_key_id: ${{ secrets.AWS_KEY_ID }}
171+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
172+
aws_bucket: ${{ vars.AWS_BUCKET }}
173+
source_dir: build
174+
endpoint: https://nyc3.digitaloceanspaces.com
175+
destination_dir: ${{ steps.extract_branch.outputs.branch }}

0 commit comments

Comments
 (0)