Files
komorebi/.github/actions/nix/action.yaml
T
LGUG2Z 0725705298 ci(github): run the VM tests on KVM
`discover` asks the flake for the suites of each tier
(`legacyPackages.x86_64-linux.vmTiers`) and hands them to two matrices, so a new
directory under `nix/tests/vm/suites` is run without an edit to the workflow.
`vm-fast` runs the fast tier on every pull request, one machine per suite, as a
sandboxed `nix build` of the check. `vm-slow` runs on master, every week, and on
a pull request labeled `ci:vm-slow`; it builds the driver and runs it by hand,
outside the sandbox, so that the screenshots and journals of a failed run are
uploaded with `if: always()`.

A composite action installs nix with the store cached and, for the VM jobs,
frees disk space (a Plasma guest is a closure of about 10 GB), writes the udev
rule that makes /dev/kvm writable for the runner's user, checks it with `test
-w`, and adds `kvm` to nix's system features. KVM on hosted runners is
documented for public repositories only. Whether this private repository has it
is not known: the first run of these jobs says, and if it does not, they need a
different runner.

`lint` no longer runs `nix flake check`: on Linux that now boots every VM suite,
which a runner with no KVM cannot do. It builds the checks that need no virtual
machine, and `vm-lib`, the library's own tests.

CONTRIBUTING.md and docs/dev/vm-tests.md say what runs where.
2026-10-27 14:06:52 -07:00

45 lines
1.7 KiB
YAML

name: nix
description: Install nix on a hosted runner, with the store cached and, on request, KVM enabled
inputs:
kvm:
description: Make /dev/kvm usable and tell nix that this machine can run NixOS tests
default: "false"
runs:
using: composite
steps:
# A Plasma guest is a closure of about 10 GB, and a hosted runner has little free space on /
# until the toolchains it ships with are gone.
- name: Free disk space
if: inputs.kvm == 'true'
shell: bash
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
df -h /
# The udev rule is what makes /dev/kvm writable for the runner's user. KVM on hosted runners
# is documented for public repositories; `test -w` is what says whether this one has it.
- name: Enable KVM
if: inputs.kvm == 'true'
shell: bash
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
test -w /dev/kvm
# This action only installs nix. It does not use the Cachix service, and no Cachix cache, account
# or token is configured anywhere in this repository.
- uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
system-features = nixos-test benchmark big-parallel ${{ inputs.kvm == 'true' && 'kvm' || '' }}
- uses: nix-community/cache-nix-action@v7
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', '**/Cargo.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 8G