mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-23 00:44:15 +01:00
The unit tests run against a fake desktop and cannot say whether KWin does what the daemon asks. This adds the other half: NixOS machines with Plasma in them, a real KWin, and a Python library to drive it. Every directory under `nix/tests/vm/suites` is a test. The generator lists the directory, so a new suite appears as `checks.<system>.vm-NAME` on Linux and as `legacyPackages.<system>.vm.NAME` everywhere, with no edit to the flake. A suite names its tier and its node and has a `test.py`; `legacyPackages.<system>.vmTiers` lists the names of each tier as JSON for the CI matrix, `vmGuests` the guests to build on a Linux builder, and `vmTcg` the same suites for a machine with no KVM. `scale` multiplies every wait: 1 for KVM, 1.5 for HVF, 8 for TCG. The headless node runs `kwin_wayland --virtual` as user units of a lingering user, one pair of units per session (`session-bus@NAME`, `kwin-virtual@NAME`), so a test can run several sessions with their own bus and socket. A virtual KWin has no output to draw on, so anything that needs pixels or a pointer needs the session node. The library, `komorebi_vm`, has `Checks` (counted checks that fail once, at the end) and `Kde` (start a session, run clients and tools inside it, read windows through kdotool, poll with `wait_for`). It depends on a small `Machine` protocol rather than on the test driver. The `vm-lib` check runs its unit tests against a fake machine, with ruff and ty. The driver type checks each `test.py` with ty, which is how a protocol that did not match `QemuMachine.execute` was caught. `vm-kwin` starts a KWin with two outputs, spawns a foot window, reads it back, starts a second session and checks that it cannot see the first. On a Mac the guest is built on a Linux builder and the driver run directly, because the macOS nix sandbox cannot give QEMU the hypervisor: `scripts/vm-mac`, `just vm NAME`. docs/dev/vm-tests.md covers this, adding a test, and the builder.
86 lines
3.8 KiB
Markdown
86 lines
3.8 KiB
Markdown
# Contributing to the Project
|
|
|
|
The project is a collection of contributions from both the project leaders and
|
|
community members. There are many ways to contribute, this can include content
|
|
in the project repositories, as well as contributing in public and private
|
|
conversation, assisting users, writing blog posts, and many other ways.
|
|
|
|
## How contributions are made
|
|
|
|
Contributions to the project primarily happen in the project source
|
|
repositories, but may also occur in other places, such as discussion forums and
|
|
public and private discourse.
|
|
|
|
## Contributing content to the Project
|
|
|
|
In order for the project leaders to manage sustained progress toward the
|
|
project goals and maintain project velocity, focus and quality, the project may
|
|
adjust the license terms over time.
|
|
|
|
Content contributed to the project must therefore be provided under
|
|
sufficiently liberal terms to allow these operations to proceed unimpeded. As
|
|
such contributions are accepted with the following understanding:
|
|
|
|
* Contributed content is licensed under the terms of the 0-BSD license
|
|
* Contributors accept the terms of the project license at the time of
|
|
contribution
|
|
|
|
By making a contribution, you accept both the current project license terms,
|
|
and that all contributions that you have made are provided under the terms of
|
|
the 0-BSD license.
|
|
|
|
## Working on the code
|
|
|
|
`nix develop` (or [direnv](https://direnv.net), through the [`.envrc`](.envrc))
|
|
provides the Rust toolchain, a nightly `rustfmt` and the tools the checks use.
|
|
[`rustfmt.toml`](rustfmt.toml) uses an unstable option, which is why the
|
|
formatter is a nightly one.
|
|
|
|
`just check` runs everything a change has to pass before it is pushed: the
|
|
formatting check, clippy with warnings denied, the tests, and rustdoc with
|
|
warnings denied. `just fmt` formats the Rust sources, and `nix fmt` every file
|
|
type the repository has. `nix flake check` is what CI runs; it builds the same
|
|
checks, plus `cargo deny`, as derivations.
|
|
|
|
## VM tests
|
|
|
|
A change that needs a real KWin to be checked comes with a VM test, next to
|
|
the Rust test that covers the same behavior against the fake desktop.
|
|
[`docs/dev/vm-tests.md`](docs/dev/vm-tests.md) says how they are laid out, how
|
|
to run one (`just vm NAME`) and how to add one.
|
|
|
|
## Continuous integration
|
|
|
|
[`ci.yaml`](.github/workflows/ci.yaml) runs on every pull request and on every
|
|
push to `master`, `feature/*` and `hotfix/*`, in this repository only. The
|
|
`lint` job runs `nix flake check` and the repository's own lint rules, and
|
|
`cargo-deny` checks licenses and advisories. A weekly
|
|
[workflow](.github/workflows/update-flake-lock.yaml) opens a pull request that
|
|
moves `flake.lock`, and the same jobs run on it.
|
|
|
|
## Commits
|
|
|
|
Commit messages follow the
|
|
[Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
`type(scope): description`. The scope is the Rust module the change is in
|
|
(`wm`, `kwin`, `layouts`), `repo` for repository files and markdown, `nix` for
|
|
the flake and `github` for workflows. Every line of a message, the header
|
|
included, is at most 80 columns, and the body says why the change is made.
|
|
|
|
Documentation lands in the commit that changes the behavior it describes, not
|
|
in a later one.
|
|
|
|
## Zero-Clause BSD
|
|
|
|
```text
|
|
Permission to use, copy, modify, and/or distribute this software for
|
|
any purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL
|
|
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
|
|
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
|
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
|
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
``` |