Files
komorebi/justfile
T
LGUG2Z bab8f35234 ci(github): a weekly canary against the tip of nixpkgs
komorebi follows the tip of nixpkgs-unstable, so KWin and Plasma move under it
each time flake.lock does, and the pull request that moves the lock runs the
slow VM tier only when it is labeled. The `canary` job of ci.yaml, on the weekly
schedule and on a manual run, copies the checkout, runs `nix flake update
nixpkgs` in the copy and builds every check against the result: the checks that
need no virtual machine, listed as the lint job lists them, then the suites of
both tiers, listed from `vmTiers` as the discover job does. They run one after
the other on one KVM runner, so that komorebi and the guests are built once
against the new nixpkgs; the job may take the six hours a hosted runner allows.

When a check fails, the job opens an issue titled "Canary: a check fails against
the tip of nixpkgs-unstable" with the failed checks, the nixpkgs revision, and
the KWin version at the tip and in flake.lock, or comments on that issue if it
is open. The same report goes to the job summary on every run. The job's token
can read the contents and write issues, nothing more, and the checkout keeps no
credentials, so the repository is never changed.

The composite action takes `cache: "false"`, which the canary passes. The store
cache is keyed on flake.lock: what it restored would be the old nixpkgs, taking
disk the guests need, and what it saved would replace the store of the jobs that
do use the lock.

`just lint` runs actionlint, with shellcheck over the scripts, both from the
nixpkgs flake.lock pins, so the lint job and `just check` check the workflows.

The steps were run as written on an x86_64 machine with KVM, against a fake gh:
GitHub Actions has not run the job yet. CONTRIBUTING.md, docs/dev/vm-tests.md
and DESIGN.md say what it does and why.
2026-10-28 07:39:49 -07:00

70 lines
3.2 KiB
Makefile

export RUST_BACKTRACE := "full"
# format the Rust sources (needs a nightly rustfmt: rustfmt.toml uses unstable options)
fmt:
cargo fmt
# everything a change has to pass before it is pushed
check: lint check-js
cargo fmt --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --locked
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked
# the KWin bridge, which is JavaScript: its types, checked by tsc from its JSDoc comments, and its
# tests, which node runs against a fake KWin (no package.json, no build step)
check-js:
cd komorebi/src/kwin && tsc -p tsconfig.json
node --test komorebi/src/kwin/bridge.test.js
# the macros the codebase has agreed not to use, and the workflows, which actionlint checks (with
# shellcheck over their scripts), both from the nixpkgs flake.lock pins
lint:
test -z "$(rg 'eyre!' --type rust .)" || (echo "eyre! macro not allowed"; false)
test -z "$(rg 'dbg!' --type rust .)" || (echo "dbg! macro not allowed"; false)
test -z "$(rg 'println!' --type rust ./komorebi/src)" || (echo "println! macro not allowed"; false)
nix shell --inputs-from . nixpkgs#actionlint nixpkgs#shellcheck --command actionlint .github/workflows/*.yaml
# the JSON Schemas of komorebi.json and of applications.json, from the Rust types
jsonschema:
cargo run --package komorebic --locked -- static-config-schema > schema.json
cargo run --package komorebic --locked -- application-specific-configuration-schema > schema.asc.json
# the options of the module's `config`, from schema.json, with the hash of the schema they were
# made from in the first line (the check `schema-fresh` compares it); needs schemars-nixgen
# (`cargo install schemars-nixgen`), which the dev shell does not have
nixgen:
schemars-nixgen schema.json -o nix/komorebi-options.nix --name komorebi --description "komorebi for KDE Plasma configuration"
printf '# schema-sha256: %s\n' "$(nix hash file --type sha256 --base16 schema.json)" | cat - nix/komorebi-options.nix > nix/komorebi-options.nix.new
mv nix/komorebi-options.nix.new nix/komorebi-options.nix
nix fmt nix/komorebi-options.nix
nix build -L --no-link ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem).nix-options-validation"
# one VM test, on this machine: `just vm kwin`. Linux boots the guest under KVM through the
# flake check; a Mac builds the guest on a builder and runs the driver (see docs/dev/vm-tests.md)
vm name:
#!/usr/bin/env bash
set -euo pipefail
if [ "$(uname)" = Darwin ]; then
scripts/vm-mac {{ name }}
else
nix build -L .#checks.{{ arch() }}-linux.vm-{{ name }}
fi
# every VM test, in the order of the flake
vm-all:
#!/usr/bin/env bash
set -euo pipefail
system=$(nix eval --raw --impure --expr builtins.currentSystem)
for name in $(nix eval --json ".#legacyPackages.$system.vm" --apply builtins.attrNames | jq -r '.[]'); do
just vm "$name"
done
# write the help of every komorebic subcommand to docs/cli, one page each
docgen:
rm -f docs/cli/*.md
cargo run --package komorebic --locked -- docgen --output docs/cli
run target *args:
cargo run --bin {{ target }} --locked -- {{ args }}