diff --git a/default.nix b/default.nix index c4790e46fe3..a0d66564306 100644 --- a/default.nix +++ b/default.nix @@ -132,10 +132,12 @@ let walletIntegrationTests = pkgs.callPackage ./scripts/test/wallet/integration { inherit gitrev; }; validateJson = pkgs.callPackage ./tools/src/validate-json {}; demoCluster = pkgs.callPackage ./scripts/launch/demo-cluster { inherit gitrev; }; - tests = { - shellcheck = pkgs.callPackage ./scripts/test/shellcheck.nix { src = ./.; }; - hlint = pkgs.callPackage ./scripts/test/hlint.nix { src = ./.; }; - stylishHaskell = pkgs.callPackage ./scripts/test/stylish.nix { src = ./.; stylish-haskell = cardanoPkgs.stylish-haskell; }; + tests = let + src = localLib.cleanSourceTree ./.; + in { + shellcheck = pkgs.callPackage ./scripts/test/shellcheck.nix { inherit src; }; + hlint = pkgs.callPackage ./scripts/test/hlint.nix { inherit src; }; + stylishHaskell = pkgs.callPackage ./scripts/test/stylish.nix { inherit (cardanoPkgs) stylish-haskell; inherit src; }; buildWalletIntegration = pkgs.callPackage ./scripts/test/wallet/integration/build-test.nix { inherit walletIntegrationTests pkgs; }; swaggerSchemaValidation = pkgs.callPackage ./scripts/test/wallet/swaggerSchemaValidation.nix { inherit gitrev; }; }; diff --git a/scripts/test/hlint.nix b/scripts/test/hlint.nix index 8e9e6e533dc..cc0be9ca0f0 100644 --- a/scripts/test/hlint.nix +++ b/scripts/test/hlint.nix @@ -1,13 +1,16 @@ { runCommand, hlint, src, lib }: let - cleanSourceFilter = with lib; + # just haskell sources and the hlint config file + src' = lib.cleanSourceWith { + inherit src; + filter = with lib; name: type: let baseName = baseNameOf (toString name); in ( (type == "regular" && hasSuffix ".hs" baseName) || (type == "regular" && hasSuffix ".yaml" baseName) || (type == "directory") ); - src' = builtins.filterSource cleanSourceFilter src; + }; in runCommand "cardano-hlint-check" { buildInputs = [ hlint ]; } '' set +e diff --git a/scripts/test/shellcheck.nix b/scripts/test/shellcheck.nix index bad29a79e78..7928d886cd7 100644 --- a/scripts/test/shellcheck.nix +++ b/scripts/test/shellcheck.nix @@ -1,12 +1,15 @@ { runCommand, shellcheck, src, lib }: let - cleanSourceFilter = with lib; + # just the shell scripts + src' = lib.cleanSourceWith { + inherit src; + filter = with lib; name: type: let baseName = baseNameOf (toString name); in ( (type == "regular" && hasSuffix ".sh" baseName) || (type == "directory") ); - src' = builtins.filterSource cleanSourceFilter src; + }; in runCommand "iohk-ops-shellcheck" { buildInputs = [ shellcheck ]; } '' EXIT_STATUS=0 diff --git a/scripts/test/stylish.nix b/scripts/test/stylish.nix index 4f5dcfed518..533b5c7ab2c 100644 --- a/scripts/test/stylish.nix +++ b/scripts/test/stylish.nix @@ -1,13 +1,16 @@ { runCommand, stylish-haskell, src, lib, git }: let - cleanSourceFilter = with lib; + # just haskell sources and the stylish-haskell config file + src' = lib.cleanSourceWith { + inherit src; + filter = with lib; name: type: let baseName = baseNameOf (toString name); in ( (type == "regular" && hasSuffix ".hs" baseName) || (type == "regular" && hasSuffix ".yaml" baseName) || (type == "directory") ); - src' = builtins.filterSource cleanSourceFilter src; + }; in runCommand "cardano-stylish-check" { succeedOnFailure = true; buildInputs = [ stylish-haskell git ]; } '' set +e @@ -16,7 +19,7 @@ runCommand "cardano-stylish-check" { succeedOnFailure = true; buildInputs = [ st cd tmp-cardano git init git add -A - find . -type f -name "*hs" -not -path '.git' -not -path '*.stack-work*' -not -name 'HLint.hs' -exec stylish-haskell -i {} \; + find . -type f -name "*hs" -not -name 'HLint.hs' -exec stylish-haskell -i {} \; git diff --exit-code EXIT_CODE=$? if [[ $EXIT_CODE != 0 ]]