Skip to content

Commit 667db18

Browse files
authored
Merge branch 'master' into fix/csharp-escape-keywords-4529
2 parents e49364a + 68022eb commit 667db18

213 files changed

Lines changed: 9058 additions & 2137 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/check-merge-labels.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@ name: Check merge labels
22

33
on:
44
pull_request:
5-
types: [labeled, unlabeled]
5+
types: [opened, reopened, synchronize, labeled, unlabeled]
66
merge_group:
7+
78
permissions: read-all
89

910
jobs:
1011
label_checks:
12+
name: Check merge labels
1113
runs-on: ubuntu-latest
1214
steps:
13-
- id: manually_blocked
14-
if: |
15-
contains(github.event.pull_request.labels.*.name, 'do not merge')
15+
- if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'do not merge')
1616
run: |
1717
echo "This is labeled \"Do not merge\"."
1818
exit 1
19+
20+
# If we're in a merge queue, the PR has already passed checks these checks before being added to the queue.
21+
- if: github.event_name == 'merge_group'
22+
run: echo "Merge group run; skipping merge-label checks."

.github/workflows/ci.yml

Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -178,132 +178,6 @@ jobs:
178178
exit 1
179179
}
180180
181-
smoketests-python:
182-
needs: [lints]
183-
name: Smoketests (Python Legacy) (${{matrix.name}})
184-
strategy:
185-
matrix:
186-
include:
187-
- name: Linux
188-
runner: spacetimedb-new-runner-2
189-
smoketest_args: --docker
190-
- name: Windows
191-
runner: windows-latest
192-
smoketest_args: --no-build-cli
193-
runs-on: ${{ matrix.runner }}
194-
timeout-minutes: 120
195-
env:
196-
CARGO_TARGET_DIR: ${{ github.workspace }}/target
197-
steps:
198-
- name: Find Git ref
199-
env:
200-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
201-
shell: bash
202-
run: |
203-
PR_NUMBER="${{ github.event.inputs.pr_number || null }}"
204-
if test -n "${PR_NUMBER}"; then
205-
GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )"
206-
else
207-
GIT_REF="${{ github.ref }}"
208-
fi
209-
echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
210-
- name: Checkout sources
211-
uses: actions/checkout@v4
212-
with:
213-
ref: ${{ env.GIT_REF }}
214-
- uses: dsherret/rust-toolchain-file@v1
215-
- name: Set default rust toolchain
216-
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
217-
- name: Cache Rust dependencies
218-
uses: Swatinem/rust-cache@v2
219-
with:
220-
workspaces: ${{ github.workspace }}
221-
shared-key: spacetimedb
222-
cache-on-failure: false
223-
cache-all-crates: true
224-
cache-workspace-crates: true
225-
prefix-key: v1
226-
227-
# This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a.
228-
# ChatGPT suspects that this could be due to different build invocations using the same target dir,
229-
# and this makes sense to me because we only see it in this job where we mix `cargo build -p` with
230-
# `cargo build --manifest-path` (which apparently build different dependency trees).
231-
# However, we've been unable to fix it so... /shrug
232-
- name: Check v8 outputs
233-
shell: bash
234-
run: |
235-
find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true
236-
if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then
237-
echo "Could not find v8 output file librusty_v8.a; rebuilding manually."
238-
cargo clean -p v8 || true
239-
cargo build -p v8
240-
fi
241-
242-
- uses: actions/setup-dotnet@v4
243-
with:
244-
global-json-file: global.json
245-
246-
- name: Override NuGet packages
247-
shell: bash
248-
run: |
249-
dotnet pack -c Release crates/bindings-csharp/BSATN.Runtime
250-
dotnet pack -c Release crates/bindings-csharp/Runtime
251-
cd sdks/csharp
252-
./tools~/write-nuget-config.sh ../..
253-
254-
# nodejs and pnpm are required for the typescript quickstart smoketest
255-
- name: Set up Node.js
256-
uses: actions/setup-node@v4
257-
with:
258-
node-version: 22
259-
260-
- uses: pnpm/action-setup@v4
261-
with:
262-
run_install: true
263-
264-
- name: Install psql (Windows)
265-
if: runner.os == 'Windows'
266-
run: choco install psql -y --no-progress
267-
shell: powershell
268-
269-
- name: Build crates
270-
run: cargo build -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
271-
272-
- name: Build and start database (Linux)
273-
if: runner.os == 'Linux'
274-
run: |
275-
# Our .dockerignore omits `target`, which our CI Dockerfile needs.
276-
rm .dockerignore
277-
docker compose -f .github/docker-compose.yml up -d
278-
279-
- name: Build and start database (Windows)
280-
if: runner.os == 'Windows'
281-
run: |
282-
# Fail properly if any individual command fails
283-
$ErrorActionPreference = 'Stop'
284-
$PSNativeCommandUseErrorActionPreference = $true
285-
286-
Start-Process target/debug/spacetimedb-cli.exe -ArgumentList 'start --pg-port 5432'
287-
cd modules
288-
# the sdk-manifests on windows-latest are messed up, so we need to update them
289-
dotnet workload config --update-mode manifests
290-
dotnet workload update
291-
292-
- uses: actions/setup-python@v5
293-
with: { python-version: "3.12" }
294-
if: runner.os == 'Windows'
295-
296-
- name: Install python deps
297-
run: python -m pip install -r smoketests/requirements.txt
298-
299-
- name: Run Python smoketests
300-
# Note: clear_database and replication only work in private
301-
run: python -m smoketests ${{ matrix.smoketest_args }} -x clear_database replication teams
302-
303-
- name: Stop containers (Linux)
304-
if: always() && runner.os == 'Linux'
305-
run: docker compose -f .github/docker-compose.yml down
306-
307181
test:
308182
needs: [lints]
309183
name: Test Suite

.github/workflows/package.yml

Lines changed: 41 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ permissions:
1111

1212
jobs:
1313
build-cli:
14-
if: ${{ !(startsWith(github.ref, 'refs/tags/') && matrix.target == 'x86_64-pc-windows-msvc') }}
1514
strategy:
1615
fail-fast: false
1716
matrix:
@@ -51,81 +50,45 @@ jobs:
5150
- name: Install rust target
5251
run: rustup target add ${{ matrix.target }}
5352

54-
- name: Compile
55-
run: |
56-
cargo build --release --target ${{ matrix.target }} -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
57-
58-
- name: Package (unix)
59-
if: ${{ runner.os != 'Windows' }}
60-
shell: bash
61-
run: |
62-
mkdir build
63-
cd target/${{matrix.target}}/release
64-
cp spacetimedb-update ../../../build/spacetimedb-update-${{matrix.target}}
65-
tar -czf ../../../build/spacetime-${{matrix.target}}.tar.gz spacetimedb-{cli,standalone}
66-
67-
- name: Package (windows)
53+
- name: Add signtool.exe to PATH
6854
if: ${{ runner.os == 'Windows' }}
69-
shell: bash
55+
shell: pwsh
7056
run: |
71-
mkdir build
72-
cd target/${{matrix.target}}/release
73-
cp spacetimedb-update.exe ../../../build/spacetimedb-update-${{matrix.target}}.exe
74-
7z a ../../../build/spacetime-${{matrix.target}}.zip spacetimedb-cli.exe spacetimedb-standalone.exe
75-
76-
- name: Extract branch name
77-
shell: bash
78-
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
79-
id: extract_branch
80-
81-
- name: Upload to DO Spaces
82-
uses: shallwefootball/s3-upload-action@master
83-
with:
84-
aws_key_id: ${{ secrets.AWS_KEY_ID }}
85-
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
86-
aws_bucket: ${{ vars.AWS_BUCKET }}
87-
source_dir: build
88-
endpoint: https://nyc3.digitaloceanspaces.com
89-
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
57+
$root = "${env:ProgramFiles(x86)}\Windows Kits\10\bin"
58+
$signtool = Get-ChildItem $root -Recurse -Filter signtool.exe -ErrorAction SilentlyContinue |
59+
Where-Object { $_.FullName -match '\\x64\\signtool\.exe$' } |
60+
Sort-Object FullName -Descending |
61+
Select-Object -First 1
10662
107-
- name: Install rust target
108-
run: rustup target add x86_64-pc-windows-msvc
63+
if (-not $signtool) { throw "signtool.exe not found under $root" }
10964
110-
- name: Compile
111-
run: |
112-
cargo build --release --target x86_64-pc-windows-msvc -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
65+
"Found: $($signtool.FullName)"
66+
$dir = Split-Path $signtool.FullName
67+
Add-Content -Path $env:GITHUB_PATH -Value $dir
11368
114-
- name: Write certificate file
69+
- name: Write certificate file for signing
70+
if: ${{ runner.os == 'Windows' }}
11571
shell: powershell
11672
env:
11773
DIGICERT_CERT_B64: ${{ secrets.DIGICERT_CERT_B64 }}
11874
run: |
119-
[IO.File]::WriteAllBytes("digicert.crt", [Convert]::FromBase64String($env:DIGICERT_CERT_B64))
75+
[IO.File]::WriteAllBytes("digicert.pfx", [Convert]::FromBase64String($env:DIGICERT_CERT_B64))
12076
121-
- name: Sign binaries
77+
- name: Compile
78+
run: |
79+
cargo build --release --target ${{ matrix.target }} -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
80+
81+
- name: Sign binaries for Windows
82+
# Disabled for now since the current flow isn't working.
83+
if: false
84+
#if: ${{ runner.os == 'Windows' }}
12285
shell: powershell
12386
env:
12487
DIGICERT_KEYPAIR_ALIAS: ${{ secrets.DIGICERT_KEYPAIR_ALIAS }}
12588
run: |
12689
$ErrorActionPreference = 'Stop'
12790
$targetDir = Join-Path $env:GITHUB_WORKSPACE 'target\x86_64-pc-windows-msvc\release'
128-
$certFile = Join-Path $env:GITHUB_WORKSPACE 'digicert.crt'
91+
$certFile = Join-Path $env:GITHUB_WORKSPACE 'digicert.pfx'
12992
13093
$signtool = Get-Command signtool.exe -ErrorAction Stop
13194
@@ -136,32 +99,31 @@ jobs:
13699
)
137100
138101
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
102+
& $signtool.Path sign /f $certFile /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $file
140103
& $signtool.Path verify /v /pa $file
141104
}
142105
143-
- name: Package (windows)
144-
shell: powershell
106+
- name: Package (unix)
107+
if: ${{ runner.os != 'Windows' }}
108+
shell: bash
145109
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'
110+
mkdir build
111+
cd target/${{matrix.target}}/release
112+
cp spacetimedb-update ../../../build/spacetimedb-update-${{matrix.target}}
113+
tar -czf ../../../build/spacetime-${{matrix.target}}.tar.gz spacetimedb-{cli,standalone}
149114
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')
115+
- name: Package (windows)
116+
if: ${{ runner.os == 'Windows' }}
117+
shell: bash
118+
run: |
119+
mkdir build
120+
cd target/${{matrix.target}}/release
121+
cp spacetimedb-update.exe ../../../build/spacetimedb-update-${{matrix.target}}.exe
122+
7z a ../../../build/spacetime-${{matrix.target}}.zip spacetimedb-cli.exe spacetimedb-standalone.exe
155123
156124
- 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
125+
shell: bash
126+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
165127
id: extract_branch
166128

167129
- name: Upload to DO Spaces

0 commit comments

Comments
 (0)