Skip to content

Commit 84726cf

Browse files
committed
Move NativeAOT-LLVM for .NET 8 job to smoketest
1 parent 6ea7178 commit 84726cf

3 files changed

Lines changed: 51 additions & 36 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -893,42 +893,6 @@ jobs:
893893
exit 1
894894
}
895895
896-
# NativeAOT-LLVM smoketest runs on Windows because runtime.linux-x64.Microsoft.DotNet.ILCompiler.LLVM
897-
# does not have 8.0.0 versions available on the dotnet-experimental NuGet feed.
898-
csharp-aot-smoketest:
899-
needs: [lints]
900-
runs-on: windows-latest
901-
timeout-minutes: 15
902-
steps:
903-
- name: Checkout repository
904-
uses: actions/checkout@v4
905-
906-
- name: Setup dotnet
907-
uses: actions/setup-dotnet@v3
908-
with:
909-
global-json-file: global.json
910-
911-
- name: Install emscripten (Windows)
912-
shell: pwsh
913-
run: |
914-
git clone https://github.com/emscripten-core/emsdk.git $env:USERPROFILE\emsdk
915-
cd $env:USERPROFILE\emsdk
916-
.\emsdk install 4.0.21
917-
.\emsdk activate 4.0.21
918-
919-
- name: Smoketest C# AOT build (NativeAOT-LLVM)
920-
shell: pwsh
921-
run: |
922-
$env:EXPERIMENTAL_WASM_AOT = "1"
923-
if (Test-Path "$env:USERPROFILE\emsdk\emsdk_env.ps1") {
924-
& "$env:USERPROFILE\emsdk\emsdk_env.ps1" | Out-Null
925-
}
926-
dotnet publish -c Release modules/sdk-test-cs
927-
if (-not (Test-Path "modules/sdk-test-cs/bin/Release/net8.0/wasi-wasm/publish/StdbModule.wasm")) {
928-
Write-Error "StdbModule.wasm not found"
929-
exit 1
930-
}
931-
932896
internal-tests:
933897
name: Internal Tests
934898
needs: [lints]
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#![allow(clippy::disallowed_macros)]
2+
use spacetimedb_guard::ensure_binaries_built;
3+
use spacetimedb_smoketests::{require_dotnet, workspace_root};
4+
use std::process::Command;
5+
6+
/// Test NativeAOT-LLVM build path for C# modules.
7+
/// Requires emscripten to be installed.
8+
/// Only runs on Windows since runtime.linux-x64.Microsoft.DotNet.ILCompiler.LLVM
9+
/// is not available on the dotnet-experimental NuGet feed.
10+
#[test]
11+
fn test_build_csharp_module_aot() {
12+
require_dotnet!();
13+
14+
// NativeAOT-LLVM is only available on Windows
15+
if std::env::consts::OS != "windows" {
16+
eprintln!("Skipping AOT test - NativeAOT-LLVM for .NET 8 only available on Windows");
17+
return;
18+
}
19+
20+
// Check for emscripten - skip if not available
21+
let emscripten_check = Command::new("emcc").arg("--version").output();
22+
if emscripten_check.is_err() || !emscripten_check.unwrap().status.success() {
23+
eprintln!("Skipping AOT test - emscripten not available");
24+
return;
25+
}
26+
27+
let workspace = workspace_root();
28+
let _cli_path = ensure_binaries_built();
29+
30+
// Set EXPERIMENTAL_WASM_AOT=1 for this specific build
31+
// Build sdk-test-cs with NativeAOT-LLVM
32+
let mut cmd = Command::new("dotnet");
33+
cmd.arg("publish")
34+
.arg("-c")
35+
.arg("Release")
36+
.current_dir(workspace.join("modules/sdk-test-cs"))
37+
.env("EXPERIMENTAL_WASM_AOT", "1");
38+
39+
let output = cmd.output().expect("Failed to run dotnet publish");
40+
assert!(
41+
output.status.success(),
42+
"NativeAOT-LLVM publish failed:\nstdout: {}\nstderr: {}",
43+
String::from_utf8_lossy(&output.stdout),
44+
String::from_utf8_lossy(&output.stderr)
45+
);
46+
47+
// Verify StdbModule.wasm was produced
48+
let wasm_path = workspace.join("modules/sdk-test-cs/bin/Release/net8.0/wasi-wasm/publish/StdbModule.wasm");
49+
assert!(wasm_path.exists(), "StdbModule.wasm not found at {:?}", wasm_path);
50+
}

crates/smoketests/tests/smoketests/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mod client_connection_errors;
99
mod confirmed_reads;
1010
mod connect_disconnect_from_cli;
1111
mod create_project;
12+
mod csharp_aot_module;
1213
mod csharp_module;
1314
mod default_module_clippy;
1415
mod delete_database;

0 commit comments

Comments
 (0)