tests: take responsibility for flakecheck/buildbot split

This commit is contained in:
Matt Sturgeon 2025-07-01 00:58:48 +01:00
parent 2e24f8e62b
commit 278eb40fa7
2 changed files with 40 additions and 43 deletions

View file

@ -6,16 +6,13 @@
{ {
perSystem = perSystem =
{ pkgs, ... }: { pkgs, ... }:
let
tests = pkgs.callPackage ../../tests {
inherit helpers self;
};
in
{ {
# TODO: consider whether all these tests are needed in the `checks` output checks = tests.flakeCheck;
checks = pkgs.callPackages ../../tests { ci.buildbot = tests.buildbot;
inherit helpers self;
};
# TODO: consider whether all these tests are needed to be built by buildbot
ci.buildbot = pkgs.callPackages ../../tests {
inherit helpers self;
allSystems = false;
};
}; };
} }

View file

@ -5,7 +5,6 @@
linkFarm, linkFarm,
self, # The flake instance self, # The flake instance
system ? pkgs.stdenv.hostPlatform.system, system ? pkgs.stdenv.hostPlatform.system,
allSystems ? true,
}: }:
let let
autoArgs = pkgs // { autoArgs = pkgs // {
@ -30,38 +29,39 @@ let
callTest = lib.callPackageWith autoArgs; callTest = lib.callPackageWith autoArgs;
callTests = lib.callPackagesWith autoArgs; callTests = lib.callPackagesWith autoArgs;
selfPackages = self.packages.${system}; selfPackages = self.packages.${system};
# For tests that CI should only build on one system, misc = {
# This is true when on that system. extra-args-tests = callTest ./extra-args.nix { };
# extend = callTest ./extend.nix { };
# TODO: consider refactoring tests/default.nix so that some tests are extra-files = callTest ./extra-files.nix { };
# defined by it, while others are defined elsewhere... enable-except-in-tests = callTest ./enable-except-in-tests.nix { };
buildForThisSystem = allSystems || system == "x86_64-linux"; failing-tests = callTest ./failing-tests.nix { };
in no-flake = callTest ./no-flake.nix { };
lib.optionalAttrs buildForThisSystem { lib-tests = callTest ./lib-tests.nix { };
extra-args-tests = callTest ./extra-args.nix { }; maintainers = callTest ./maintainers.nix { };
extend = callTest ./extend.nix { }; nixpkgs-module = callTest ./nixpkgs-module.nix { };
extra-files = callTest ./extra-files.nix { }; plugins-by-name = callTest ./plugins-by-name.nix { };
enable-except-in-tests = callTest ./enable-except-in-tests.nix { }; generated = callTest ./generated.nix { };
failing-tests = callTest ./failing-tests.nix { }; lsp-all-servers = callTest ./lsp-servers.nix { };
no-flake = callTest ./no-flake.nix { }; };
lib-tests = callTest ./lib-tests.nix { };
maintainers = callTest ./maintainers.nix { };
nixpkgs-module = callTest ./nixpkgs-module.nix { };
plugins-by-name = callTest ./plugins-by-name.nix { };
generated = callTest ./generated.nix { };
lsp-all-servers = callTest ./lsp-servers.nix { };
}
# Expose some tests from the docs as flake-checks too
// lib.optionalAttrs (selfPackages ? docs && buildForThisSystem) {
# Individual tests can be run using: nix build .#docs.user-configs.tests.<test>
docs-user-configs = linkFarm "user-configs-tests" selfPackages.docs.user-configs.tests;
}
# These are always built on all systems, even when `allSystems = false` docs = lib.optionalAttrs (selfPackages ? docs) {
// callTests ./platforms { } # Individual tests can be run using: nix build .#docs.user-configs.tests.<test>
# Tests generated from ./test-sources docs-user-configs = linkFarm "user-configs-tests" selfPackages.docs.user-configs.tests;
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N } };
// callTests ./main.nix { }
# These are always built on all systems, even when `allSystems = false`
platforms = callTests ./platforms { };
# Tests generated from ./test-sources
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N }
main = callTests ./main.nix { };
in
{
# TODO: consider whether all these tests are needed in the `checks` output
flakeCheck = misc // docs // platforms // main;
# TODO: consider whether all these tests are needed to be built by buildbot
buildbot = lib.optionalAttrs (system == "x86_64-linux") (misc // docs) // platforms // main;
}