create nix test infrastructure
This commit is contained in:
parent
192561577e
commit
0a9e1c089b
40
flake.nix
40
flake.nix
@ -51,10 +51,37 @@
|
||||
ocaml-lsp
|
||||
ocamlformat
|
||||
ocamlformat-rpc-lib
|
||||
pkgs.just
|
||||
];
|
||||
in {
|
||||
devShells.default = mkShell {
|
||||
buildInputs = minimal ++ dev;
|
||||
shellHook = let
|
||||
justFile = ''
|
||||
default:
|
||||
@just --list
|
||||
|
||||
@build:
|
||||
nix build .#debug --offline
|
||||
|
||||
@release:
|
||||
nix build --offline
|
||||
|
||||
@test:
|
||||
printf "\\n\\n\\t************ running nix+dune tests ************\\n\\n\\n"
|
||||
nix flake check --offline
|
||||
nix build .#tests --offline
|
||||
printf "\\n\\n\\t************ running visual test ************\\n\\n\\n"
|
||||
echo one two three four | CULRS="(255,0,0);(0,0,255);#00FF00" CULR_ORDER="1;0;2" result/bin/culr
|
||||
'';
|
||||
in ''
|
||||
printf '${justFile}' > justfile
|
||||
'';
|
||||
};
|
||||
|
||||
checks.default = pkgs.callPackage ./nix/test.nix {
|
||||
culr = self.packages.${system}.tests;
|
||||
inherit version;
|
||||
};
|
||||
|
||||
packages.default = pkgs.callPackage ./nix/default.nix {
|
||||
@ -62,7 +89,18 @@
|
||||
inherit version;
|
||||
};
|
||||
|
||||
defaultPackage = self.packages.${system}.default;
|
||||
packages.debug = pkgs.callPackage ./nix/default.nix {
|
||||
debug = true;
|
||||
ocaml-deps = minimal;
|
||||
inherit version;
|
||||
};
|
||||
|
||||
packages.tests = pkgs.callPackage ./nix/default.nix {
|
||||
debug = true;
|
||||
ocaml-deps = minimal;
|
||||
doCheck = true;
|
||||
inherit version;
|
||||
};
|
||||
}
|
||||
)
|
||||
// {
|
||||
|
@ -1,15 +1,30 @@
|
||||
{
|
||||
ocaml-deps,
|
||||
ocamlPackages,
|
||||
version,
|
||||
...
|
||||
}:
|
||||
lib,
|
||||
ocaml-deps,
|
||||
ocamlPackages,
|
||||
version,
|
||||
debug ? false,
|
||||
...
|
||||
}:
|
||||
ocamlPackages.buildDunePackage {
|
||||
pname = "culr";
|
||||
version = "0.1-${version}";
|
||||
pname = "culr";
|
||||
version = "0.1-${version}";
|
||||
|
||||
minimalOCamlVersion = "5.2";
|
||||
minimalOCamlVersion = "5.2";
|
||||
|
||||
src = ./..;
|
||||
buildInputs = ocaml-deps;
|
||||
src = ./..;
|
||||
buildInputs = ocaml-deps;
|
||||
|
||||
buildPhase =
|
||||
if debug
|
||||
then ''
|
||||
runHook preBuild
|
||||
dune build --profile debug -p culr ''${enableParallelBuilding:+-j $NIX_BUILD_CORES}
|
||||
runHook postBuild
|
||||
''
|
||||
else ''
|
||||
runHook preBuild
|
||||
dune build --profile release -p culr ''${enableParallelBuilding:+-j $NIX_BUILD_CORES}
|
||||
runHook postBuild
|
||||
'';
|
||||
}
|
||||
|
20
nix/test.nix
Normal file
20
nix/test.nix
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
culr,
|
||||
version,
|
||||
...
|
||||
}:
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "culr-tests";
|
||||
version = "${version}";
|
||||
|
||||
nativebuildInputs = [culr];
|
||||
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
CULRS="(255,0,0);(0,0,255)"
|
||||
CULR_ORDER=1,0
|
||||
echo "one two three four" | ${lib.getExe culr}
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user