ci: limit lefthook logging

This commit is contained in:
eric
2026-03-15 17:14:25 +01:00
parent b8d0a69d4d
commit 45f3830794
4 changed files with 9 additions and 0 deletions

View File

@@ -73,6 +73,7 @@ outputs = { self, nixpkgs, repo-lib, ... }:
- merged `packages` and `apps` from `perSystem` - merged `packages` and `apps` from `perSystem`
Checks are installed through `lefthook`, with `pre-commit` and `pre-push` commands configured to run in parallel. Checks are installed through `lefthook`, with `pre-commit` and `pre-push` commands configured to run in parallel.
repo-lib also sets Lefthook `output = [ "failure" "summary" ]` by default.
For advanced Lefthook features, use raw `config.lefthook` or `perSystem.lefthook`. Those attrsets are merged after generated checks, so you can augment a generated command with fields that the simple `checks` abstraction does not carry, such as `stage_fixed`: For advanced Lefthook features, use raw `config.lefthook` or `perSystem.lefthook`. Those attrsets are merged after generated checks, so you can augment a generated command with fields that the simple `checks` abstraction does not carry, such as `stage_fixed`:

View File

@@ -425,6 +425,12 @@ let
inherit src; inherit src;
config = lib.foldl' lib.recursiveUpdate { } ( config = lib.foldl' lib.recursiveUpdate { } (
[ [
{
output = [
"failure"
"summary"
];
}
(parallelHookStageConfig "pre-commit") (parallelHookStageConfig "pre-commit")
(parallelHookStageConfig "pre-push") (parallelHookStageConfig "pre-push")
(lib.setAttrByPath [ "pre-commit" "commands" "treefmt" ] { (lib.setAttrByPath [ "pre-commit" "commands" "treefmt" ] {

View File

@@ -53,6 +53,7 @@
# These checks become lefthook commands in the generated `lefthook.yml`. # These checks become lefthook commands in the generated `lefthook.yml`.
# repo-lib runs `pre-commit` and `pre-push` hook commands in parallel. # repo-lib runs `pre-commit` and `pre-push` hook commands in parallel.
# It also sets `output = [ "failure" "summary" ]` by default.
checks = { checks = {
tests = { tests = {
command = "echo 'No tests defined yet.'"; command = "echo 'No tests defined yet.'";

View File

@@ -1258,6 +1258,7 @@ run_mk_repo_lefthook_case() {
run_capture_ok "$case_name: lefthook.yml derivation show failed" bash -c 'nix derivation show "$1" >"$2"' _ "$lefthook_yml_drv" "$lefthook_yml_json" run_capture_ok "$case_name: lefthook.yml derivation show failed" bash -c 'nix derivation show "$1" >"$2"' _ "$lefthook_yml_drv" "$lefthook_yml_json"
assert_contains '\"pre-push\":{\"commands\":{\"tests\":{' "$lefthook_yml_json" "$case_name: generated check missing from pre-push" assert_contains '\"pre-push\":{\"commands\":{\"tests\":{' "$lefthook_yml_json" "$case_name: generated check missing from pre-push"
assert_contains 'repo-lib-check-tests' "$lefthook_yml_json" "$case_name: generated check command missing from lefthook config" assert_contains 'repo-lib-check-tests' "$lefthook_yml_json" "$case_name: generated check command missing from lefthook config"
assert_contains '\"output\":[\"failure\",\"summary\"]' "$lefthook_yml_json" "$case_name: lefthook output config missing"
assert_contains '\"stage_fixed\":true' "$lefthook_yml_json" "$case_name: stage_fixed missing from lefthook config" assert_contains '\"stage_fixed\":true' "$lefthook_yml_json" "$case_name: stage_fixed missing from lefthook config"
rm -rf "$workdir" rm -rf "$workdir"