8080 os : [ubuntu-latest, macos-latest, windows-latest]
8181 # moonbit removed from language matrix for now - causing CI failures
8282 lang : [c, rust, csharp, cpp, go]
83- exclude :
84- # For now csharp doesn't work on macos, so exclude it from testing.
85- - os : macos-latest
86- lang : csharp
8783 runs-on : ${{ matrix.os }}
84+ env :
85+ RUNTIMELAB_COMMIT : ' 4cac3ab5c8e97fda69c23dfca41ace964babc05e'
8886 steps :
8987 - uses : actions/checkout@v4
9088 with :
@@ -103,7 +101,14 @@ jobs:
103101 uses : actions/setup-dotnet@v4
104102 with :
105103 dotnet-version : ' 9.x'
106- if : matrix.lang == 'csharp'
104+ if : matrix.lang == 'csharp' && runner.os != 'macOS'
105+
106+ - name : Setup .NET 10 (macOS)
107+ uses : actions/setup-dotnet@v4
108+ with :
109+ dotnet-version : ' 10.x'
110+ dotnet-quality : ' preview'
111+ if : matrix.lang == 'csharp' && runner.os == 'macOS'
107112
108113 - name : Setup Go
109114 uses : actions/setup-go@v5
@@ -125,6 +130,55 @@ jobs:
125130 shell: powershell
126131 if: matrix.os == 'windows-latest' && matrix.lang == 'moonbit'
127132
133+ # macOS C# requires locally-built ILC packages since no osx-arm64
134+ # packages are published on NuGet.
135+ - name : Cache runtimelab ILC packages
136+ id : cache-runtimelab
137+ uses : actions/cache@v4
138+ with :
139+ path : runtimelab-packages
140+ key : runtimelab-macos-arm64-${{ env.RUNTIMELAB_COMMIT }}
141+ if : runner.os == 'macOS' && matrix.lang == 'csharp'
142+
143+ - name : Install LLVM 18 for runtimelab build
144+ if : runner.os == 'macOS' && matrix.lang == 'csharp' && steps.cache-runtimelab.outputs.cache-hit != 'true'
145+ run : brew install llvm@18
146+
147+ - name : Checkout runtimelab
148+ uses : actions/checkout@v4
149+ with :
150+ repository : dotnet/runtimelab
151+ ref : ${{ env.RUNTIMELAB_COMMIT }}
152+ path : runtimelab
153+ if : runner.os == 'macOS' && matrix.lang == 'csharp' && steps.cache-runtimelab.outputs.cache-hit != 'true'
154+
155+ - name : Build runtimelab ILC packages
156+ if : runner.os == 'macOS' && matrix.lang == 'csharp' && steps.cache-runtimelab.outputs.cache-hit != 'true'
157+ run : |
158+ cd runtimelab
159+ ln -sf $WASI_SDK_PATH src/mono/wasi/wasi-sdk
160+ mkdir -p src/mono/wasi/include
161+
162+ # Build wasi libs and packages
163+ ./build.sh clr.aot+libs -c Release -a wasm -os wasi /p:NuGetAudit=false
164+ ./build.sh nativeaot.packages -c Release -a wasm -os wasi /p:NuGetAudit=false
165+
166+ # Build host compiler, libs, WASM JIT, and packages
167+ ./build.sh clr.aot -c Release /p:NuGetAudit=false
168+ ./build.sh libs -c Release /p:NuGetAudit=false
169+ LLVM_CMAKE_CONFIG_RELEASE=$(brew --prefix llvm@18)/lib/cmake/llvm \
170+ src/coreclr/build-runtime.sh -arm64 -release -os osx -outputrid osx-arm64 -component wasmjit
171+ ./build.sh nativeaot.packages -c Release /p:NuGetAudit=false
172+
173+ mkdir -p ../runtimelab-packages
174+ cp artifacts/packages/Release/Shipping/*.nupkg ../runtimelab-packages/
175+
176+ - name : Set ILC env vars for macOS C#
177+ if : runner.os == 'macOS' && matrix.lang == 'csharp'
178+ run : |
179+ echo "ILC_VERSION=10.0.0-dev" >> $GITHUB_ENV
180+ echo "ILC_PACKAGES_PATH=${{ github.workspace }}/runtimelab-packages" >> $GITHUB_ENV
181+
128182 # Run all codegen tests for this language
129183 - run : |
130184 cargo run test --languages ${{ matrix.lang }} tests/codegen \
0 commit comments