Skip to content

Commit 86e8ae2

Browse files
[c#] Enable running the C# tests on linux (#1200)
* Enable running the Csharp tests on linux Signed-off-by: James Sturtevant <[email protected]> * fix ci Signed-off-by: James Sturtevant <[email protected]> * We don't have native aot packages for macos avaliable Signed-off-by: James Sturtevant <[email protected]> * Don't silently pass on macOS Instead just don't test on macos * Different github actions syntax --------- Signed-off-by: James Sturtevant <[email protected]> Co-authored-by: Alex Crichton <[email protected]>
1 parent 0e191cc commit 86e8ae2

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

.github/workflows/main.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ jobs:
6060
os: [ubuntu-latest, macos-latest, windows-latest]
6161
# moonbit removed from language matrix for now - causing CI failures
6262
lang: [c, rust, teavm-java, go, csharp]
63+
exclude:
64+
# For now csharp doesn't work on macos, so exclude it from testing.
65+
- os: macos-latest
66+
lang: csharp
6367
runs-on: ${{ matrix.os }}
6468
steps:
6569
- uses: actions/checkout@v4
@@ -73,7 +77,7 @@ jobs:
7377
if: matrix.lang == 'rust'
7478

7579
- uses: ./.github/actions/install-wasi-sdk
76-
if: matrix.lang == 'c' || (matrix.lang == 'csharp' && matrix.os == 'windows-latest')
80+
if: matrix.lang == 'c' || matrix.lang == 'csharp'
7781

7882
- name: Setup .NET
7983
uses: actions/setup-dotnet@v4

crates/csharp/src/csproj.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,20 @@ impl CSProjectLLVMBuilder {
9191
);
9292

9393
if self.aot {
94+
let os = match std::env::consts::OS {
95+
"windows" => "win",
96+
"linux" => std::env::consts::OS,
97+
other => todo!("OS {} not supported", other),
98+
};
99+
94100
csproj.push_str(
95-
r#"
101+
&format!(
102+
r#"
96103
<ItemGroup>
97104
<PackageReference Include="Microsoft.DotNet.ILCompiler.LLVM" Version="10.0.0-*" />
98-
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler.LLVM" Version="10.0.0-*" />
105+
<PackageReference Include="runtime.{os}-x64.Microsoft.DotNet.ILCompiler.LLVM" Version="10.0.0-*" />
99106
</ItemGroup>
100-
"#,
107+
"#),
101108
);
102109

103110
fs::write(

tests/runtime/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ fn tests(name: &str, dir_name: &str) -> Result<Vec<PathBuf>> {
659659
}
660660

661661
#[cfg(feature = "csharp")]
662-
if cfg!(windows) && !c_sharp.is_empty() {
662+
if !c_sharp.is_empty() {
663663
let (resolve, world) = resolve_wit_dir(&dir);
664664
for path in c_sharp.iter() {
665665
let world_name = &resolve.worlds[world].name;

0 commit comments

Comments
 (0)