Skip to content

Commit 396a59c

Browse files
committed
Add emscripten to GITHUB_PATH and clear NuGet packages in NativeAOT test
1 parent 586ddf9 commit 396a59c

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ jobs:
9898
cd $env:USERPROFILE\emsdk
9999
.\emsdk install 4.0.21
100100
.\emsdk activate 4.0.21
101+
# Add emscripten to PATH for subsequent steps and subprocesses
102+
$emsdkPath = "$env:USERPROFILE\emsdk\upstream\emscripten"
103+
Add-Content -Path $env:GITHUB_PATH -Value $emsdkPath
104+
Write-Host "Added $emsdkPath to PATH"
101105
102106
- name: Install psql (Windows)
103107
if: runner.os == 'Windows'

crates/smoketests/tests/smoketests/csharp_aot_module.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![allow(clippy::disallowed_macros)]
22
use spacetimedb_guard::ensure_binaries_built;
3-
use spacetimedb_smoketests::{require_dotnet, workspace_root};
3+
use spacetimedb_smoketests::{have_emscripten, require_dotnet, workspace_root};
44
use std::process::Command;
55

66
/// Test NativeAOT-LLVM build path for C# modules.
@@ -18,8 +18,8 @@ fn test_build_csharp_module_aot() {
1818
}
1919

2020
// Check for emscripten - fail with helpful message if not available
21-
let emscripten_check = Command::new("emcc").arg("--version").output();
22-
if emscripten_check.is_err() || !emscripten_check.unwrap().status.success() {
21+
// Uses have_emscripten() which checks for both `emcc` and `emcc.bat` on Windows
22+
if !have_emscripten() {
2323
panic!(
2424
"NativeAOT-LLVM test requires emscripten but it was not found.\n\
2525
Install from: https://emscripten.org/docs/getting_started/downloads.html\n\
@@ -30,23 +30,33 @@ fn test_build_csharp_module_aot() {
3030
let workspace = workspace_root();
3131
let _cli_path = ensure_binaries_built();
3232

33+
// Create isolated NuGet packages folder to avoid file lock conflicts
34+
// NativeAOT-LLVM packages contain DLLs that stay locked and interfere with other tests
35+
let nuget_packages_dir = tempfile::tempdir().expect("Failed to create temp directory for NuGet packages");
36+
3337
// Set EXPERIMENTAL_WASM_AOT=1 for this specific build
3438
// Build sdk-test-cs with NativeAOT-LLVM
3539
let mut cmd = Command::new("dotnet");
3640
cmd.arg("publish")
3741
.arg("-c")
3842
.arg("Release")
3943
.current_dir(workspace.join("modules/sdk-test-cs"))
40-
.env("EXPERIMENTAL_WASM_AOT", "1");
44+
.env("EXPERIMENTAL_WASM_AOT", "1")
45+
.env("NUGET_PACKAGES", nuget_packages_dir.path());
4146

4247
let output = cmd.output().expect("Failed to run dotnet publish");
48+
4349
assert!(
4450
output.status.success(),
4551
"NativeAOT-LLVM publish failed:\nstdout: {}\nstderr: {}",
4652
String::from_utf8_lossy(&output.stdout),
4753
String::from_utf8_lossy(&output.stderr)
4854
);
4955

56+
// Clean up temp dir explicitly to verify no file locks remain
57+
// This ensures subsequent tests can clear NuGet locals without conflicts
58+
drop(nuget_packages_dir);
59+
5060
// Verify StdbModule.wasm was produced
5161
let wasm_path = workspace.join("modules/sdk-test-cs/bin/Release/net8.0/wasi-wasm/publish/StdbModule.wasm");
5262
assert!(wasm_path.exists(), "StdbModule.wasm not found at {:?}", wasm_path);

0 commit comments

Comments
 (0)