Every push runs `nix flake check`: the package with its tests, new `clippy` (warnings as errors) and `fmt` checks, and the VM test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1f834df326
commit
538a288182
6 files changed
+64
-2
No files matched your search
@@ -0,0 +1,24 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-26.04
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: DeterminateSystems/determinate-nix-action@v3
|
||||
with:
|
||||
# Gitea supplies its own token as GITHUB_TOKEN, which the action would pass to Nix for
|
||||
# downloads from GitHub
|
||||
github-token: ${{ secrets.GH_PULL_TOKEN }}
|
||||
extra-conf: |
|
||||
sandbox-fallback = false
|
||||
|
||||
# Builds the package with its tests, clippy, rustfmt and the VM test (which needs KVM), and
|
||||
# evaluates the other outputs
|
||||
- name: Check the flake
|
||||
run: nix flake check -L
|
||||
@@ -40,6 +40,10 @@ of devenv's scripts, `devenv test` or the demo's host side.
|
||||
errors) and the tests.
|
||||
- `cargo fmt` — the crate is formatted with `rustfmt` (`rustfmt.toml`); run it on code you change.
|
||||
- `nix build` — the package, which also runs the tests.
|
||||
- CI ([`.gitea/workflows/ci.yaml`](.gitea/workflows/ci.yaml)) runs `nix flake check` on every push:
|
||||
the package with its tests, `clippy` (warnings as errors), `fmt` (`cargo fmt --check`) and the VM
|
||||
test. Keep them passing. `nix flake check --no-build` fails where the VM test's keys haven't been
|
||||
built, because the test reads them at evaluation.
|
||||
- `vm-test` (or `nix build -L .#checks.x86_64-linux.vm`) — the NixOS VM test of the broker module
|
||||
(needs KVM).
|
||||
- The [demo](docs/demo.md): `devenv up -d` starts the host side (the broker from this checkout, its
|
||||
|
||||
@@ -26,8 +26,9 @@ How the code is put together, and how to extend it. The design and its rationale
|
||||
| `tests/broker.rs` | Handler tests over an in-memory duplex stream with a fake `ssh` |
|
||||
| `src/web/` | The approvals web app: routes (`mod.rs`), OIDC sign-in and passkey confirmation (`auth.rs`), Web Push (`push.rs`), the audit log by request (`history.rs`), the pages (`page.rs`) and static assets |
|
||||
| `templates/`, `askama.toml` | The web app's HTML, as [askama](https://askama.rs) templates compiled into the broker; `askama.toml` passes everything they show through `ops::printable` before escaping it |
|
||||
| `nix/` | The package, NixOS modules (`modules/nixos`), home-manager module (`modules/home-manager`), the VM test (`vm-test.nix`, `checks.<system>.vm`) and the demo's VMs (`demo/`, `packages.<system>.demo` and `demo-box`) |
|
||||
| `nix/` | The package, NixOS modules (`modules/nixos`), home-manager module (`modules/home-manager`), the VM test (`vm-test.nix`, `checks.<system>.vm`), clippy and rustfmt checks (`lints.nix`) and the demo's VMs (`demo/`, `packages.<system>.demo` and `demo-box`) |
|
||||
| `devenv.nix` | The development environment, its scripts and the demo's host side (`devenv up`); `nix develop` gives a plainer shell from `flake.nix` without them |
|
||||
| `.gitea/workflows/ci.yaml` | CI: `nix flake check` |
|
||||
|
||||
## Request lifecycle
|
||||
|
||||
|
||||
@@ -438,6 +438,8 @@ Both wait until a concrete need comes up.
|
||||
the `services.slop-broker` module, with its real service hardening, over vsock loopback, against
|
||||
a local `sshd`. Run it after changing the module, the service or the transport (it needs KVM):
|
||||
`vm-test` in the devenv shell, or `nix build -L .#checks.x86_64-linux.vm`.
|
||||
- **CI** ([`ci.yaml`](../.gitea/workflows/ci.yaml)): every push runs `nix flake check`, which builds
|
||||
the package with its tests, checks clippy and rustfmt (`nix/lints.nix`), and runs the VM test.
|
||||
- **Demo** ([`demo.md`](demo.md)): not a test, but the quickest way to try the web app and
|
||||
passkey approvals by hand.
|
||||
- New operations add tests against fakes of what they call (deploy-rs, the DNS provider's API).
|
||||
@@ -48,7 +48,7 @@
|
||||
checks = forSystems (pkgs: {
|
||||
package = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
vm = pkgs.callPackage ./nix/vm-test.nix { slop-broker = self.packages.${pkgs.stdenv.hostPlatform.system}.default; };
|
||||
});
|
||||
} // import ./nix/lints.nix { inherit pkgs; slop-broker = self.packages.${pkgs.stdenv.hostPlatform.system}.default; });
|
||||
|
||||
# A plain alternative to the devenv shell, for `nix develop`: the toolchain and the build's
|
||||
# inputs, without devenv's scripts or the demo
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Checks that the crate is free of clippy warnings and formatted with rustfmt, as CI requires
|
||||
{ pkgs, slop-broker }:
|
||||
let
|
||||
inherit (pkgs.lib.fileset) toSource unions;
|
||||
in
|
||||
{
|
||||
clippy = slop-broker.overrideAttrs (old: {
|
||||
pname = "slop-broker-clippy";
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.clippy ];
|
||||
buildPhase = ''
|
||||
cargo clippy --offline --all-targets -- -D warnings
|
||||
'';
|
||||
doCheck = false;
|
||||
installPhase = ''
|
||||
touch $out
|
||||
'';
|
||||
});
|
||||
|
||||
fmt = pkgs.runCommand "slop-broker-fmt"
|
||||
{
|
||||
nativeBuildInputs = with pkgs; [ cargo rustfmt ];
|
||||
src = toSource {
|
||||
root = ../.;
|
||||
fileset = unions [ ../Cargo.toml ../Cargo.lock ../rustfmt.toml ../src ../tests ];
|
||||
};
|
||||
} ''
|
||||
cd $src
|
||||
cargo fmt --check
|
||||
touch $out
|
||||
'';
|
||||
}
|
||||
Reference in new issue
Block a user