1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-03 07:31:00 +01:00

libstore-tests: Build and run benchmarks in CI

This changes our GHA CI and nix-store-tests packaging
to build and run the benchmarks. This does not affect
the default packaging - the overrides apply only for the
GHA CI.
This commit is contained in:
Sergei Zimmerman 2025-08-03 01:01:26 +03:00
parent b2b2f2dc53
commit ea1f67393d
No known key found for this signature in database
4 changed files with 38 additions and 15 deletions

View file

@ -12,12 +12,14 @@
rapidcheck,
gtest,
gbenchmark,
runCommand,
# Configuration Options
version,
filesetToSource,
withBenchmarks ? false,
}:
let
@ -41,11 +43,15 @@ mkMesonExecutable (finalAttrs: {
];
# Hack for sake of the dev shell
passthru.externalBuildInputs = [
sqlite
rapidcheck
gtest
];
passthru.externalBuildInputs =
[
sqlite
rapidcheck
gtest
]
++ lib.optionals withBenchmarks [
gbenchmark
];
buildInputs = finalAttrs.passthru.externalBuildInputs ++ [
nix-store
@ -54,6 +60,7 @@ mkMesonExecutable (finalAttrs: {
];
mesonFlags = [
(lib.mesonBool "benchmarks" withBenchmarks)
];
passthru = {
@ -75,12 +82,19 @@ mkMesonExecutable (finalAttrs: {
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
buildInputs = [ writableTmpDirAsHomeHook ];
}
(''
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
export NIX_REMOTE=$HOME/store
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
'');
(
''
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
export NIX_REMOTE=$HOME/store
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
''
+ lib.optionalString withBenchmarks ''
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe' finalAttrs.finalPackage "nix-store-benchmarks"}
''
+ ''
touch $out
''
);
};
};