Skip to content

Commit

Permalink
group tests by type
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre authored and Pierre committed Nov 22, 2023
1 parent 805b008 commit e557ff0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,16 @@ Come hang out in the [Matrix channel](https://matrix.to/#/%23selfhostblocks%3Ama

### Run tests

Run all tests:

```bash
$ nix build .#checks.${system}.all
```

Run one group of tests:

```bash
$ nix flake check
$ nix build .#checks.${system}.module
```

### Deploy using colmena
Expand Down
40 changes: 22 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
);
}

0 comments on commit e557ff0

Please sign in to comment.