Skip to content

Commit a8170a6

Browse files
Merge branch 'master' into jlarabie/unreal-sdk-2.0
2 parents 59d348d + e991421 commit a8170a6

203 files changed

Lines changed: 6588 additions & 2588 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/package.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ on:
77
branches:
88
- master
99
- release/*
10+
permissions:
11+
contents: read
1012

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

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,6 @@ nul
264264
# AI agent config
265265
.codex
266266
.claude
267+
268+
# Any local file
269+
*.local

.rustfmt.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
max_width = 120
2-
edition = "2021"
2+
style_edition = "2021"
3+
edition = "2024"

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ debug = true
107107

108108
[workspace.package]
109109
version = "2.0.3"
110-
edition = "2021"
110+
edition = "2024"
111111
# update rust-toolchain.toml too!
112112
rust-version = "1.93.0"
113113

crates/auth/src/identity.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ impl TryInto<SpacetimeIdentityClaims> for IncomingClaims {
115115

116116
let computed_identity = Identity::from_claims(&self.issuer, &self.subject);
117117
// If an identity is provided, it must match the computed identity.
118-
if let Some(token_identity) = self.identity {
119-
if token_identity != computed_identity {
120-
return Err(anyhow::anyhow!(
118+
if let Some(token_identity) = self.identity
119+
&& token_identity != computed_identity
120+
{
121+
return Err(anyhow::anyhow!(
121122
"Identity mismatch: token identity {token_identity:?} does not match computed identity {computed_identity:?}",
122123
));
123-
}
124124
}
125125

126126
Ok(SpacetimeIdentityClaims {

crates/bench/src/schemas.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ pub fn table_name<T: BenchTable>(style: IndexStrategy) -> TableName {
171171
#[derive(Clone)]
172172
pub struct XorShiftLite(pub u64);
173173
impl XorShiftLite {
174-
fn gen(&mut self) -> u64 {
174+
fn r#gen(&mut self) -> u64 {
175175
let old = self.0;
176176
self.0 ^= self.0 << 13;
177177
self.0 ^= self.0 >> 7;
@@ -189,36 +189,36 @@ pub trait RandomTable {
189189
/// Then in the filter benchmarks, `mean_result_count = table_size / buckets`.
190190
///
191191
/// Currently the same number of buckets is used for all attributes.
192-
fn gen(id: u32, rng: &mut XorShiftLite, buckets: u64) -> Self;
192+
fn r#gen(id: u32, rng: &mut XorShiftLite, buckets: u64) -> Self;
193193
}
194194

195195
impl RandomTable for u32_u64_str {
196-
fn gen(id: u32, rng: &mut XorShiftLite, buckets: u64) -> Self {
197-
let name = nth_name(rng.gen() % buckets).into();
198-
let age = rng.gen() % buckets;
196+
fn r#gen(id: u32, rng: &mut XorShiftLite, buckets: u64) -> Self {
197+
let name = nth_name(rng.r#gen() % buckets).into();
198+
let age = rng.r#gen() % buckets;
199199
u32_u64_str { id, name, age }
200200
}
201201
}
202202

203203
impl RandomTable for u32_u64_u64 {
204-
fn gen(id: u32, rng: &mut XorShiftLite, buckets: u64) -> Self {
205-
let x = rng.gen() % buckets;
206-
let y = rng.gen() % buckets;
204+
fn r#gen(id: u32, rng: &mut XorShiftLite, buckets: u64) -> Self {
205+
let x = rng.r#gen() % buckets;
206+
let y = rng.r#gen() % buckets;
207207
u32_u64_u64 { id, x, y }
208208
}
209209
}
210210

211211
impl RandomTable for u64_u64_u32 {
212-
fn gen(id: u32, rng: &mut XorShiftLite, buckets: u64) -> Self {
213-
let x = rng.gen() % buckets;
214-
let y = rng.gen() % buckets;
212+
fn r#gen(id: u32, rng: &mut XorShiftLite, buckets: u64) -> Self {
213+
let x = rng.r#gen() % buckets;
214+
let y = rng.r#gen() % buckets;
215215
u64_u64_u32 { x, y, id }
216216
}
217217
}
218218

219219
pub fn create_sequential<T: RandomTable>(seed: u64, count: u32, buckets: u64) -> Vec<T> {
220220
let mut rng = XorShiftLite(seed);
221-
(0..count).map(|id| T::gen(id, &mut rng, buckets)).collect()
221+
(0..count).map(|id| T::r#gen(id, &mut rng, buckets)).collect()
222222
}
223223

224224
/// Create a table whose first `identical` rows are identical except for their `id` column.
@@ -237,13 +237,13 @@ pub fn create_partly_identical<T: RandomTable>(seed: u64, identical: u64, total:
237237
for _ in 0..identical {
238238
// clone to preserve rng state
239239
let mut rng_ = rng.clone();
240-
result.push(T::gen(id as u32, &mut rng_, buckets));
240+
result.push(T::r#gen(id as u32, &mut rng_, buckets));
241241
id += 1;
242242
}
243243
// advance rng
244-
drop(T::gen(id as u32, &mut rng, buckets));
244+
drop(T::r#gen(id as u32, &mut rng, buckets));
245245
for _ in identical..total {
246-
result.push(T::gen(id as u32, &mut rng, buckets));
246+
result.push(T::r#gen(id as u32, &mut rng, buckets));
247247
id += 1;
248248
}
249249
result
@@ -254,8 +254,8 @@ pub fn create_random<T: RandomTable>(seed: u64, count: u32, buckets: u64) -> Vec
254254
let mut rng = XorShiftLite(seed);
255255
(0..count)
256256
.map(|_| {
257-
let id = (rng.gen() % (u32::MAX as u64)) as u32;
258-
T::gen(id, &mut rng, buckets)
257+
let id = (rng.r#gen() % (u32::MAX as u64)) as u32;
258+
T::r#gen(id, &mut rng, buckets)
259259
})
260260
.collect()
261261
}
@@ -362,7 +362,7 @@ mod tests {
362362
}
363363
// sample some earlier names to make sure we haven't overlapped
364364
for _ in 0..30 {
365-
let prev = rng.gen() % n;
365+
let prev = rng.r#gen() % n;
366366
assert!(
367367
name != nth_name(prev),
368368
"names should not repeat, but {}->{} and {}->{}",

crates/bench/src/sqlite.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ fn memo_query<F: FnOnce() -> String>(bench_name: BenchName, table_id: &str, gene
227227
// fast path
228228
let queries = QUERIES.read().unwrap();
229229

230-
if let Some(bench_queries) = queries.get(&bench_name) {
231-
if let Some(query) = bench_queries.get(table_id) {
232-
return query.clone();
233-
}
230+
if let Some(bench_queries) = queries.get(&bench_name)
231+
&& let Some(query) = bench_queries.get(table_id)
232+
{
233+
return query.clone();
234234
}
235235

236236
// slow path

crates/bindings-csharp/Codegen.Tests/fixtures/diag/Lib.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,17 @@ public MyStruct(int x)
441441
[SpacetimeDB.Index.BTree(Accessor = "TestIndexWithoutColumns")]
442442
[SpacetimeDB.Index.BTree(Accessor = "TestIndexWithEmptyColumns", Columns = [])]
443443
[SpacetimeDB.Index.BTree(Accessor = "TestUnknownColumns", Columns = ["UnknownColumn"])]
444+
[SpacetimeDB.Index.BTree(Columns = ["SelfIndexingColumn"])]
445+
[SpacetimeDB.Index.BTree(
446+
Name = "TestCanonicalNameWithoutAccessor",
447+
Columns = ["SecondaryIndexingColumn"]
448+
)]
444449
public partial struct TestIndexIssues
445450
{
446451
[SpacetimeDB.Index.BTree(Accessor = "TestUnexpectedColumns", Columns = ["UnexpectedColumn"])]
447452
public int SelfIndexingColumn;
453+
454+
public int SecondaryIndexingColumn;
448455
}
449456

450457
[SpacetimeDB.Table(

0 commit comments

Comments
 (0)