The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
ci: route lightweight workflow jobs to BoxLite (#2833)
kekxyf0ed993eb4bb
diff --git a/.github/actionlint.yaml b/.github/actionlint.yamlnew file mode 100644index 000000000..f73c2670a--- /dev/null+++ b/.github/actionlint.yaml@@ -0,0 +1,9 @@+self-hosted-runner:+ labels:+ - boxlite+ - boxlite-2vcpu-4gbmem-30gbdisk+ - boxlite-2vcpu-8gbmem-30gbdisk+ - boxlite-4vcpu-8gbmem-30gbdisk+ - boxlite-4vcpu-16gbmem-30gbdisk+ - boxlite-4vcpu-16gbmem-64gbdisk+ - gcp-e2ediff --git a/.github/actions/setup-boxlite-runner/action.yml b/.github/actions/setup-boxlite-runner/action.ymlnew file mode 100644index 000000000..a1015b319--- /dev/null+++ b/.github/actions/setup-boxlite-runner/action.yml@@ -0,0 +1,21 @@+name: Set up BoxLite runner tools+description: Install Make, ripgrep and archive tools on the minimal Linux runner image.++inputs:+ native-build:+ description: Install the host toolchain used by native Linux builds.+ default: 'false'++runs:+ using: composite+ steps:+ - name: Install workflow tools+ shell: bash+ run: |+ sudo apt-get update+ sudo apt-get install -y --no-install-recommends make ripgrep xz-utils zstd++ - name: Install native build prerequisites+ if: inputs.native-build == 'true'+ shell: bash+ run: sudo apt-get install -y --no-install-recommends build-essential pkg-config libssl-dev patchelf python3diff --git a/.github/workflows/README.md b/.github/workflows/README.mdindex 6e6800c13..ccce5912c 100644--- a/.github/workflows/README.md+++ b/.github/workflows/README.md@@ -10,6 +10,48 @@ publish chain, the cloud deploy path, the local and cloud end-to-end suites, andShared step bundles live one directory over, in [`.github/actions/`](../actions) — GitHub does notsupport subdirectories under `.github/workflows/`, so composite actions are where reuse goes.+## Runner placement++Eligible Ubuntu x64 jobs use ephemeral workers through the+[BoxLite CI connection](../../apps/github-ci-runner/README.md).+The connection needs permission to register workers and quota for the requested+[resources](../../apps/libs/ci-listener/README.md#resource-labels).++| Runner label | Jobs |+| --- | --- |+| `boxlite` | Lightweight lint and setup, Python and Node SDK unit tests, Actions and Python CodeQL, plugin package validation, Go SDK release configuration, status and selected release artifact uploads |+| `boxlite-2vcpu-4gbmem-30gbdisk` | C/C++ CodeQL and Secret Server PostgreSQL integration |+| `boxlite-2vcpu-8gbmem-30gbdisk` | Dashboard tests and API client drift |+| `boxlite-4vcpu-8gbmem-30gbdisk` | Go CodeQL autobuild |+| `boxlite-4vcpu-16gbmem-30gbdisk` | Go SDK release checks, Node SDK release tests and Node release packaging |+| `boxlite-4vcpu-16gbmem-64gbdisk` | JavaScript/TypeScript and Rust CodeQL, Clippy, REST volume lifecycle E2E, Nix CLI build and boot, Linux x64 C SDK, Node addon, Python wheel and runtime/CLI builds, standalone guest artifacts and the non-publishing multiarch Box image build |+| GitHub-hosted Ubuntu | API tests, Go SDK coverage, Rust coverage, selected-ref C SDK builds, protected publishing and runner recovery |++The Node release upload builds and packs the npm packages before attaching them.+Uploads of prepared C SDK archives, runtime archives and Python wheels use the default worker.++The C SDK workflow installs the BoxLite worker toolchain before source checkout.+A caller-selected commit or an x64-only recovery build runs on GitHub-hosted Ubuntu.+Linux ARM64 and macOS matrix jobs use their native platforms. Building an ARM64+container image with Buildx exercises a different path from native ARM64 SDK tests.++GitHub starts PostgreSQL and Redis services before checkout. The runner must+provide a working Docker daemon at registration time. Dashboard tests and+API client drift install Node 22 before enabling Corepack for the Yarn cache.+API client drift uses 8 GiB for Yarn linking with public PR validation and limits cold installs to four concurrent downloads.+Dashboard allows eight concurrent downloads on its 8 GiB worker.+[Docker startup contract](../../apps/libs/ci-listener/README.md#docker-startup).++Rust coverage exercises unprivileged user namespaces on hosted Ubuntu.+The Nix and REST jobs verify unprivileged namespaces on BoxLite before booting an Alpine box or starting the REST server.+The BoxLite guest can run the SSH suite under its default namespace policy.+AppArmor enforcement requires a guest kernel with the AppArmor interface.++The local E2E workflow uses its GCP runner pool for persistent caches and VM+lifecycle. Deployment recovery uses GitHub-hosted runners. npm publishing uses+GitHub-hosted capacity for its+[provenance requirement](https://docs.npmjs.com/generating-provenance-statements/).+## How they fit together```textdiff --git a/.github/workflows/agent-tooling.yml b/.github/workflows/agent-tooling.ymlindex b359e9bc9..3b10bbf09 100644--- a/.github/workflows/agent-tooling.yml+++ b/.github/workflows/agent-tooling.yml@@ -27,7 +27,7 @@ permissions:jobs:validate:- runs-on: ubuntu-latest+ runs-on: boxlitesteps:- uses: actions/checkout@v4- name: Resolve tooling.ref, validate the profile, adopt the tipdiff --git a/.github/workflows/api-client-drift.yml b/.github/workflows/api-client-drift.ymlindex aeb7f3acb..537ebb75d 100644--- a/.github/workflows/api-client-drift.yml+++ b/.github/workflows/api-client-drift.yml@@ -23,6 +23,8 @@ on:- 'apps/tsconfig.base.json'- 'apps/openapitools.json'- 'openapi/box.openapi.yaml'+ - '.github/actions/setup-boxlite-runner/**'+ - '.github/actions/setup-go/**'- '.github/workflows/api-client-drift.yml'- '!**/*.md'@@ -36,7 +38,7 @@ concurrency:jobs:check-generated-clients:name: Regenerate API clients and diff- runs-on: ubuntu-latest+ runs-on: boxlite-2vcpu-8gbmem-30gbdiskservices:# generate-openapi.ts boots the full NestJS app; SKIP_CONNECTIONS=true# defers DB/queue connections but bootstrap still issues Redis commands@@ -53,6 +55,16 @@ jobs:steps:- uses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner+ - name: Install native Node build dependencies+ run: sudo apt-get install -y --no-install-recommends build-essential python3+ - uses: actions/setup-node@v4+ with:+ node-version: '22'+ - uses: ./.github/actions/setup-go+ with:+ cache: 'false'+# corepack must be enabled before setup-node's yarn cache probe runs- name: Enable corepack (yarn 4)run: corepack enable@@ -69,6 +81,8 @@ jobs:distribution: temurin- name: Install dependencies+ env:+ YARN_NETWORK_CONCURRENCY: '4'run: yarn install --immutable- name: Prepare offline app envdiff --git a/.github/workflows/build-box-images.yml b/.github/workflows/build-box-images.ymlindex 69feb392c..77f4edd89 100644--- a/.github/workflows/build-box-images.yml+++ b/.github/workflows/build-box-images.yml@@ -34,7 +34,7 @@ concurrency:jobs:build:name: Build affected box images (no publish)- runs-on: ubuntu-latest+ runs-on: boxlite-4vcpu-16gbmem-64gbdisksteps:- name: Checkout codediff --git a/.github/workflows/build-c.yml b/.github/workflows/build-c.ymlindex d8d5eb6d2..eaa2ad4e4 100644--- a/.github/workflows/build-c.yml+++ b/.github/workflows/build-c.yml@@ -93,13 +93,21 @@ jobs:build:name: Build (${{ matrix.target }})needs: [ config, resolve-ref ]- runs-on: ${{ matrix.os }}+ # Selected commits and runner recovery must build independently of the BoxLite fleet.+ runs-on: ${{ matrix.os == 'ubuntu-latest' && !inputs.ref && !inputs.linux_x64_only && 'boxlite-4vcpu-16gbmem-64gbdisk' || matrix.os }}strategy:fail-fast: falsematrix:include: ${{ fromJson(inputs.linux_x64_only && '[{"os":"ubuntu-latest","target":"linux-x64-gnu","rust_target":"x86_64-unknown-linux-gnu"}]' || needs.config.outputs.platforms) }}steps:+ - name: Install BoxLite worker build tools+ if: matrix.os == 'ubuntu-latest' && runner.environment == 'self-hosted'+ run: |+ sudo apt-get update+ sudo apt-get install -y --no-install-recommends make ripgrep xz-utils zstd \+ build-essential pkg-config libssl-dev patchelf python3+# This job builds a caller-selected commit, and a `uses: ./...` action is resolved from the# checked-out tree rather than from this workflow's own ref. So the steps below need# .github/actions/ to exist in the SELECTED commit, not just in the one defining this file.@@ -187,7 +195,7 @@ jobs:name: Upload to GitHub Releaseneeds: [ config, build ]if: github.event_name == 'release' && github.event.action == 'published'- runs-on: ubuntu-latest+ runs-on: boxlitepermissions:contents: write # Required to upload assets to GitHub Releasediff --git a/.github/workflows/build-go.yml b/.github/workflows/build-go.ymlindex 1282f2ca7..f326e8276 100644--- a/.github/workflows/build-go.yml+++ b/.github/workflows/build-go.yml@@ -27,7 +27,7 @@ jobs:if: >-github.event_name != 'workflow_run' ||(github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'release')- runs-on: ubuntu-latest+ runs-on: boxlitepermissions:contents: readactions: read@@ -37,6 +37,8 @@ jobs:platforms: ${{ steps.config.outputs.platforms }}go-version: ${{ steps.config.outputs.go-version }}steps:+ - name: Install release configuration tools+ run: sudo apt-get update && sudo apt-get install -y --no-install-recommends gh jq- name: Verify C release producerif: github.event_name == 'workflow_run'shell: bash@@ -109,7 +111,7 @@ jobs:!cancelled() &&needs.config.result == 'success' &&(needs['build-c'].result == 'success' || needs['build-c'].result == 'skipped')- runs-on: ${{ matrix.os }}+ runs-on: ${{ matrix.os == 'ubuntu-latest' && 'boxlite-4vcpu-16gbmem-30gbdisk' || matrix.os }}strategy:fail-fast: falsematrix:@@ -121,6 +123,13 @@ jobs:ref: ${{ needs.config.outputs.sha }}persist-credentials: false+ # The selected checkout can predate the shared BoxLite setup action.+ - name: Install BoxLite runner tools+ if: runner.environment == 'self-hosted'+ run: |+ sudo apt-get update+ sudo apt-get install -y --no-install-recommends gcc libc6-dev xz-utils zstd+- uses: ./.github/actions/setup-gowith:go-version: ${{ needs.config.outputs.go-version }}@@ -189,7 +198,7 @@ jobs:needs.test.result == 'success' &&github.event_name == 'workflow_run' &&github.event.workflow_run.event == 'release'- runs-on: ubuntu-latest+ runs-on: boxlitepermissions:contents: writediff --git a/.github/workflows/build-node.yml b/.github/workflows/build-node.ymlindex ea3d0aedd..3239a5edd 100644--- a/.github/workflows/build-node.yml+++ b/.github/workflows/build-node.yml@@ -44,7 +44,7 @@ jobs:build:name: Build (${{ matrix.target }})needs: config- runs-on: ${{ matrix.os }}+ runs-on: ${{ matrix.os == 'ubuntu-latest' && 'boxlite-4vcpu-16gbmem-64gbdisk' || matrix.os }}strategy:fail-fast: falsematrix:@@ -55,6 +55,11 @@ jobs:with:submodules: recursive+ - uses: ./.github/actions/setup-boxlite-runner+ if: matrix.os == 'ubuntu-latest'+ with:+ native-build: 'true'+- name: Set up Node.jsuses: actions/setup-node@v4with:@@ -122,7 +127,7 @@ jobs:test:name: Test (${{ matrix.platform.target }} / Node ${{ matrix.node-version }})needs: [ config, build ]- runs-on: ${{ matrix.platform.os }}+ runs-on: ${{ matrix.platform.os == 'ubuntu-latest' && 'boxlite-4vcpu-16gbmem-30gbdisk' || matrix.platform.os }}strategy:fail-fast: falsematrix:@@ -134,6 +139,9 @@ jobs:with:submodules: recursive+ - uses: ./.github/actions/setup-boxlite-runner+ if: runner.environment == 'self-hosted'+- name: Set up Node.jsuses: actions/setup-node@v4with:@@ -260,13 +268,15 @@ jobs:name: Upload to GitHub Releaseneeds: [ config, build, test ]if: github.event_name == 'release' && github.event.action == 'published'- runs-on: ubuntu-latest+ runs-on: boxlite-4vcpu-16gbmem-30gbdiskpermissions:contents: write # Required to upload assets to GitHub Releasesteps:- uses: actions/checkout@v4+ - uses: ./.github/actions/setup-boxlite-runner+- name: Set up Node.jsuses: actions/setup-node@v4with:diff --git a/.github/workflows/build-plugins.yml b/.github/workflows/build-plugins.ymlindex ac51e5ad1..bd96ab23f 100644--- a/.github/workflows/build-plugins.yml+++ b/.github/workflows/build-plugins.yml@@ -10,6 +10,7 @@ on:- 'make/plugins.mk'- 'make/test.mk'- 'Makefile'+ - '.github/actions/setup-boxlite-runner/**'- '.github/actions/setup-python/**'- '.github/workflows/build-plugins.yml'push:@@ -25,12 +26,13 @@ concurrency:jobs:build:- runs-on: ubuntu-latest+ runs-on: boxlitetimeout-minutes: 10steps:- uses: actions/checkout@v5with:persist-credentials: false+ - uses: ./.github/actions/setup-boxlite-runner- uses: ./.github/actions/setup-python- uses: actions/setup-node@v4with:diff --git a/.github/workflows/build-runtime.yml b/.github/workflows/build-runtime.ymlindex 820373b99..e38367a69 100644--- a/.github/workflows/build-runtime.yml+++ b/.github/workflows/build-runtime.yml@@ -52,7 +52,7 @@ jobs:build:name: Build Runtime (${{ matrix.target }})needs: config- runs-on: ${{ matrix.os }}+ runs-on: ${{ matrix.os == 'ubuntu-latest' && 'boxlite-4vcpu-16gbmem-64gbdisk' || matrix.os }}strategy:fail-fast: falsematrix:@@ -63,6 +63,11 @@ jobs:with:submodules: recursive+ - uses: ./.github/actions/setup-boxlite-runner+ if: matrix.os == 'ubuntu-latest'+ with:+ native-build: 'true'+- uses: ./.github/actions/setup-rustwith:toolchain: ${{ needs.config.outputs.rust-toolchain }}@@ -118,7 +123,7 @@ jobs:upload_to_release:name: Upload to GitHub Releaseneeds: build- runs-on: ubuntu-latest+ runs-on: boxliteif: github.event_name == 'release'permissions:contents: writediff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.ymlindex 77df49d1a..a46d0e0e9 100644--- a/.github/workflows/build-wheels.yml+++ b/.github/workflows/build-wheels.yml@@ -17,7 +17,7 @@ jobs:build_wheels:name: Build wheels on ${{ matrix.os }}needs: config- runs-on: ${{ matrix.os }}+ runs-on: ${{ matrix.os == 'ubuntu-latest' && 'boxlite-4vcpu-16gbmem-64gbdisk' || matrix.os }}strategy:fail-fast: truematrix:@@ -29,6 +29,19 @@ jobs:with:submodules: recursive+ - uses: ./.github/actions/setup-boxlite-runner+ if: matrix.os == 'ubuntu-latest'+ with:+ native-build: 'true'++ # cibuildwheel uses this interpreter range with environment updates disabled.+ # Its host interpreter needs the library path from the BoxLite tool cache.+ - name: Set up the Python interpreter used by cibuildwheel+ if: matrix.os == 'ubuntu-latest'+ uses: actions/setup-python@v6+ with:+ python-version: '3.11 - 3.13'+- uses: ./.github/actions/setup-rustwith:toolchain: ${{ needs.config.outputs.rust-toolchain }}@@ -91,7 +104,7 @@ jobs:upload_to_release:name: Upload wheels to GitHub Releaseneeds: build_wheels- runs-on: ubuntu-latest+ runs-on: boxliteif: github.event_name == 'release' && github.event.action == 'published'permissions:contents: write # Required to upload to releasesdiff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.ymlindex 98f82605e..f10e3fbfa 100644--- a/.github/workflows/codeql.yml+++ b/.github/workflows/codeql.yml@@ -33,7 +33,7 @@ concurrency:jobs:analyze:name: Analyze (${{ matrix.language }})- runs-on: ubuntu-latest+ runs-on: ${{ matrix.runner }}permissions:# Required to upload code scanning results.security-events: write@@ -46,22 +46,46 @@ jobs:include:- language: actionsbuild-mode: none+ runner: boxlite- language: c-cppbuild-mode: none+ runner: boxlite-2vcpu-4gbmem-30gbdisk- language: gobuild-mode: autobuild+ runner: boxlite-4vcpu-8gbmem-30gbdisk- language: javascript-typescriptbuild-mode: none+ runner: boxlite-4vcpu-16gbmem-64gbdisk- language: pythonbuild-mode: none+ runner: boxlite- language: rustbuild-mode: none+ runner: boxlite-4vcpu-16gbmem-64gbdisksteps:- name: Checkoutuses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3with:persist-credentials: false+ - uses: ./.github/actions/setup-boxlite-runner+ if: matrix.language == 'go'+ - name: Install Go autobuild dependencies+ if: matrix.language == 'go'+ run: sudo apt-get install -y --no-install-recommends gcc libc6-dev+ - uses: ./.github/actions/setup-go+ if: matrix.language == 'go'+ with:+ cache: 'false'+ - uses: actions/setup-node@v4+ if: matrix.language == 'javascript-typescript'+ with:+ node-version: '22'+ - uses: ./.github/actions/setup-rust+ if: matrix.language == 'rust'+ with:+ cache: 'false'+- name: Initialize CodeQLuses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2with:diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex 39fe57ee0..756226e99 100644--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -38,7 +38,7 @@ concurrency:jobs:changes:- runs-on: ubuntu-latest+ runs-on: boxlitepermissions:contents: readpull-requests: read@@ -101,10 +101,11 @@ jobs:name: Check Rust formattingneeds: changesif: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.quality == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlitesteps:- name: Checkout codeuses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner- uses: ./.github/actions/setup-rustwith:@@ -117,7 +118,7 @@ jobs:name: Run Clippy on ${{ matrix.os }}needs: changesif: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.quality == 'true' }}- runs-on: ${{ matrix.os }}+ runs-on: ${{ matrix.os == 'ubuntu-latest' && 'boxlite-4vcpu-16gbmem-64gbdisk' || matrix.os }}strategy:fail-fast: truematrix:@@ -126,6 +127,12 @@ jobs:- name: Checkout codeuses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner+ if: runner.environment == 'self-hosted'+ - name: Install native build dependencies+ if: runner.environment == 'self-hosted'+ run: sudo apt-get install -y --no-install-recommends build-essential libssl-dev pkg-config+- uses: ./.github/actions/setup-rustwith:components: clippy@@ -173,10 +180,11 @@ jobs:name: Python lint and format checksneeds: changesif: ${{ needs.changes.outputs.python == 'true' || needs.changes.outputs.quality == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlitesteps:- name: Checkout codeuses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner- uses: ./.github/actions/setup-python@@ -193,10 +201,11 @@ jobs:name: Node.js lint and format checksneeds: changesif: ${{ needs.changes.outputs.node == 'true' || needs.changes.outputs.quality == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlitesteps:- name: Checkout codeuses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner- name: Set up Node.jsuses: actions/setup-node@v4@@ -219,7 +228,7 @@ jobs:name: C SDK lint and format checksneeds: changesif: ${{ needs.changes.outputs.c == 'true' || needs.changes.outputs.quality == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlitesteps:- name: Checkout codeuses: actions/checkout@v5@@ -227,7 +236,7 @@ jobs:- name: Install clang toolsrun: |sudo apt-get update- sudo apt-get install -y clang-format clang-tidy+ sudo apt-get install -y --no-install-recommends clang-format clang-tidy libc6-dev make- name: Run C lintrun: make lint:c@@ -239,10 +248,11 @@ jobs:name: Go formattingneeds: changesif: ${{ needs.changes.outputs.go == 'true' || needs.changes.outputs.quality == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlitesteps:- name: Checkout codeuses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner- uses: ./.github/actions/setup-gowith:@@ -255,10 +265,11 @@ jobs:name: Installer script smoke testneeds: changesif: ${{ needs.changes.outputs.install_script == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlitesteps:- name: Checkout codeuses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner- name: Run installer script smoke testrun: make test:install-script@@ -272,7 +283,7 @@ jobs:name: Lint (conclusion)needs: [changes, rustfmt, clippy, python, node, c, go, install_script]if: ${{ !cancelled() }}- runs-on: ubuntu-latest+ runs-on: boxlitepermissions: {}steps:- name: All lint jobs passed or were skippeddiff --git a/.github/workflows/release-dependency-audit.yml b/.github/workflows/release-dependency-audit.ymlindex 7150472d9..50c14b80a 100644--- a/.github/workflows/release-dependency-audit.yml+++ b/.github/workflows/release-dependency-audit.yml@@ -23,12 +23,13 @@ jobs:if: >-${{ github.event_name == 'pull_request' &&startsWith(github.event.pull_request.title, 'chore(release): bump version to ') }}- runs-on: ubuntu-latest+ runs-on: boxlitetimeout-minutes: 5steps:- uses: actions/checkout@v5with:persist-credentials: false+ - uses: ./.github/actions/setup-boxlite-runner- uses: actions/setup-node@v4with:node-version: '22'diff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex bd6755c2f..21469af0a 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -97,7 +97,7 @@ env:jobs:# Detect which files changed to conditionally run testschanges:- runs-on: ubuntu-latest+ runs-on: boxlitepermissions:contents: readpull-requests: read@@ -124,6 +124,7 @@ jobs:nix: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.nix == 'true' }}steps:- uses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner- name: Validate Makefile syntaxrun: make -n help- uses: ./.github/actions/ci-config@@ -185,6 +186,7 @@ jobs:- '.cargo/**/!(*.md)'- '.config/nextest.toml'- 'codecov.yml'+ - '.github/actions/setup-boxlite-runner/**/!(*.md)'- '.github/actions/setup-rust/**/!(*.md)'- '.github/actions/setup-python/**/!(*.md)'- '.github/ci-config.json'@@ -208,6 +210,7 @@ jobs:- 'rust-toolchain.toml'- '.cargo/**/!(*.md)'- '.github/actions/sccache/**/!(*.md)'+ - '.github/actions/setup-boxlite-runner/**/!(*.md)'- '.github/workflows/test.yml'# vmm selects the kernel build and the real-kernel boot tests inside# the rust job, so rust must match every path listed here.@@ -250,6 +253,7 @@ jobs:- '.github/actions/ci-config/**/!(*.md)'- '.github/workflows/test.yml'go:+ - '.github/actions/setup-boxlite-runner/**/!(*.md)'- 'sdks/go/**/!(*.md)'- 'src/deps/libgvproxy-sys/**/!(*.md)'- 'apps/image-service/**/!(*.md)'@@ -291,6 +295,7 @@ jobs:- 'codecov.yml'- '.github/workflows/test.yml'dashboard:+ - '.github/actions/setup-boxlite-runner/**/!(*.md)'- 'apps/dashboard/**/!(*.md)'- 'apps/libs/api-client/**/!(*.md)'- 'apps/package.json'@@ -335,13 +340,19 @@ jobs:name: Workflow and infrastructure checksneeds: changesif: ${{ needs.changes.outputs.infra == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlitetimeout-minutes: 10permissions:contents: readid-token: writesteps:- uses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner+ - name: Install CI script test dependencies+ run: sudo apt-get install -y --no-install-recommends gcc libc6-dev patchelf python3-venv+ - uses: ./.github/actions/setup-rust+ with:+ cache: 'false'- uses: actions/setup-node@v4with:node-version: 22@@ -517,13 +528,23 @@ jobs:name: REST Server E2E (Linux)needs: changesif: ${{ needs.changes.outputs.sdk-tests-enabled == 'true' && needs.changes.outputs.rust == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlite-4vcpu-16gbmem-64gbdisktimeout-minutes: 45permissions:contents: readsteps:- name: Checkout codeuses: actions/checkout@v5+ with:+ persist-credentials: false++ - uses: ./.github/actions/setup-boxlite-runner+ with:+ native-build: 'true'++ - uses: ./.github/actions/setup-go+ with:+ cache: 'false'- uses: ./.github/actions/setup-rustwith:@@ -532,8 +553,13 @@ jobs:- name: Install cargo-nextestuses: taiki-e/install-action@nextest- - name: Enable unprivileged user namespaces- run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0+ - name: Verify unprivileged user and mount namespaces+ run: |+ if [ "$(id -u)" -eq 0 ]; then+ sudo -u nobody unshare --user --map-root-user --mount --propagation private true+ else+ unshare --user --map-root-user --mount --propagation private true+ fi- name: Enable KVM access for the runtime warm-uprun: sudo chmod a+rw /dev/kvm@@ -552,7 +578,7 @@ jobs:name: Python Tests (${{ matrix.platform.target }} / Python ${{ matrix.python-version }})needs: changesif: ${{ needs.changes.outputs.sdk-tests-enabled == 'true' && needs.changes.outputs.python == 'true' }}- runs-on: ${{ matrix.platform.os }}+ runs-on: ${{ matrix.platform.os == 'ubuntu-latest' && 'boxlite' || matrix.platform.os }}strategy:fail-fast: falsematrix:@@ -565,6 +591,9 @@ jobs:- name: Checkout codeuses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner+ if: runner.environment == 'self-hosted'+- uses: ./.github/actions/setup-pythonwith:python-version: ${{ matrix.python-version }}@@ -586,7 +615,7 @@ jobs:name: Node.js Tests (${{ matrix.platform.target }} / Node ${{ matrix.node-version }})needs: changesif: ${{ needs.changes.outputs.sdk-tests-enabled == 'true' && needs.changes.outputs.node == 'true' }}- runs-on: ${{ matrix.platform.os }}+ runs-on: ${{ matrix.platform.os == 'ubuntu-latest' && 'boxlite' || matrix.platform.os }}strategy:fail-fast: falsematrix:@@ -599,6 +628,9 @@ jobs:- name: Checkout codeuses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner+ if: runner.environment == 'self-hosted'+- name: Set up Node.jsuses: actions/setup-node@v4with:@@ -643,7 +675,7 @@ jobs:name: Secret Server PostgreSQL integrationneeds: changesif: ${{ needs.changes.outputs.go == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlite-2vcpu-4gbmem-30gbdisktimeout-minutes: 10permissions:contents: read@@ -664,10 +696,13 @@ jobs:--health-retries 12steps:- uses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner+ - name: Install Go race detector dependencies+ run: sudo apt-get install -y --no-install-recommends gcc libc6-dev- uses: ./.github/actions/setup-go- name: Run Secret Server PostgreSQL integration testsenv:- SECRET_TEST_DATABASE_URL: postgresql://boxlite:[email protected]:${{ job.services.postgres.ports[5432] }}/boxlite+ SECRET_TEST_DATABASE_URL: postgresql://boxlite:[email protected]:${{ job.services.postgres.ports['5432'] }}/boxliterun: make coverage:apps:secret-server:integration- name: Upload Secret Server integration coverage to Codecovuses: codecov/codecov-action@v5@@ -770,7 +805,7 @@ jobs:needs: changes# Qualify all five builds periodically without repeating them on routine CI runs.if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}- runs-on: ${{ matrix.os }}+ runs-on: ${{ matrix.os == 'ubuntu-latest' && 'boxlite-4vcpu-16gbmem-64gbdisk' || matrix.os }}strategy:fail-fast: falsematrix:@@ -799,6 +834,9 @@ jobs:submodules: recursivepersist-credentials: false+ - uses: ./.github/actions/setup-boxlite-runner+ if: runner.environment == 'self-hosted'+- uses: ./.github/actions/setup-rustwith:toolchain: ${{ needs.changes.outputs.rust-toolchain }}@@ -813,7 +851,7 @@ jobs:name: Submodule setup testsneeds: changesif: ${{ needs.changes.outputs.setup == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlitepermissions:contents: "read"steps:@@ -821,6 +859,7 @@ jobs:uses: actions/checkout@v5with:persist-credentials: false+ - uses: ./.github/actions/setup-boxlite-runner- name: Test worktree submodule setuprun: make test:setup:submodules@@ -834,7 +873,7 @@ jobs:name: Nix flake buildneeds: changesif: needs.changes.outputs.nix == 'true'- runs-on: ubuntu-latest+ runs-on: boxlite-4vcpu-16gbmem-64gbdisk# A cold build took 27 minutes on 12 local cores; the runner has 4.timeout-minutes: 90permissions:@@ -846,6 +885,10 @@ jobs:submodules: recursivepersist-credentials: false+ - uses: ./.github/actions/setup-boxlite-runner+ with:+ native-build: 'true'+# No /nix/store cache: it comes from the cache.nixos.org CDN, and# restoring 3 GB from the Actions cache would save little.- uses: cachix/install-nix-action@448cde739abec1eaf0646249e3d25bb8d9bc7702 # v31.11.2@@ -872,12 +915,14 @@ jobs:--keep CARGO_INCREMENTAL --keep SCCACHE_IGNORE_SERVER_IO_ERROR \-c make cli- # The jailer runs bwrap, which Ubuntu 24.04's AppArmor blocks without the- # bwrap profile (docs/guides/troubleshooting.md); the runner is discarded.- - name: Enable KVM and unprivileged user namespaces+ - name: Enable KVM and verify unprivileged user namespacesrun: |sudo chmod a+rw /dev/kvm- sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0+ if [ "$(id -u)" -eq 0 ]; then+ sudo -u nobody unshare --user --map-root-user --mount --propagation private true+ else+ unshare --user --map-root-user --mount --propagation private true+ fi- name: Boot a boxtimeout-minutes: 10@@ -959,7 +1004,7 @@ jobs:name: Dashboard Testsneeds: changesif: ${{ needs.changes.outputs.dashboard == 'true' }}- runs-on: "ubuntu-latest"+ runs-on: boxlite-2vcpu-8gbmem-30gbdiskpermissions: # Read source; OIDC authenticates the coverage upload.contents: "read"id-token: write@@ -970,6 +1015,12 @@ jobs:- uses: actions/checkout@v5with:persist-credentials: ${{ false }}+ - uses: ./.github/actions/setup-boxlite-runner+ - name: Install native Node build dependencies+ run: sudo apt-get install -y --no-install-recommends build-essential python3+ - uses: actions/setup-node@v4+ with:+ node-version: '22'- name: Enable Corepackrun: "corepack enable"- uses: actions/setup-node@v4@@ -978,6 +1029,8 @@ jobs:cache: "yarn"cache-dependency-path: "apps/yarn.lock"- name: Install app dependencies+ env:+ YARN_NETWORK_CONCURRENCY: '8'run: "yarn install --immutable"- name: Run dashboard unit testsrun: "yarn nx run dashboard:test --coverage --skip-nx-cache"@@ -995,13 +1048,14 @@ jobs:name: Plugin package coverageneeds: changesif: ${{ needs.changes.outputs.plugins == 'true' }}- runs-on: ubuntu-latest+ runs-on: boxlitetimeout-minutes: 5permissions:contents: readid-token: writesteps:- uses: actions/checkout@v5+ - uses: ./.github/actions/setup-boxlite-runner- uses: ./.github/actions/setup-python- name: Install coverage collectorrun: python3 -m pip install coverage==7.13.5@@ -1039,7 +1093,7 @@ jobs:needs.changes.outputs.dashboard == 'false' &&needs.changes.outputs.plugins == 'false' &&needs.changes.outputs.infra == 'false' }}- runs-on: ubuntu-latest+ runs-on: boxlitetimeout-minutes: 5permissions:contents: read@@ -1062,7 +1116,7 @@ jobs:name: Test (conclusion)needs: [changes, infra, rust, serve-rest-e2e, python, node, go, secret-server-postgres, setup, api, dashboard, plugins, guest_artifacts, coverage-empty]if: ${{ !cancelled() }}- runs-on: ubuntu-latest+ runs-on: boxlitepermissions: {}steps:- name: All test jobs passed or were skippeddiff --git a/apps/infra/deployment/release-audit-workflow.test.ts b/apps/infra/deployment/release-audit-workflow.test.tsindex 5a5398554..85ce6f0ea 100644--- a/apps/infra/deployment/release-audit-workflow.test.ts+++ b/apps/infra/deployment/release-audit-workflow.test.ts@@ -52,13 +52,13 @@ test('release audit selection follows title changes and includes drafts', () =>assert.equal(selected(releaseTitle, 'merge_group'), false, 'merge queues allocate no audit runner')})-test('release audit uses one bounded job with read-only checkout and no dependency install', () => {+test('release audit uses a bounded job with read-only checkout and skips app dependency installation', () => {const spec = workflow()const job = auditJob()assert.equal(Object.keys(spec.jobs).length, 1)assert.equal(job.name, 'Release dependency audit')assert.deepEqual(spec.permissions, { contents: 'read' })- assert.equal(job['runs-on'], 'ubuntu-latest')+ assert.equal(job['runs-on'], 'boxlite')assert.ok(job['timeout-minutes'] > 0 && job['timeout-minutes'] <= 5)assert.equal(job['continue-on-error'], undefined)assert.equal(job.steps.find((step: any) => step.uses?.startsWith('actions/checkout@')).with['persist-credentials'], false)diff --git a/apps/infra/deployment/workflow-checks.test.ts b/apps/infra/deployment/workflow-checks.test.tsindex f7ba2dfa3..7e7252620 100644--- a/apps/infra/deployment/workflow-checks.test.ts+++ b/apps/infra/deployment/workflow-checks.test.ts@@ -10,6 +10,7 @@ import { fileURLToPath } from 'node:url'import { createRequire } from 'node:module'import test from 'node:test'import { runInNewContext } from 'node:vm'+import { data, Evaluator, Lexer, Parser } from '@actions/expressions'import { load as loadYaml } from 'js-yaml'import { parse as parseToml } from 'smol-toml'@@ -19,6 +20,116 @@ const picomatch = createRequire(import.meta.url)('picomatch') as (pattern: strinconst workflow = (name: string): any => loadYaml(readFileSync(join(REPO_ROOT, '.github/workflows', name), 'utf8'))const matches = (pattern: string, path: string) => picomatch(pattern, { dot: true })(path)+function matrixRunner(selection: string, os: string, inputs = new data.Dictionary()) {+ const osEntry = { key: 'os', value: new data.StringData(os) }+ const context = new data.Dictionary(+ { key: 'matrix', value: new data.Dictionary(osEntry, { key: 'platform', value: new data.Dictionary(osEntry) }) },+ { key: 'inputs', value: inputs },+ )+ const expression = selection.replace(/^\$\{\{\s*|\s*\}\}$/g, '')+ const ast = new Parser(new Lexer(expression).lex().tokens, ['matrix', 'inputs'], []).parse()+ return new Evaluator(ast, context).evaluate().coerceString()+}++for (const [name, job, linuxRunner] of [+ ['lint.yml', 'clippy', 'boxlite-4vcpu-16gbmem-64gbdisk'],+ ['test.yml', 'guest_artifacts', 'boxlite-4vcpu-16gbmem-64gbdisk'],+ ['test.yml', 'python', 'boxlite'],+ ['test.yml', 'node', 'boxlite'],+ ['build-c.yml', 'build', 'boxlite-4vcpu-16gbmem-64gbdisk'],+ ['build-node.yml', 'build', 'boxlite-4vcpu-16gbmem-64gbdisk'],+ ['build-runtime.yml', 'build', 'boxlite-4vcpu-16gbmem-64gbdisk'],+ ['build-wheels.yml', 'build_wheels', 'boxlite-4vcpu-16gbmem-64gbdisk'],+ ['build-go.yml', 'test', 'boxlite-4vcpu-16gbmem-30gbdisk'],+ ['build-node.yml', 'test', 'boxlite-4vcpu-16gbmem-30gbdisk'],+] as const) {+ test(`${name}/${job} uses BoxLite for Linux x64 and native runners for other platforms`, () => {+ const { platforms } = JSON.parse(readFileSync(join(REPO_ROOT, '.github/ci-config.json'), 'utf8'))+ const selection = workflow(name).jobs[job]['runs-on']+ for (const { os, target } of platforms) {+ const expected = target === 'linux-x64-gnu' ? linuxRunner : os+ assert.equal(matrixRunner(selection, os), expected, os)+ }+ })+}++for (const [name, job, runner] of [+ ['build-go.yml', 'config', 'boxlite'],+ ['build-plugins.yml', 'build', 'boxlite'],+ ['api-client-drift.yml', 'check-generated-clients', 'boxlite-2vcpu-8gbmem-30gbdisk'],+ ['test.yml', 'dashboard', 'boxlite-2vcpu-8gbmem-30gbdisk'],+ ['test.yml', 'secret-server-postgres', 'boxlite-2vcpu-4gbmem-30gbdisk'],+ ['test.yml', 'nix', 'boxlite-4vcpu-16gbmem-64gbdisk'],+ ['test.yml', 'serve-rest-e2e', 'boxlite-4vcpu-16gbmem-64gbdisk'],+ ['build-box-images.yml', 'build', 'boxlite-4vcpu-16gbmem-64gbdisk'],+] as const) {+ test(`${name}/${job} requests its qualified BoxLite runner`, () => {+ assert.equal(workflow(name).jobs[job]['runs-on'], runner)+ })+}++for (const [name, job, downloads] of [+ ['test.yml', 'dashboard', '8'],+ ['api-client-drift.yml', 'check-generated-clients', '4'],+] as const) {+ test(`${name}/${job} bounds cold Yarn downloads for its worker`, () => {+ const install = workflow(name).jobs[job].steps.find((step: any) => step.run === 'yarn install --immutable')+ assert.equal(install?.env?.YARN_NETWORK_CONCURRENCY, downloads)+ })+}++for (const [name, job, matrix] of [+ ['release-box-images.yml', 'release', false],+ ['test.yml', 'api', false],+ ['test.yml', 'rust', true],+ ['test.yml', 'go', true],+] as const) {+ test(`${name}/${job} uses GitHub-hosted Ubuntu`, () => {+ const selection = workflow(name).jobs[job]['runs-on']+ assert.equal(matrix ? matrixRunner(selection, 'ubuntu-latest') : selection, 'ubuntu-latest')+ })+}++test('selected-commit and recovery C SDK builds can run independently of BoxLite', () => {+ const selection = workflow('build-c.yml').jobs.build['runs-on']+ for (const input of [+ { key: 'ref', value: new data.StringData('a'.repeat(40)) },+ { key: 'linux_x64_only', value: new data.BooleanData(true) },+ ]) {+ assert.equal(matrixRunner(selection, 'ubuntu-latest', new data.Dictionary(input)), 'ubuntu-latest')+ }+})++test('the C SDK worker installs its host tools before checking out a selected commit', () => {+ const steps = workflow('build-c.yml').jobs.build.steps+ const bootstrap = steps.findIndex((step: any) => step.if?.includes("runner.environment == 'self-hosted'"))+ const checkout = steps.findIndex((step: any) => step.uses?.startsWith('actions/checkout@'))+ assert.ok(bootstrap >= 0 && bootstrap < checkout, 'worker setup must precede the selected source')+ assert.match(steps[bootstrap].run, /apt-get install/)+})++test('Linux x64 wheel packaging initializes the host Python used by cibuildwheel', () => {+ const steps = workflow('build-wheels.yml').jobs.build_wheels.steps+ const python = steps.findIndex((step: any) => step.uses?.startsWith('actions/setup-python@'))+ const build = steps.findIndex((step: any) => step.uses?.startsWith('pypa/cibuildwheel@'))+ assert.ok(python >= 0 && python < build, 'prepare the host interpreter before invoking cibuildwheel')+ assert.equal(steps[python].if, "matrix.os == 'ubuntu-latest'")+ assert.equal(steps[python].with['python-version'], '3.11 - 3.13')+})++test('CodeQL places every language on its qualified runner and retains its build mode', () => {+ const job = workflow('codeql.yml').jobs.analyze+ assert.equal(job['runs-on'], '${{ matrix.runner }}')+ assert.deepEqual(job.strategy.matrix.include, [+ { language: 'actions', 'build-mode': 'none', runner: 'boxlite' },+ { language: 'c-cpp', 'build-mode': 'none', runner: 'boxlite-2vcpu-4gbmem-30gbdisk' },+ { language: 'go', 'build-mode': 'autobuild', runner: 'boxlite-4vcpu-8gbmem-30gbdisk' },+ { language: 'javascript-typescript', 'build-mode': 'none', runner: 'boxlite-4vcpu-16gbmem-64gbdisk' },+ { language: 'python', 'build-mode': 'none', runner: 'boxlite' },+ { language: 'rust', 'build-mode': 'none', runner: 'boxlite-4vcpu-16gbmem-64gbdisk' },+ ])+})+function testSuites(paths: string[]) {const filter = workflow('test.yml').jobs.changes.steps.find((step: any) => step.uses?.startsWith('dorny/paths-filter'))const rules = loadYaml(filter.with.filters) as Record<string, string[]>@@ -103,7 +214,7 @@ for (const path of ['scripts/test/coverage-bindings.sh', 'tests/scripts/test_nat// input of `make cli` there, including on push to main, and nothing else.for (const path of ['flake.nix', 'flake.lock', 'src/deps/libkrun-sys/build.rs', 'src/shared/build.rs','scripts/build/build-shim.sh', 'scripts/common.sh', 'scripts/setup/setup-common.sh', 'make/build.mk',- 'Cargo.lock', 'rust-toolchain.toml', '.github/actions/sccache/action.yml']) {+ 'Cargo.lock', 'rust-toolchain.toml', '.github/actions/sccache/action.yml', '.github/actions/setup-boxlite-runner/action.yml']) {test(`a change to a dev shell build input runs the nix job: ${path}`, () => {assert.ok(testSuites([path]).includes('nix'))assert.equal(acceptsFiles('test.yml', 'push', [path]), true)