refactor: reorganise flake, tests and repo tasks
This commit is contained in:
1 parent
b93147c7a6
commit
794ca5a086
34 files changed
+670
-220
No files matched your search
+42
-20
@@ -2,30 +2,52 @@
|
||||
|
||||
## Workflow
|
||||
|
||||
Work inside the dev shell (`direnv allow` once). Run `cargo clippy
|
||||
--all-targets` before committing (the crate warns on clippy pedantic plus
|
||||
`absolute_paths`) and `cargo fmt`, which needs the nightly toolchain for
|
||||
`rustfmt.toml`. Version control is jj, not the `git` CLI.
|
||||
Work inside the dev shell (`direnv allow` once). Run `cargo clippy --workspace
|
||||
--all-targets` before committing (the workspace warns on clippy pedantic plus
|
||||
`absolute_paths`) and `cargo fmt --all`, which needs the nightly toolchain for
|
||||
`.rustfmt.toml`. Version control is jj, not the `git` CLI.
|
||||
|
||||
The workspace has two crates: `bootvine` itself and `xtask`, the repository
|
||||
tasks behind `cargo xtask` (`record-screencasts`, `install`, `uninstall`).
|
||||
|
||||
## Testing
|
||||
|
||||
- `cargo test`: model and render snapshot tests.
|
||||
- `nix run .#demo-units -- start`, then
|
||||
`cargo run -- --user --target bootvine-demo.target --hold 3s`: live against
|
||||
your user manager.
|
||||
- `nix build .#checks.x86_64-linux.<name>`: each `tests/<name>.nix` boots a VM
|
||||
and runs `tests/console.py` followed by `tests/<name>.py`. `boot` follows
|
||||
the initrd, stage 2 and a poweroff; `luks` answers a passphrase prompt in
|
||||
the initrd. They read tty12 as text from `/dev/vcsu12`, hold the boot with
|
||||
the initrd backdoor and gate files under `/run` instead of sleeping. Run one
|
||||
by hand with `nix run .#checks.x86_64-linux.boot.driverInteractive`, then
|
||||
`test_script()`.
|
||||
- `nix run .#docs`, from the repository root: renders `docs/boot.tape` and
|
||||
`docs/shutdown.tape` with VHS against the scripted examples into the README
|
||||
GIFs, and copies the passphrase screenshot from the `luks` check.
|
||||
Everything that boots a machine or a service manager lives under `tests/`:
|
||||
`tests/sample-machine/` holds the sample host, its slow and failing sample units
|
||||
and the interactive VM; `tests/vm-checks/` holds the NixOS tests that boot it.
|
||||
|
||||
Prefix the VM commands with `env -u LD_LIBRARY_PATH` when the shell exports
|
||||
libraries that clash with QEMU's.
|
||||
- `cargo test --workspace`: model and render snapshot tests.
|
||||
- Live against your user manager, with the sample units:
|
||||
|
||||
```sh
|
||||
units=$(nix build --no-link --print-out-paths .#sample-unit-files)
|
||||
systemctl --user link --runtime $units/*
|
||||
systemctl --user start --no-block bootvine-demo.target
|
||||
cargo run -- --user --target bootvine-demo.target --hold 3s
|
||||
systemctl --user stop $(ls $units)
|
||||
systemctl --user disable --runtime $(ls $units)
|
||||
```
|
||||
|
||||
- `nix run .#sample-machine-vm`: the sample host in a QEMU window. Its disk
|
||||
image goes to `~/.cache/bootvine-sample-machine.qcow2`.
|
||||
- `nix build .#checks.x86_64-linux.<name>`: each `tests/vm-checks/<test>.nix`
|
||||
boots a VM and runs `console.py` followed by `<test>.py`.
|
||||
`vm-boot-and-shutdown` follows the initrd, stage 2 and a poweroff;
|
||||
`vm-luks-passphrase` answers a passphrase prompt in the initrd. They read
|
||||
tty12 as text from `/dev/vcsu12`, hold the boot with the initrd backdoor and
|
||||
gate files under `/run` instead of sleeping. Run one by hand with
|
||||
`nix run .#checks.x86_64-linux.vm-boot-and-shutdown.driverInteractive`, then
|
||||
`test_script()`.
|
||||
- `nix run .#record-screencasts`, from the repository root: runs
|
||||
`cargo xtask record-screencasts`, which records `recordings/boot.tape` and
|
||||
`recordings/shutdown.tape` with VHS against the scripted examples into the README
|
||||
GIFs and copies the passphrase screenshot from the `vm-luks-passphrase` check.
|
||||
- `cargo xtask install --destdir <dir> --initrd dracut`: stages an install
|
||||
without touching the system; `cargo xtask uninstall --destdir <dir>` empties
|
||||
it again.
|
||||
|
||||
Prefix the VM and VHS commands with `env -u LD_LIBRARY_PATH` when the shell
|
||||
exports libraries that clash with QEMU's or Chromium's.
|
||||
|
||||
## Conventions
|
||||
|
||||
|
||||
Reference in new issue
Block a user