mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 11:36:03 +01:00
flake: Factor out checks into ci/gha/tests for reusability
This moves out the checks that get run in GHA CI into ci/gha/tests folder and splits those into `topLevel` and `componentTests` attributes. The idea behind this is to make it easier to parametrize tests that can be run with sanitizers in order to run those as a matrix of jobs. The same can be said for static builds. Existing stdenv selection infrastructure via `lib.makeComponents` would also allow us to switch over to using `clangStdenv` to significantly speed up pre-merge CI (though the default stdenv would still be used for non-overridable topLevel checks, like installer artifacts).
This commit is contained in:
parent
cff021898d
commit
9913ec55ba
2 changed files with 109 additions and 76 deletions
96
flake.nix
96
flake.nix
|
|
@ -320,43 +320,11 @@
|
|||
|
||||
checks = forAllSystems (
|
||||
system:
|
||||
{
|
||||
installerScriptForGHA = self.hydraJobs.installerScriptForGHA.${system};
|
||||
installTests = self.hydraJobs.installTests.${system};
|
||||
nixpkgsLibTests = self.hydraJobs.tests.nixpkgsLibTests.${system};
|
||||
rl-next =
|
||||
let
|
||||
pkgs = nixpkgsFor.${system}.native;
|
||||
in
|
||||
pkgs.buildPackages.runCommand "test-rl-next-release-notes" { } ''
|
||||
LANG=C.UTF-8 ${pkgs.changelog-d}/bin/changelog-d ${./doc/manual/rl-next} >$out
|
||||
'';
|
||||
repl-completion = nixpkgsFor.${system}.native.callPackage ./tests/repl-completion.nix { };
|
||||
|
||||
/**
|
||||
Checks for our packaging expressions.
|
||||
This shouldn't build anything significant; just check that things
|
||||
(including derivations) are _set up_ correctly.
|
||||
*/
|
||||
packaging-overriding =
|
||||
let
|
||||
pkgs = nixpkgsFor.${system}.native;
|
||||
nix = self.packages.${system}.nix;
|
||||
in
|
||||
assert (nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src.patches == [ pkgs.emptyFile ];
|
||||
if pkgs.stdenv.buildPlatform.isDarwin then
|
||||
lib.warn "packaging-overriding check currently disabled because of a permissions issue on macOS" pkgs.emptyFile
|
||||
else
|
||||
# If this fails, something might be wrong with how we've wired the scope,
|
||||
# or something could be broken in Nixpkgs.
|
||||
pkgs.testers.testEqualContents {
|
||||
assertion = "trivial patch does not change source contents";
|
||||
expected = "${./.}";
|
||||
actual =
|
||||
# Same for all components; nix-util is an arbitrary pick
|
||||
(nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src;
|
||||
};
|
||||
}
|
||||
(import ./ci/gha/tests {
|
||||
inherit system;
|
||||
pkgs = nixpkgsFor.${system}.native;
|
||||
nixFlake = self;
|
||||
}).topLevel
|
||||
// (lib.optionalAttrs (builtins.elem system linux64BitSystems)) {
|
||||
dockerImage = self.hydraJobs.dockerImage.${system};
|
||||
}
|
||||
|
|
@ -371,28 +339,8 @@
|
|||
flatMapAttrs
|
||||
(
|
||||
{
|
||||
# Run all tests with UBSAN enabled. Running both with ubsan and
|
||||
# without doesn't seem to have much immediate benefit for doubling
|
||||
# the GHA CI workaround.
|
||||
#
|
||||
# TODO: Work toward enabling "address,undefined" if it seems feasible.
|
||||
# This would maybe require dropping Boost coroutines and ignoring intentional
|
||||
# memory leaks with detect_leaks=0.
|
||||
"" = rec {
|
||||
nixpkgs = nixpkgsFor.${system}.native;
|
||||
nixComponents = nixpkgs.nixComponents2.overrideScope (
|
||||
nixCompFinal: nixCompPrev: {
|
||||
mesonComponentOverrides = _finalAttrs: prevAttrs: {
|
||||
mesonFlags =
|
||||
(prevAttrs.mesonFlags or [ ])
|
||||
# TODO: Macos builds instrumented with ubsan take very long
|
||||
# to run functional tests.
|
||||
++ lib.optionals (!nixpkgs.stdenv.hostPlatform.isDarwin) [
|
||||
(lib.mesonOption "b_sanitize" "undefined")
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
"" = {
|
||||
pkgs = nixpkgsFor.${system}.native;
|
||||
};
|
||||
}
|
||||
// lib.optionalAttrs (!nixpkgsFor.${system}.native.stdenv.hostPlatform.isDarwin) {
|
||||
|
|
@ -400,27 +348,23 @@
|
|||
# https://github.com/NixOS/nixpkgs/issues/320448
|
||||
# TODO: disabled to speed up GHA CI.
|
||||
# "static-" = {
|
||||
# nixpkgs = nixpkgsFor.${system}.native.pkgsStatic;
|
||||
# pkgs = nixpkgsFor.${system}.native.pkgsStatic;
|
||||
# };
|
||||
"sanitized-" = {
|
||||
pkgs = nixpkgsFor.${system}.native;
|
||||
withSanitizers = true;
|
||||
};
|
||||
}
|
||||
)
|
||||
(
|
||||
nixpkgsPrefix:
|
||||
{
|
||||
nixpkgs,
|
||||
nixComponents ? nixpkgs.nixComponents2,
|
||||
}:
|
||||
flatMapAttrs nixComponents (
|
||||
pkgName: pkg:
|
||||
flatMapAttrs pkg.tests or { } (
|
||||
testName: test: {
|
||||
"${nixpkgsPrefix}${pkgName}-${testName}" = test;
|
||||
}
|
||||
)
|
||||
)
|
||||
// lib.optionalAttrs (nixpkgs.stdenv.hostPlatform == nixpkgs.stdenv.buildPlatform) {
|
||||
"${nixpkgsPrefix}nix-functional-tests" = nixComponents.nix-functional-tests;
|
||||
}
|
||||
nixpkgsPrefix: args:
|
||||
(import ./ci/gha/tests (
|
||||
args
|
||||
// {
|
||||
nixFlake = self;
|
||||
componentTestsPrefix = nixpkgsPrefix;
|
||||
}
|
||||
)).componentTests
|
||||
)
|
||||
// devFlake.checks.${system} or { }
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue