Skip to content

Commit

Permalink
Add hlint ci check
Browse files Browse the repository at this point in the history
  • Loading branch information
jbgi authored and Jimbo4350 committed Aug 11, 2020
1 parent e97b644 commit cd24803
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 14 deletions.
5 changes: 5 additions & 0 deletions default.nix
Expand Up @@ -73,6 +73,11 @@ let
checks = recurseIntoAttrs {
# `checks.tests` collect results of executing the tests:
tests = collectChecks haskellPackages;

hlint = callPackage iohkNix.tests.hlint {
src = ./. ;
projects = attrNames (selectProjectPackages cardanoNodeHaskellPackages);
};
};

shell = import ./shell.nix {
Expand Down
11 changes: 2 additions & 9 deletions nix/haskell.nix
Expand Up @@ -6,11 +6,10 @@
, stdenv
, haskell-nix
, buildPackages
, config ? {}
# GHC attribute name
, compiler ? config.haskellNix.compiler or "ghc865"
, compiler
# Enable profiling
, profiling ? config.haskellNix.profiling or false
, profiling ? false
# Enable asserts for given packages
, assertedPackages ? []
# Version info, to be passed when not building from a git work tree
Expand Down Expand Up @@ -39,12 +38,6 @@ let
} // {
inherit src;
compiler-nix-name = compiler;
#ghc = buildPackages.haskell-nix.compiler.${compiler};
pkg-def-extras = lib.optional stdenv.hostPlatform.isLinux (hackage: {
packages = {
"systemd" = (((hackage.systemd)."2.2.0").revisions).default;
};
});
modules = [
{ compiler.nix-name = compiler; }
# Allow reinstallation of Win32
Expand Down
16 changes: 13 additions & 3 deletions nix/pkgs.nix
@@ -1,7 +1,10 @@
# our packages overlay
pkgs: _: with pkgs; {
pkgs: _: with pkgs;
let
compiler = config.haskellNix.compiler or "ghc865";
in {
cardanoNodeHaskellPackages = import ./haskell.nix {
inherit config
inherit compiler
pkgs
lib
stdenv
Expand All @@ -11,7 +14,7 @@ pkgs: _: with pkgs; {
;
};
cardanoNodeProfiledHaskellPackages = import ./haskell.nix {
inherit config
inherit compiler
pkgs
lib
stdenv
Expand Down Expand Up @@ -53,4 +56,11 @@ pkgs: _: with pkgs; {
mkCluster = callPackage ./supervisord-cluster;
hfcCluster = callPackage ./supervisord-cluster/hfc {};
cardanolib-py = callPackage ./cardanolib-py {};

inherit ((haskell-nix.hackage-package {
name = "hlint";
version = "3.1.6";
compiler-nix-name = compiler;
inherit (cardanoNodeHaskellPackages) index-state;
}).components.exes) hlint;
}
19 changes: 17 additions & 2 deletions release.nix
Expand Up @@ -103,16 +103,31 @@ let
map (drv: drv // { inherit packageName; }) (collectJobs' package)
) ds);

nonDefaultBuildSystems = tail supportedSystems;

# Paths of derivations to build only on the default system (ie. linux on hydra):
onlyBuildOnDefaultSystem = [ ["checks" "hlint"] ];
# Paths or prefix of paths for which cross-builds are disabled:
noCrossBuild = [ ["dockerImage"] ["shell"] ["cluster"] ]
++ onlyBuildOnDefaultSystem;

# Remove build jobs for which cross compiling does not make sense.
filterJobsCross = filterAttrs (n: _: n != "dockerImage" && n != "shell" && n != "cluster");
filterJobsCross = mapAttrsRecursiveCond (a: !(isDerivation a)) (path: value:
if (any (p: take (length p) path == p) noCrossBuild) then null
else value
);

inherit (systems.examples) mingwW64 musl64;

inherit (pkgs.commonLib) sources nixpkgs;

jobs = {
inherit dockerImageArtifact;
native = mapTestOn (__trace (__toJSON (packagePlatforms project)) (packagePlatforms project));
native =
let filteredBuilds = mapAttrsRecursiveCond (a: !(isList a)) (path: value:
if (elem path onlyBuildOnDefaultSystem) then filter (s: !(elem s nonDefaultBuildSystems)) value else value)
(packagePlatforms project);
in (mapTestOn (__trace (__toJSON filteredBuilds) filteredBuilds));
musl64 = mapTestOnCross musl64 (packagePlatformsCross (filterJobsCross project));
ifd-pins = mkPins {
inherit (sources) iohk-nix "haskell.nix";
Expand Down

0 comments on commit cd24803

Please sign in to comment.