77 push :
88 branches : [main]
99 paths :
10- - ' examples/**'
11- - ' runtimes/**'
12- - ' host/**'
13- - ' .github/workflows/test-examples.yml'
10+ - " examples/**"
11+ - " runtimes/**"
12+ - " host/**"
13+ - " .github/workflows/test-examples.yml"
1414
1515# Pushing a new commit to the same ref cancels any in-flight run on
1616# the previous commit — don't waste CI on stale code.
6868
6969 - uses : actions/setup-go@v5
7070 with :
71- go-version : ' 1.25.1'
71+ go-version : " 1.25.1"
7272 cache : false
7373
7474 - name : Install just
9292 - name : Build local-python-base images (python-agent-driver only)
9393 if : matrix.example == 'python-agent-driver'
9494 env :
95- DOCKER_BUILDKIT : ' 0 '
95+ DOCKER_BUILDKIT : " 0 "
9696 run : |
9797 docker build --target base -t local-python-base-dev:latest \
9898 -f runtimes/python.Dockerfile runtimes/
@@ -102,7 +102,7 @@ jobs:
102102 - name : Build rootfs
103103 working-directory : examples/${{ matrix.example }}
104104 env :
105- DOCKER_BUILDKIT : ' 0 '
105+ DOCKER_BUILDKIT : " 0 "
106106 run : |
107107 just rootfs
108108
@@ -185,8 +185,9 @@ jobs:
185185 args : " -- /hello.py"
186186 expect : " Hello from Python on Hyperlight"
187187 - example : python-tools
188- args : " --enable-tools -- /test_tools.py"
188+ args : " -- /test_tools.py"
189189 expect : " Tool returned"
190+ needs_echo_tool : true
190191 - example : nodejs
191192 args : " -- /app/hello.js"
192193 expect : " Hello from Node.js on Hyperlight"
@@ -280,13 +281,19 @@ jobs:
280281 if : steps.kvm_check.outputs.available == 'true'
281282 run : |
282283 cd host
283- cargo build --release --bin hyperlight-unikraft --bin multifn-test --bin pydriver-run
284+ cargo build --release --features wasm-host-fns -- bin hyperlight-unikraft --bin multifn-test --bin pydriver-run
284285 sudo cp target/release/hyperlight-unikraft /usr/local/bin/
285286
287+ - name : Build echo Wasm host function
288+ if : steps.kvm_check.outputs.available == 'true' && matrix.needs_echo_tool == true
289+ run : |
290+ rustup target add wasm32-wasip1
291+ cargo build --manifest-path examples/echo-wasm-host-fxn/Cargo.toml --release --target wasm32-wasip1
292+
286293 - name : Build local-python-base images (python-agent-driver only)
287294 if : steps.kvm_check.outputs.available == 'true' && matrix.example == 'python-agent-driver'
288295 env :
289- DOCKER_BUILDKIT : ' 0 '
296+ DOCKER_BUILDKIT : " 0 "
290297 run : |
291298 docker build --target base -t local-python-base-dev:latest \
292299 -f runtimes/python.Dockerfile runtimes/
@@ -297,7 +304,7 @@ jobs:
297304 if : steps.kvm_check.outputs.available == 'true'
298305 working-directory : examples/${{ matrix.example }}
299306 env :
300- DOCKER_BUILDKIT : ' 0 '
307+ DOCKER_BUILDKIT : " 0 "
301308 run : |
302309 just rootfs
303310 kraft-hyperlight --no-prompt build --plat hyperlight --arch x86_64 || true
@@ -348,14 +355,20 @@ jobs:
348355 mkdir -p "$mount_dir"
349356 mount_args="--mount $mount_dir:/host"
350357 fi
358+
359+ tool_args=""
360+ if [ "${{ matrix.needs_echo_tool }}" = "true" ]; then
361+ tool_args="--tool echo=../echo-wasm-host-fxn/target/wasm32-wasip1/release/echo-wasm-host-fxn.wasm"
362+ fi
363+
351364 # HTTP server examples: start in background, poll, curl, kill.
352365 http_port="${{ matrix.http_port }}"
353366 if [ -n "$http_port" ]; then
354367 mem_args=""
355368 if [ -n "$memory" ]; then
356369 mem_args="-m $memory"
357370 fi
358- hyperlight-unikraft -q $mem_args "$kernel" --initrd "$cpio" ${{ matrix.args }} &
371+ hyperlight-unikraft -q $mem_args "$kernel" --initrd "$cpio" $mount_args $tool_args $ {{ matrix.args }} &
359372 server_pid=$!
360373 sleep 3
361374 ready=0
@@ -396,7 +409,7 @@ jobs:
396409 if [ -n "$memory" ]; then
397410 mem_args="-m $memory"
398411 fi
399- cmd=(timeout 120 hyperlight-unikraft -q $mem_args "$kernel" --initrd "$cpio" $mount_args ${{ matrix.args }})
412+ cmd=(timeout 120 hyperlight-unikraft -q $mem_args "$kernel" --initrd "$cpio" $mount_args $tool_args $ {{ matrix.args }})
400413 ;;
401414 esac
402415 set +e
@@ -456,7 +469,7 @@ jobs:
456469
457470 - uses : actions/setup-go@v5
458471 with :
459- go-version : ' 1.25.1'
472+ go-version : " 1.25.1"
460473 cache : false
461474
462475 - name : Install just
@@ -480,7 +493,7 @@ jobs:
480493 - name : Build local-python-base images (python-agent-driver only)
481494 if : matrix.example == 'python-agent-driver'
482495 env :
483- DOCKER_BUILDKIT : ' 0 '
496+ DOCKER_BUILDKIT : " 0 "
484497 run : |
485498 docker build --target base -t local-python-base-dev:latest \
486499 -f runtimes/python.Dockerfile runtimes/
@@ -490,7 +503,7 @@ jobs:
490503 - name : Build rootfs + kernel
491504 working-directory : examples/${{ matrix.example }}
492505 env :
493- DOCKER_BUILDKIT : ' 0 '
506+ DOCKER_BUILDKIT : " 0 "
494507 run : |
495508 just rootfs
496509 kraft-hyperlight --no-prompt build --plat hyperlight --arch x86_64 || true
@@ -562,8 +575,9 @@ jobs:
562575 args : " -- /hello.py"
563576 expect : " Hello from Python on Hyperlight"
564577 - example : python-tools
565- args : " --enable-tools -- /test_tools.py"
578+ args : " -- /test_tools.py"
566579 expect : " Tool returned"
580+ needs_echo_tool : true
567581 - example : nodejs
568582 args : " -- /app/hello.js"
569583 expect : " Hello from Node.js on Hyperlight"
@@ -631,12 +645,19 @@ jobs:
631645 shell : pwsh
632646 run : |
633647 cd host
634- cargo build --release --bin hyperlight-unikraft --bin multifn-test --bin pydriver-run --bin pyhl
648+ cargo build --release --features wasm-host-fns -- bin hyperlight-unikraft --bin multifn-test --bin pydriver-run --bin pyhl
635649 Copy-Item target\release\hyperlight-unikraft.exe $env:USERPROFILE\.cargo\bin\ -Force
636650 Copy-Item target\release\multifn-test.exe $env:USERPROFILE\.cargo\bin\ -Force
637651 Copy-Item target\release\pydriver-run.exe $env:USERPROFILE\.cargo\bin\ -Force
638652 Copy-Item target\release\pyhl.exe $env:USERPROFILE\.cargo\bin\ -Force
639653
654+ - name : Build echo Wasm host function
655+ if : matrix.needs_echo_tool == true
656+ shell : pwsh
657+ run : |
658+ rustup target add wasm32-wasip1
659+ cargo build --manifest-path examples/echo-wasm-host-fxn/Cargo.toml --release --target wasm32-wasip1
660+
640661 - name : Download prebuilt image
641662 uses : actions/download-artifact@v4
642663 with :
@@ -652,6 +673,7 @@ jobs:
652673 $driver = '${{ matrix.driver }}'
653674 $runArgs = '${{ matrix.args }}'
654675 $needsMount = '${{ matrix.needs_mount }}'
676+ $needsEchoTool = '${{ matrix.needs_echo_tool }}'
655677
656678 # Read memory from the example's Justfile (single source of truth).
657679 $memory = ''
@@ -673,6 +695,11 @@ jobs:
673695 $mountArgs = @('--mount', ($mountDir + ':/host'))
674696 }
675697
698+ $toolArgs = @()
699+ if ($needsEchoTool -eq 'true') {
700+ $toolArgs = @('--tool', 'echo=examples/echo-wasm-host-fxn/target/wasm32-wasip1/release/echo-wasm-host-fxn.wasm')
701+ }
702+
676703 # Strict mode: expected output must appear AND the driver
677704 # must exit 0. Matches Linux semantics.
678705 $PSNativeCommandUseErrorActionPreference = $false
@@ -747,7 +774,7 @@ jobs:
747774 $memArgs = @('-m', $memory)
748775 }
749776 $out = & hyperlight-unikraft -q @memArgs `
750- $kernel --initrd $cpio @mountArgs @argList 2>&1
777+ $kernel --initrd $cpio @mountArgs @toolArgs @ argList 2>&1
751778 $rc = $LASTEXITCODE
752779 }
753780 }
@@ -921,7 +948,14 @@ jobs:
921948
922949 test-examples-passed :
923950 if : always()
924- needs : [build-example, runtime-test, package-images-for-windows, runtime-test-windows, pyhl-snapshot-test]
951+ needs :
952+ [
953+ build-example,
954+ runtime-test,
955+ package-images-for-windows,
956+ runtime-test-windows,
957+ pyhl-snapshot-test,
958+ ]
925959 runs-on : ubuntu-latest
926960 permissions : {}
927961 steps :
0 commit comments