Skip to content

feat: add pyhl container image for device plugin deployments #333

feat: add pyhl container image for device plugin deployments

feat: add pyhl container image for device plugin deployments #333

Workflow file for this run

name: Host checks (fmt, clippy, tests)
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
paths:
- 'host/**'
- '.github/workflows/host-checks.yml'
# Pushing a new commit to the same ref cancels any in-flight run on
# the previous commit — don't waste CI on stale code.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Fast per-PR gate: runs unit + integration tests, rustfmt check, and
# clippy with warnings-as-errors on the host crate. Matches the style
# upstream hyperlight uses. The integration tests in host/tests/ boot
# a Unikraft kernel via KVM, so this job requires /dev/kvm on the
# runner (same udev trick as test-examples.yml).
jobs:
checks:
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 25
defaults:
run:
working-directory: host
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: host -> target
- name: Install Rust components for pinned toolchain
# The repo pins 1.89.0 via rust-toolchain.toml at the repo root.
# cargo fmt / clippy use the pinned channel, so install their
# components there. (working-directory is host/, so read from
# ../rust-toolchain.toml.)
working-directory: .
run: |
channel=$(grep '^channel' rust-toolchain.toml | awk -F'"' '{print $2}')
if [ -z "$channel" ]; then
echo "::error::could not parse channel from rust-toolchain.toml"
cat rust-toolchain.toml
exit 1
fi
echo "Installing rustfmt + clippy on channel $channel"
rustup component add --toolchain "$channel" rustfmt clippy
- name: Cargo fmt (check only)
run: cargo fmt --all -- --check
- name: Cargo clippy (warnings are errors)
run: cargo clippy --all-targets --locked -- -D warnings
- name: Cargo clippy with Wasm host tools
run: cargo clippy --bin hyperlight-unikraft --tests --locked --features wasm-host-fns -- -D warnings
- name: Enable KVM permissions
working-directory: .
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 || true
- name: Cargo test
env:
# Fewer integration-test iterations in CI — the test bodies
# skip themselves if /dev/kvm isn't available.
RUST_BACKTRACE: '1'
run: cargo test --all-targets --locked
- name: Cargo test with Wasm host tools
env:
RUST_BACKTRACE: '1'
run: cargo test --bin hyperlight-unikraft --locked --features wasm-host-fns wasm_host_fns::tests
host-checks-passed:
if: always()
needs: [checks]
runs-on: ubuntu-latest
permissions: {}
steps:
- run: |
r="${{ needs.checks.result }}"
if [[ "$r" != "success" ]]; then
echo "FAIL: checks = $r"
exit 1
fi
echo "All checks passed"