nixvm 0.0.0

A portable VM-style sandbox that runs a real Linux userland by emulating Linux syscalls directly (no guest kernel, no device emulation).
Documentation
name: CI

on:
  push:
    branches: [master]
  pull_request:

permissions:
  contents: read

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test & lint (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.os }}

      - name: Format
        if: runner.os == 'Linux' # formatting is platform-independent
        run: cargo fmt --all --check

      # `--all-features` is intentionally NOT used: `wasm` pulls in wasm-bindgen
      # (only builds for wasm32) and `hvf`/`kvm` are target-gated backends. The
      # feature sets below are the ones that build on a normal host.
      - name: Clippy (default features, warnings denied)
        run: cargo clippy --all-targets -- -D warnings

      - name: Clippy (fstool, warnings denied)
        run: cargo clippy --all-targets --features fstool -- -D warnings

      - name: Test (default features)
        run: cargo test

      - name: Test (fstool)
        run: cargo test --features fstool

  wasm:
    name: wasm build guard
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown

      - name: Cache
        uses: Swatinem/rust-cache@v2

      # Guards the browser demo build (src/wasm.rs). `--lib` skips the cfg(unix)
      # bins, matching how pages.yml builds the deployable artifact.
      - name: Build wasm demo library
        run: cargo build --lib --target wasm32-unknown-unknown --features wasm --no-default-features

  docs:
    name: Docs build (warnings denied)
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: -D warnings -D rustdoc::broken-intra-doc-links
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache
        uses: Swatinem/rust-cache@v2

      # `--all-features` is avoided (wasm/hvf/kvm don't build on a host doc run);
      # `fstool` covers the one optional module with public docs.
      - name: cargo doc --no-deps --features fstool
        run: cargo doc --no-deps --features fstool