Skip to content

Merge pull request #167 from kelnishi/stack-switching #459

Merge pull request #167 from kelnishi/stack-switching

Merge pull request #167 from kelnishi/stack-switching #459

Workflow file for this run

name: wasm wast spec
on:
push:
branches: [ main ] # Trigger on pushes to the main branch
pull_request:
branches: [ main ] # Trigger on pull requests targeting the main branch
jobs:
build-and-test:
runs-on: ubuntu-latest # Use the latest Ubuntu runner
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
- name: Synchronize Submodules
run: git submodule sync --recursive
- name: Update Submodules
run: git submodule update --init --recursive
- name: Verify Submodule Status
run: git submodule status
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore Dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Run Spec Tests
run: dotnet test --configuration Release --no-build --verbosity normal Spec.Test/Spec.Test.csproj
- name: Run Core Tests
# WACS_AOT_TEST=1 opts into AotAcceptanceTests, which
# publishes Wacs.Bench.Aot with PublishAot=true and
# asserts no new IL warnings originate from Wacs.Core.
# See Wacs.Core.Test/AotAcceptanceTests.cs for the
# baseline + policy. The test takes ~60-90s — kept
# behind the env var so dev cycles stay fast.
env:
WACS_AOT_TEST: "1"
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.Core/Wacs.Core.Test/Wacs.Core.Test.csproj
- name: Run Compilation Tests
# Two CallIndirect_dispatches_via_funcref_table cases fail
# pre-reorg on main (NRE in GeneratedDispatcher); excluded here
# so CI surfaces the rest of the suite. Re-include once the
# underlying GeneratedDispatcher null-handling is fixed.
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.Core/Wacs.Compilation.Test/Wacs.Compilation.Test.csproj --filter "FullyQualifiedName!~CallIndirect_dispatches_via_funcref_table"
- name: Run ComponentModel Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.ComponentModel/Wacs.ComponentModel.Test/Wacs.ComponentModel.Test.csproj
- name: Run ComponentModel Bindgen Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.ComponentModel/Wacs.ComponentModel.Bindgen.Test/Wacs.ComponentModel.Bindgen.Test.csproj
- name: Run HostBindings Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.HostBindings/Wacs.HostBindings.Test/Wacs.HostBindings.Test.csproj
- name: Run Transpiler Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.Transpiler/Wacs.Transpiler.Test/Wacs.Transpiler.Test.csproj
- name: Run WASI Preview 1 Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.WASI/Wacs.WASI.Preview1/Wacs.WASI.Preview1.Test/Wacs.WASI.Preview1.Test.csproj
- name: Run WASI Preview 2 Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.WASI/Wacs.WASI.Preview2/Wacs.WASI.Preview2.Test/Wacs.WASI.Preview2.Test.csproj
- name: Run WASI.NN Core Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.WASI/Wacs.WASI.NN/Wacs.WASI.NN.Test/Wacs.WASI.NN.Test.csproj
- name: Run WASI.NN OnnxRuntime Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.WASI/Wacs.WASI.NN/Wacs.WASI.NN.OnnxRuntime.Test/Wacs.WASI.NN.OnnxRuntime.Test.csproj
- name: Run WASI.NN MLNet Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.WASI/Wacs.WASI.NN/Wacs.WASI.NN.MLNet.Test/Wacs.WASI.NN.MLNet.Test.csproj
- name: Run WASI.NN LlamaSharp Tests
run: dotnet test --configuration Release --no-build --verbosity normal Wacs.WASI/Wacs.WASI.NN/Wacs.WASI.NN.LlamaSharp.Test/Wacs.WASI.NN.LlamaSharp.Test.csproj
# End-to-end smoke for `wacs aot --wasi`. The flow chains the
# transpiler, WACS.HostBindings.SourceGen adapter generation,
# `dotnet publish` with PublishAot, and runtime execution under
# NativeAOT — none of which the unit suites cover together. A
# regression in any one of those layers (e.g. enum/int bridging
# in the source generator, or a Reflection.Emit call sneaking
# back into the call_indirect path) breaks `wacs aot --wasi`
# silently for downstream embedders.
#
# The fixture is the smallest WASI fixture in the testsuite
# submodule (4.8 KB) and exercises args/clock/fd_write/proc_exit
# — enough to catch the bindings most likely to regress.
- name: AOT smoke test (wacs aot --wasi)
run: |
set -euo pipefail
fixture=Spec.Test/wasi/tests/assemblyscript/testsuite/wasm32-wasip1/fd_write-to-stdout.wasm
if [ ! -f "$fixture" ]; then
echo "FAIL: fixture missing — submodule probably not initialized"
exit 1
fi
dotnet run --project Wacs.Console/Wacs.Console -c Release --no-build -- \
aot "$fixture" --wasi -o /tmp/wasi-aot-smoke
actual=$(/tmp/wasi-aot-smoke)
if [ "$actual" != "hello" ]; then
echo "FAIL: expected 'hello', got '$actual'"
exit 1
fi
echo "OK: wacs aot --wasi smoke produced expected stdout"