Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
107 changes: 107 additions & 0 deletions .github/workflows/build-vm-driver-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# SPDX-License-Identifier: Apache-2.0

# Builds the Linux VM driver as OpenShell's build-vm-driver-linux.yml does: the VM runtime from the
# flake (the hash-pinned vm-runtime release), the guest init built by build-vm-init.yml in
# the same run, and openshell-sandbox and openshell-supervisor from OpenShell's published
# test-inputs bundle (openshell-test-inputs): nothing from OpenShell is built here.

name: Build Linux VM Driver

on:
workflow_call:
inputs:
openshell-test-inputs:
description: ai-openshell/openshell commit whose published test-inputs bundle provides openshell-sandbox and openshell-supervisor
required: true
type: string
cargo-version:
required: false
type: string
default: "0.0.0"
checkout-ref:
required: false
type: string
default: ""
secrets:
CACHIX_AUTH_TOKEN:
required: false
OPENSHELL_ARTIFACTS_TOKEN:
required: false

permissions:
contents: read
packages: read

jobs:
build:
name: openshell-driver-vm (${{ matrix.triple }})
strategy:
matrix:
include:
- arch: x86_64
triple: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
- arch: aarch64
triple: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
defaults:
run:
shell: nix develop -c bash -euo pipefail {0}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ inputs.checkout-ref || github.sha }}

- uses: ./.github/actions/setup-nix
with:
prepare-shell: "true"
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Download OpenShell's test inputs
uses: ./.github/actions/pull-test-inputs
with:
test-inputs: ${{ inputs.openshell-test-inputs }}
token: ${{ secrets.OPENSHELL_ARTIFACTS_TOKEN || github.token }}
directory: ${{ runner.temp }}/openshell-test-inputs

- name: Stage openshell-sandbox and openshell-supervisor
env:
BUNDLE: ${{ runner.temp }}/openshell-test-inputs
ARCH: ${{ matrix.arch }}
run: |
mkdir -p sandbox supervisor
cp "${BUNDLE}/runtime/openshell-sandbox-${ARCH}-unknown-linux-musl/openshell-sandbox" sandbox/
cp "${BUNDLE}/runtime/openshell-supervisor-${ARCH}-unknown-linux-gnu/openshell-supervisor" supervisor/

- name: Download VM guest init
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-vm-init-${{ matrix.arch }}-unknown-linux-musl
path: vm-init

- name: Build VM runtime
run: |
# HTTP 416 is not retried by Nix; restart the build once on failure.
nix build .#vm-runtime || nix build .#vm-runtime

- name: Assemble compressed VM runtime
run: |
compressed_dir="${RUNNER_TEMP}/vm-runtime-compressed"
install -d "$compressed_dir"
cp result/compressed/*.zst "$compressed_dir/"
zstd -19 -T1 sandbox/openshell-sandbox -o "$compressed_dir/openshell-sandbox.zst"
zstd -19 -T1 supervisor/openshell-supervisor -o "$compressed_dir/openshell-supervisor.zst"
zstd -19 -T1 vm-init/openshell-vm-init -o "$compressed_dir/openshell-vm-init.zst"

- name: Build openshell-driver-vm
uses: ./.github/actions/build-rust-binary
env:
OPENSHELL_VM_RUNTIME_COMPRESSED_DIR: ${{ runner.temp }}/vm-runtime-compressed
with:
package: openshell-driver-vm
binary: openshell-driver-vm
triple: ${{ matrix.triple }}
cargo-version: ${{ inputs.cargo-version }}
111 changes: 111 additions & 0 deletions .github/workflows/build-vm-driver-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# SPDX-License-Identifier: Apache-2.0

# Builds the macOS VM driver as OpenShell's build-vm-driver-macos.yml does: the VM runtime from the
# flake (the hash-pinned vm-runtime release), the guest init built by build-vm-init.yml in
# the same run (a Linux musl guest, cross-built), and openshell-sandbox and openshell-supervisor from the OpenShell Branch E2E run
# given by openshell-run-id: nothing from OpenShell is built here.

name: Build macOS VM Driver

on:
workflow_call:
inputs:
openshell-run-id:
description: ai-openshell/openshell Branch E2E run whose openshell-sandbox and the macOS openshell-supervisor artifacts to use
required: true
type: string
cargo-version:
required: false
type: string
default: "0.0.0"
checkout-ref:
required: false
type: string
default: ""
secrets:
CACHIX_AUTH_TOKEN:
required: false
OPENSHELL_ARTIFACTS_TOKEN:
required: false

permissions:
contents: read

jobs:
build:
name: openshell-driver-vm (${{ matrix.triple }})
strategy:
matrix:
include:
- arch: aarch64
triple: aarch64-apple-darwin
runs-on: macos-15
timeout-minutes: 60
defaults:
run:
shell: nix develop -c bash -euo pipefail {0}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ inputs.checkout-ref || github.sha }}

- uses: ./.github/actions/setup-nix
with:
prepare-shell: "true"
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Download openshell-sandbox
env:
GH_TOKEN: ${{ secrets.OPENSHELL_ARTIFACTS_TOKEN || github.token }}
OPENSHELL_RUN_ID: ${{ inputs.openshell-run-id }}
ARCH: ${{ matrix.arch }}
run: |
if [ -z "${OPENSHELL_RUN_ID}" ]; then
echo "::error::No OpenShell Branch E2E run id was given"
exit 1
fi
gh run download "${OPENSHELL_RUN_ID}" -R ai-openshell/openshell -n "openshell-sandbox-${ARCH}-unknown-linux-musl" -D sandbox

- name: Download openshell-supervisor
env:
GH_TOKEN: ${{ secrets.OPENSHELL_ARTIFACTS_TOKEN || github.token }}
OPENSHELL_RUN_ID: ${{ inputs.openshell-run-id }}
ARCH: ${{ matrix.arch }}
run: |
if [ -z "${OPENSHELL_RUN_ID}" ]; then
echo "::error::No OpenShell Branch E2E run id was given"
exit 1
fi
gh run download "${OPENSHELL_RUN_ID}" -R ai-openshell/openshell -n "openshell-supervisor-${ARCH}-apple-darwin" -D supervisor

- name: Download VM guest init
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-vm-init-${{ matrix.arch }}-unknown-linux-musl
path: vm-init

- name: Build VM runtime
run: |
# HTTP 416 is not retried by Nix; restart the build once on failure.
nix build .#vm-runtime || nix build .#vm-runtime

- name: Assemble compressed VM runtime
run: |
compressed_dir="${RUNNER_TEMP}/vm-runtime-compressed"
install -d "$compressed_dir"
cp result/compressed/*.zst "$compressed_dir/"
zstd -19 -T1 sandbox/openshell-sandbox -o "$compressed_dir/openshell-sandbox.zst"
zstd -19 -T1 supervisor/openshell-supervisor -o "$compressed_dir/openshell-supervisor.zst"
zstd -19 -T1 vm-init/openshell-vm-init -o "$compressed_dir/openshell-vm-init.zst"

- name: Build openshell-driver-vm
uses: ./.github/actions/build-rust-binary
env:
OPENSHELL_VM_RUNTIME_COMPRESSED_DIR: ${{ runner.temp }}/vm-runtime-compressed
with:
package: openshell-driver-vm
binary: openshell-driver-vm
triple: ${{ matrix.triple }}
cargo-version: ${{ inputs.cargo-version }}
entitlements-file: crates/openshell-driver-vm/entitlements.plist
59 changes: 59 additions & 0 deletions .github/workflows/build-vm-init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# SPDX-License-Identifier: Apache-2.0

# Builds the VM guest init, embedded in the VM driver, with the same toolchain as the other Linux
# binaries (build-binaries-linux.yml). It is cross-built for x86_64 and aarch64 on an x86_64
# runner, as the VM driver builds only need the binary. Kept apart from the drivers so the VM
# builds do not wait for them.

name: Build VM Init

on:
workflow_call:
inputs:
cargo-version:
required: false
type: string
default: "0.0.0"
checkout-ref:
required: false
type: string
default: ""
secrets:
CACHIX_AUTH_TOKEN:
required: false

permissions:
contents: read

jobs:
# The VM guest init, embedded in the VM driver. The aarch64 one is cross-built here for the
# macOS driver, so it cannot be run to check it.
vm-init:
name: openshell-vm-init (${{ matrix.triple }})
strategy:
fail-fast: false
matrix:
include:
- triple: x86_64-unknown-linux-musl
run-check: "true"
- triple: aarch64-unknown-linux-musl
run-check: "false"
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ inputs.checkout-ref || github.sha }}
- uses: ./.github/actions/setup-nix
with:
prepare-shell: "true"
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- uses: ./.github/actions/build-rust-binary
with:
package: openshell-driver-vm
binary: openshell-vm-init
triple: ${{ matrix.triple }}
cargo-version: ${{ inputs.cargo-version }}
extra-cargo-flags: --no-default-features
run-check: ${{ matrix.run-check }}
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@ jobs:
with:
persist-credentials: false

# release-vm-kernel.yml is imported unchanged and has no header; drop it from the exclude
# list when the workflow is adapted for this repository.
- name: Check license headers
uses: ai-openshell/workflows/spdx-check@0b051efd25c3f7319634fed863d2e03e1bd55d7b
with:
include: >-
*.rs *.sh *.toml *.yml *.yaml *.json
exclude: .github/workflows/release-vm-kernel.yml

rust:
name: Rust checks
Expand Down
Loading
Loading