test(services): run tests during system builds
This commit is contained in:
@@ -6,24 +6,47 @@
|
||||
let
|
||||
vars = import ../vars.nix;
|
||||
stateDir = "${vars.services}/gems";
|
||||
gemsPackages =
|
||||
ps: with ps; [
|
||||
fastapi
|
||||
jinja2
|
||||
pydantic
|
||||
pydantic-settings
|
||||
python-multipart
|
||||
typer
|
||||
uvicorn
|
||||
];
|
||||
in
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(final: _prev: {
|
||||
gems_python = final.python314.withPackages (
|
||||
ps: with ps; [
|
||||
fastapi
|
||||
jinja2
|
||||
pydantic
|
||||
pydantic-settings
|
||||
python-multipart
|
||||
typer
|
||||
uvicorn
|
||||
]
|
||||
gems_python = final.python314.withPackages gemsPackages;
|
||||
gems_test_python = final.python314.withPackages (
|
||||
ps:
|
||||
gemsPackages ps
|
||||
++ (with ps; [
|
||||
httpx
|
||||
pytest
|
||||
pytest-asyncio
|
||||
pytest-xdist
|
||||
])
|
||||
);
|
||||
gems_tests =
|
||||
final.runCommand "gems-tests"
|
||||
{
|
||||
nativeBuildInputs = [ final.gems_test_python ];
|
||||
}
|
||||
''
|
||||
export HOME="$TMPDIR"
|
||||
cd ${inputs.self}
|
||||
pytest -o cache_dir="$TMPDIR/pytest-cache" tests/gems
|
||||
touch "$out"
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
||||
system.checks = [ pkgs.gems_tests ];
|
||||
|
||||
users.groups.gems = { };
|
||||
users.users.gems = {
|
||||
isSystemUser = true;
|
||||
|
||||
Reference in New Issue
Block a user