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 =
{ pkgs, ... }:
let
tests = pkgs.callPackage ../../tests {
inherit helpers self;
};
in
{
# TODO: consider whether all these tests are needed in the `checks` output
checks = pkgs.callPackages ../../tests {
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;
};
checks = tests.flakeCheck;
ci.buildbot = tests.buildbot;
};
}

View file

@ -5,7 +5,6 @@
linkFarm,
self, # The flake instance
system ? pkgs.stdenv.hostPlatform.system,
allSystems ? true,
}:
let
autoArgs = pkgs // {
@ -30,38 +29,39 @@ let
callTest = lib.callPackageWith autoArgs;
callTests = lib.callPackagesWith autoArgs;
selfPackages = self.packages.${system};
# For tests that CI should only build on one system,
# This is true when on that system.
#
# TODO: consider refactoring tests/default.nix so that some tests are
# defined by it, while others are defined elsewhere...
buildForThisSystem = allSystems || system == "x86_64-linux";
in
lib.optionalAttrs buildForThisSystem {
extra-args-tests = callTest ./extra-args.nix { };
extend = callTest ./extend.nix { };
extra-files = callTest ./extra-files.nix { };
enable-except-in-tests = callTest ./enable-except-in-tests.nix { };
failing-tests = callTest ./failing-tests.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;
}
misc = {
extra-args-tests = callTest ./extra-args.nix { };
extend = callTest ./extend.nix { };
extra-files = callTest ./extra-files.nix { };
enable-except-in-tests = callTest ./enable-except-in-tests.nix { };
failing-tests = callTest ./failing-tests.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 { };
};
# These are always built on all systems, even when `allSystems = false`
// callTests ./platforms { }
# Tests generated from ./test-sources
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N }
// callTests ./main.nix { }
docs = lib.optionalAttrs (selfPackages ? docs) {
# 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`
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;
}