mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
tests: refactor outputs
Reduce redundant imports and group at higher level available for use in more outputs. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
faa5b42eca
commit
2b87f9a53a
1 changed files with 97 additions and 85 deletions
|
|
@ -26,15 +26,13 @@
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
];
|
];
|
||||||
|
|
||||||
ciTestChunks =
|
testChunks =
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
# Create chunked test packages for better CI parallelization
|
# Create chunked test packages for better CI parallelization
|
||||||
testChunks =
|
|
||||||
let
|
|
||||||
tests = import ./. {
|
tests = import ./. {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
# Disable big tests since this is only used for CI
|
# Disable big tests since this is only used for CI
|
||||||
|
|
@ -69,66 +67,72 @@
|
||||||
i: lib.nameValuePair "test-chunk-${toString (i + 1)}" (makeChunk (i + 1) filteredTests)
|
i: lib.nameValuePair "test-chunk-${toString (i + 1)}" (makeChunk (i + 1) filteredTests)
|
||||||
) numChunks
|
) numChunks
|
||||||
);
|
);
|
||||||
in
|
|
||||||
testChunks;
|
|
||||||
|
|
||||||
allPackagesAndTests =
|
integrationTests =
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
in
|
||||||
renamedBuildTests =
|
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux (
|
||||||
let
|
let
|
||||||
|
tests = import ./integration { inherit pkgs lib; };
|
||||||
|
renameTestPkg = n: v: lib.nameValuePair "integration-${n}" v;
|
||||||
|
in
|
||||||
|
lib.mapAttrs' renameTestPkg (lib.removeAttrs tests [ "all" ])
|
||||||
|
);
|
||||||
|
|
||||||
|
# Test group definitions
|
||||||
|
buildTests =
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
tests = import ./. { inherit pkgs; };
|
tests = import ./. { inherit pkgs; };
|
||||||
renameTestPkg = n: lib.nameValuePair "test-${n}";
|
renameTestPkg = n: nixpkgs.lib.nameValuePair "test-${n}";
|
||||||
in
|
in
|
||||||
lib.mapAttrs' renameTestPkg tests.build;
|
nixpkgs.lib.mapAttrs' renameTestPkg tests.build;
|
||||||
|
|
||||||
integrationTestPackages =
|
buildTestsNoBig =
|
||||||
let
|
system:
|
||||||
tests = import ./integration {
|
|
||||||
inherit pkgs;
|
|
||||||
inherit (pkgs) lib;
|
|
||||||
};
|
|
||||||
renameTestPkg = n: lib.nameValuePair "integration-test-${n}";
|
|
||||||
in
|
|
||||||
lib.mapAttrs' renameTestPkg tests;
|
|
||||||
|
|
||||||
# Aggregate test set without big tests
|
|
||||||
testAllNoBig =
|
|
||||||
let
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
tests = import ./. {
|
tests = import ./. {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
enableBig = false;
|
enableBig = false;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.nameValuePair "test-all-no-big" tests.build.all;
|
{
|
||||||
|
test-all-no-big = tests.build.all;
|
||||||
|
};
|
||||||
|
|
||||||
# Aggregate test set without big tests, with legacy IFD
|
buildTestsNoBigIfd =
|
||||||
testAllNoBigIfd =
|
system:
|
||||||
let
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
tests = import ./. {
|
tests = import ./. {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
enableBig = false;
|
enableBig = false;
|
||||||
enableLegacyIfd = true;
|
enableLegacyIfd = true;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.nameValuePair "test-all-no-big-ifd" tests.build.all;
|
{
|
||||||
|
test-all-no-big-ifd = tests.build.all;
|
||||||
|
};
|
||||||
|
|
||||||
|
integrationTestPackages =
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
tests = import ./integration { inherit pkgs lib; };
|
||||||
|
renameTestPkg = n: lib.nameValuePair "integration-test-${n}";
|
||||||
in
|
in
|
||||||
# Merge all the packages and tests meant for the 'packages' output
|
lib.mapAttrs' renameTestPkg tests;
|
||||||
renamedBuildTests
|
|
||||||
// integrationTestPackages
|
|
||||||
// (lib.listToAttrs [
|
|
||||||
testAllNoBig
|
|
||||||
testAllNoBigIfd
|
|
||||||
])
|
|
||||||
// (ciTestChunks system);
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# TODO: increase buildbot testing scope
|
# TODO: increase buildbot testing scope
|
||||||
buildbot = forCI ciTestChunks;
|
buildbot = forCI (system: (testChunks system));
|
||||||
|
|
||||||
devShells = forAllSystems (
|
devShells = forAllSystems (
|
||||||
system:
|
system:
|
||||||
|
|
@ -139,6 +143,14 @@
|
||||||
tests.run
|
tests.run
|
||||||
);
|
);
|
||||||
|
|
||||||
packages = forAllSystems allPackagesAndTests;
|
packages = forAllSystems (
|
||||||
|
system:
|
||||||
|
(buildTests system)
|
||||||
|
// (integrationTestPackages system)
|
||||||
|
// (buildTestsNoBig system)
|
||||||
|
// (buildTestsNoBigIfd system)
|
||||||
|
// (testChunks system)
|
||||||
|
// (integrationTests system)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue