From 2431cdc047e7d514e6b511aa73edcd4f95126f0e Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sun, 25 May 2025 17:56:54 +0100 Subject: [PATCH] ci/check: group test-N derivations into one drv --- flake/dev/tests.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/flake/dev/tests.nix b/flake/dev/tests.nix index 2fbe539d..5790894a 100644 --- a/flake/dev/tests.nix +++ b/flake/dev/tests.nix @@ -1,4 +1,5 @@ { + lib, self, inputs, helpers, @@ -15,6 +16,23 @@ # Output a build matrix for CI flake.githubActions = inputs.nix-github-actions.lib.mkGithubMatrix { - inherit (self) checks; + checks = builtins.mapAttrs ( + system: + lib.flip lib.pipe [ + lib.attrsToList + # Group the "test-N" tests back into one drv + # FIXME: drop the entire test-grouping system + (builtins.groupBy ({ name, value }: if lib.strings.hasPrefix "test-" name then "test" else name)) + (builtins.mapAttrs ( + group: tests: + let + pkgs = inputs.nixpkgs.legacyPackages.${system}; + singleton = (builtins.head tests).value; + joined = pkgs.linkFarmFromDrvs group (builtins.listToAttrs tests); + in + if builtins.length tests > 1 then joined else singleton + )) + ] + ) self.checks; }; }