optimize tests for examples

This commit is contained in:
DavHau 2022-04-23 15:09:55 +02:00
parent 60d9308a7b
commit 5f8841c794
3 changed files with 28 additions and 12 deletions

View File

@ -19,6 +19,7 @@
source = src;
})
// {
checks = self.packages;
# checks are too expensive
# checks = self.packages;
};
}

View File

@ -25,6 +25,6 @@
];
})
// {
checks = self.packages;
checks.x86_64-linux.ripgrep = self.packages.x86_64-linux.ripgrep;
};
}

View File

@ -1,6 +1,8 @@
{
self,
lib,
async,
bash,
coreutils,
git,
nix,
@ -13,6 +15,8 @@
in
utils.writePureShellScript
[
async
bash
coreutils
git
nix
@ -24,16 +28,27 @@ in
examples=$1
fi
S=$(mktemp)
async -s=$S server --start -j$(nproc)
sleep 1
for dir in $examples; do
echo -e "\ntesting example for $dir"
mkdir tmp
cp ${examples}/$dir/* ./tmp/
chmod -R +w ./tmp
cd ./tmp
nix flake lock --override-input dream2nix ${../../.}
nix run .#resolveImpure
nix flake check
cd -
rm -r tmp
async -s=$S cmd -- bash -c "
echo -e \"\ntesting example for $dir\"
tmp=\$(mktemp -d)
echo \"tempdir: \$tmp\"
mkdir \$tmp
cp ${examples}/$dir/* \$tmp/
chmod -R +w \$tmp
cd \$tmp
nix flake lock --override-input dream2nix ${../../.}
nix run .#resolveImpure
nix flake check
cd -
rm -r \$tmp
"
done
async -s=$S wait
rm $S
''