From 4b9e0ad173cdc2914276dae16d8615c2698d7adb Mon Sep 17 00:00:00 2001 From: Pierre Penninckx Date: Tue, 21 Nov 2023 22:18:48 -0800 Subject: [PATCH] group tests by type --- README.md | 10 +++++++++- flake.nix | 40 ++++++++++++++++++++++------------------ 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index f400050..cd5ee8b 100644 --- a/README.md +++ b/README.md @@ -686,8 +686,16 @@ Come hang out in the [Matrix channel](https://matrix.to/#/%23selfhostblocks%3Ama ### Run tests +Run all tests: + ```bash -$ nix flake check +$ nix build .#checks.${system}.all +``` + +Run one group of tests: + +```bash +$ nix build .#checks.${system}.module ``` ### Deploy using colmena diff --git a/flake.nix b/flake.nix index c428fb0..2d0e5f6 100644 --- a/flake.nix +++ b/flake.nix @@ -36,26 +36,30 @@ ]; }; - checks = { - tests = nix-flake-tests.lib.check { - inherit pkgs; - tests = - let - importFiles = files: - map (m: import m { - inherit pkgs; - inherit (pkgs) lib; - }) files; + checks = + let + importFiles = files: + map (m: import m { + inherit pkgs; + inherit (pkgs) lib; + }) files; - mergeTests = pkgs.lib.lists.foldl pkgs.lib.trivial.mergeAttrs {}; - in mergeTests (importFiles [ - ./test/modules/arr.nix - ./test/modules/davfs.nix - ./test/modules/postgresql.nix - ]); + mergeTests = pkgs.lib.lists.foldl pkgs.lib.trivial.mergeAttrs {}; + in rec { + all = mergeTests [ + modules + ]; + + modules = nix-flake-tests.lib.check { + inherit pkgs; + tests = + mergeTests (importFiles [ + ./test/modules/arr.nix + ./test/modules/davfs.nix + ./test/modules/postgresql.nix + ]); + }; }; - }; - # templates.default = {}; Would be nice to have a template } ); }