-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathintegration-tests.nix
66 lines (61 loc) · 1.63 KB
/
integration-tests.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib, flake-parts-lib, inputs, self, ... }:
let
inherit (lib)
mkOption
types
;
inherit (flake-parts-lib)
mkPerSystemOption
;
in
{
options = {
perSystem = mkPerSystemOption {
options.attic.integration-tests = {
nixpkgsArgs = mkOption {
type = types.attrsOf types.anything;
default = {};
};
tests = mkOption {
type = types.attrsOf types.package;
default = {};
};
stableTests = mkOption {
type = types.attrsOf types.package;
default = {};
};
};
};
};
config = {
flake.githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
checks = {
inherit (self.checks) x86_64-linux;
};
};
perSystem = { self', pkgs, config, system, ... }: let
cfg = config.attic.integration-tests;
vmPkgs = import inputs.nixpkgs ({
inherit system;
overlays = [ self.overlays.default ];
} // cfg.nixpkgsArgs);
vmPkgsStable = import inputs.nixpkgs-stable ({
inherit system;
overlays = [ self.overlays.default ];
} // cfg.nixpkgsArgs);
makeIntegrationTests = pkgs: import ../integration-tests {
inherit pkgs;
flake = self;
};
in {
attic.integration-tests = {
tests = makeIntegrationTests vmPkgs;
stableTests = makeIntegrationTests vmPkgsStable;
};
checks = let
tests = cfg.tests;
stableTests = lib.mapAttrs' (name: lib.nameValuePair "stable-${name}") cfg.stableTests;
in lib.optionalAttrs pkgs.stdenv.isLinux (tests // stableTests);
};
};
}