Skip to content

Commit

Permalink
buildPursPackage: compile/test properly
Browse files Browse the repository at this point in the history
Compile all required sources and execute unit tests during the checkPhase.
By default checkPhase is disabled, but can be enabled via `doCheck = true`
as argument to `buildPursPackage`
  • Loading branch information
gilligan committed Jan 11, 2021
1 parent 3da9481 commit c889e80
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions nix/lib/purescript.nix
Expand Up @@ -19,14 +19,16 @@
, webCommon
# node_modules to use
, nodeModules
# control execution of unit tests
, doCheck ? false
}:
let
# Cleans the source based on the patterns in ./.gitignore and the additionalIgnores
cleanSrcs = nix-gitignore.gitignoreSource [ "/*.adoc" "/*.nix" ] src;

in
stdenv.mkDerivation {
inherit name;
inherit name doCheck;
src = cleanSrcs;
buildInputs = [ nodeModules easyPS.purs easyPS.spago easyPS.psc-package ];
buildPhase = ''
Expand All @@ -37,9 +39,14 @@ stdenv.mkDerivation {
ln -s ${webCommon} ../web-common
sh ${spagoPackages.installSpagoStyle}
sh ${spagoPackages.buildSpagoStyle}
sh ${spagoPackages.buildSpagoStyle} src/**/*.purs test/**/*.purs generated/**/*.purs ../web-common/**/*.purs
${nodejs}/bin/npm run webpack
'';

checkPhase = ''
${nodejs}/bin/node -e 'require("./output/Test.Main").main()'
'';

installPhase = ''
mv dist $out
'';
Expand Down

0 comments on commit c889e80

Please sign in to comment.