Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

- When running examples in this repository, use the `Justfile` recipes instead of invoking `cargo run` or `python` directly.
- Use `just examples` from the repository root to run the full example suite.
- To run examples for a specific sandbox, use module-scoped recipes: `just wasm examples`, `just js examples`, `just python examples`.
- To run examples for a specific sandbox, use module-scoped recipes: `just wasm examples`, `just js examples`, `just python examples`, `just dotnet examples`.
- Use `just build` from the repository root to build all subprojects and SDKs.
- Reason: the example commands depend on `WIT_WORLD` being set to `src/wasm_sandbox/wit/sandbox-world.wasm`; the `Justfile` handles that setup.

Make things cross-platform where possible (window/mac/linux). Mac supprot for hyperlight isn't avaliable yet but is coming.

- **After changing WIT interfaces**: you must run `just build` (or at minimum rebuild the guest `.wasm` and `.aot` files) before running examples. The pre-compiled guest binaries embed the WIT signature; a mismatch causes "Host function vector parameter missing length" errors at runtime.

- **Formatting and linting**: always use `just fmt` and `just fmt-check` from the repository root instead of invoking `cargo fmt`, `ruff format`, or `ruff check` directly. The Justfile recipes run multiple tools in sequence (e.g. `ruff format` + `ruff check --fix` for Python) and missing a step causes CI failures.
- **Formatting and linting**: always use `just fmt` and `just fmt-check` from the repository root instead of invoking `cargo fmt`, `ruff format`, `ruff check`, or `dotnet format` directly. The Justfile recipes run multiple tools in sequence and missing a step causes CI failures.
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,79 @@ jobs:
- name: Run examples
run: just wasm examples

dotnet-sdk:
name: .NET SDK (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
with:
toolchain: nightly, 1.94
components: rustfmt, clippy
rustflags: ""

- uses: actions/setup-dotnet@v4
Comment thread
simongdavies marked this conversation as resolved.
Outdated
with:
dotnet-version: '8.0.x'

- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0

- name: Install Python
run: uv python install 3.12

- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "latest"
cache: npm
cache-dependency-path: src/wasm_sandbox/guests/javascript/package-lock.json

- name: Install just
run: cargo install --locked just

- name: Install clang (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y clang

- name: Install LLVM (Windows)
if: runner.os == 'Windows'
run: choco install llvm -y

- name: Enable KVM
if: runner.os == 'Linux' && !env.ACT
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
sudo chmod 666 /dev/kvm

- name: Build guest modules
run: just wasm guest-build

- name: Format check
run: just dotnet fmt-check

- name: Lint
run: just dotnet lint

- name: Build
run: just dotnet build

- name: Test Rust FFI
run: just dotnet test-rust

- name: Test .NET
run: just dotnet test-dotnet

- name: Run examples
run: just dotnet examples

- name: Package test
run: just dotnet package-test

python-sdk:
name: Python SDK (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down
48 changes: 47 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Python SDK
name: Publish Python SDK & .NET SDK

on:
push:
Expand Down Expand Up @@ -112,3 +112,49 @@ jobs:

- name: Publish to PyPI
run: just python python-publish

# Build and publish .NET NuGet packages.
dotnet-publish:
if: ${{ !github.event.act }}
name: Publish .NET NuGet packages
runs-on: ubuntu-latest
Comment thread
simongdavies marked this conversation as resolved.
environment:
name: nuget
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
with:
cache-key: release
rustflags: ""

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Install just
run: cargo install --locked just

- name: Install clang
run: sudo apt-get update && sudo apt-get install -y clang

- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
sudo chmod 666 /dev/kvm

- name: Build guest modules
run: just wasm guest-build

- name: Build and pack
run: just dotnet dist

- name: Package test
run: just dotnet package-test release

- name: Publish to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
Comment thread
simongdavies marked this conversation as resolved.
Outdated
run: just dotnet publish
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ wheels/
pip-wheel-metadata/
src/sdk/python/wasm_backend/Cargo.lock
src/sdk/python/hyperlight_js_backend/Cargo.lock
src/sdk/dotnet/ffi/Cargo.lock
docs/end-user-overview-slides.html

# dotnet
[Bb]in/
[Oo]bj/
.vs/
*.user
*.nupkg
40 changes: 27 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"src/sdk/python/pyo3_common",
"src/sdk/python/wasm_backend",
"src/sdk/python/hyperlight_js_backend",
"src/sdk/dotnet/ffi",
]
# nanvix_sandbox requires nightly Rust (nanvix uses #![feature(never_type)])
exclude = [
Expand All @@ -27,17 +28,19 @@ hyperlight-sandbox-pyo3-common = { path = "src/sdk/python/pyo3_common" }
hyperlight-common = { version = "0.14.0", default-features = false }
hyperlight-component-macro = { version = "0.14.0" }
hyperlight-host = { version = "0.14.0", default-features = false, features = ["executable_heap"] }
hyperlight-wasm = { git = "https://github.com/jsturtevant/hyperlight-wasm", rev = "05a9eea" } #branch util-compont-fixes
hyperlight-wasm = { git = "https://github.com/jsturtevant/hyperlight-wasm", rev = "05a9eea" }
pyo3 = { version = "0.28", features = ["extension-module"] }

# Patched component-util (name collision fix, flags fix, empty-ns fix)
# https://github.com/jsturtevant/hyperlight-1/tree/wasm-component-fixes
# Patched component-util — the published 0.14.0 has name collision, flags,
# and empty-namespace bugs that break the generated host bindings.
# This patch will be removed once the fixes are merged upstream.
[patch.crates-io]
hyperlight-component-util = { git = "https://github.com/jsturtevant/hyperlight-1", rev = "4701257034306b0978d49cc9140bc0b12de3b409", package = "hyperlight-component-util" }

# hyperlight-wasm 0.13.1 (git) depends on hyperlight-* from the hyperlight-dev
# GitHub org. Redirect those to the published 0.14.0 crates.io versions.
[patch."https://github.com/hyperlight-dev/hyperlight"]
hyperlight-common = { version = "0.14.0" }
hyperlight-guest = { version = "=0.14.0" }
hyperlight-guest-bin = { version = "=0.14.0" }
hyperlight-host = { version = "0.14.0" }
hyperlight-component-util = { git = "https://github.com/jsturtevant/hyperlight-1", rev="4701257034306b0978d49cc9140bc0b12de3b409", package = "hyperlight-component-util" }

[patch.crates-io]
hyperlight-component-util = { git = "https://github.com/jsturtevant/hyperlight-1", rev="4701257034306b0978d49cc9140bc0b12de3b409", package = "hyperlight-component-util" }
13 changes: 7 additions & 6 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,36 @@ mod wasm 'src/wasm_sandbox/Justfile'
mod js 'src/javascript_sandbox/Justfile'
mod nanvix 'src/nanvix_sandbox/Justfile'
mod python 'src/sdk/python/Justfile'
mod dotnet 'src/sdk/dotnet/Justfile'
mod examples_mod 'examples/Justfile'

default-target := "debug"

clean: wasm::clean python::clean
clean: wasm::clean python::clean dotnet::clean
cargo clean

#### BUILD TARGETS ####

build target=default-target: (wasm::build target) (js::build target) nanvix::build python::build
build target=default-target: (wasm::build target) (js::build target) nanvix::build python::build (dotnet::build target)

lint: lint-rust wasm::lint js::lint python::lint

lint-rust:
cargo clippy -p hyperlight-sandbox --all-targets --features test-utils -- -D warnings

fmt: fmt-rust python::fmt
fmt: fmt-rust python::fmt dotnet::fmt

fmt-rust:
cargo +nightly fmt --all

fmt-check: fmt-check-rust python::fmt-check
fmt-check: fmt-check-rust python::fmt-check dotnet::fmt-check

fmt-check-rust:
cargo +nightly fmt --all -- --check

#### TESTS ####

test: wasm::guest-build wasm::js-guest-build python::build python::python-test test-rust wasm::test
test: wasm::guest-build wasm::js-guest-build python::build python::python-test test-rust wasm::test dotnet::test-rust dotnet::test

fuzz seconds="60": (python::python-fuzz seconds)

Expand All @@ -51,7 +52,7 @@ python-dist-backends: wasm::_clean-stale-wasm wasm::guest-compile-wit js::_clean

python-wheelhouse-test: python-dist python::python-wheelhouse-test

examples target=default-target: (wasm::examples target) (js::examples target) python::examples
examples target=default-target: (wasm::examples target) (js::examples target) python::examples dotnet::examples

integration-examples target=default-target: (wasm::guest-build target) wasm::js-guest-build python::build examples_mod::integration-examples

Expand Down
Loading
Loading