Commit 2f65d0a6 authored by Ben Gamari's avatar Ben Gamari 🐢

Merge branch 'test-all' into 'master'

Test all packages with patches

See merge request !5
parents f18a9015 4e4093f7
Pipeline #8361 passed with stages
in 87 minutes and 38 seconds
......@@ -22,8 +22,8 @@ variables:
# Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: 6d19c3adc1f5c28c82aed8c5b1ac40931ac60f3f
# A default for testing
GHC_TARBALL: "https://gitlab.haskell.org/ghc/ghc/-/jobs/111365/artifacts/raw/ghc-x86_64-fedora27-linux.tar.xz"
# Default GHC bindist
GHC_TARBALL: "https://gitlab.haskell.org/api/v4/projects/1/jobs/artifacts/master/raw/ghc-x86_64-fedora27-linux.tar.xz?job=validate-x86_64-linux-fedora27"
# Project ID of ghc/ghc
GHC_PROJECT_ID: "1"
......@@ -80,7 +80,7 @@ build:
-A testedPackages
--keep-going
--arg bindistTarball $GHC_TARBALL
|| (echo "Build failed!"; ret=1)
|| { echo "Build failed!"; ret=1; }
- scripts/summarize.py || echo "summarize script failed"
- exit $ret
......
......@@ -8,11 +8,12 @@
# nix build -f --arg ghc "(import build.nix {ghc-path=$GHC_TREE;})"
#
let
rev = "e0818a15305561ea1ebe36203d914465fd71453d";
# To update nixpkgs bump rev and baseNixpkgs's sha256.
rev = "2f746bc1fcdc24b103bda3a27ed82c23200cc077";
baseNixpkgs =
fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
sha256 = "017j741anrl66nndfmblp6xc1lz7783dh8lf19srmxnk5xk4wn7l";
sha256 = "142yl6xakkwmyy8x32h94fci4x09l0yqppq5hwj19a3nmd0zmsjx";
};
in
......
diff -ru streaming-0.2.2.0.orig/src/Streaming/Internal.hs streaming-0.2.2.0/src/Streaming/Internal.hs
--- streaming-0.2.2.0.orig/src/Streaming/Internal.hs 1969-12-31 19:00:00.000000000 -0500
+++ streaming-0.2.2.0/src/Streaming/Internal.hs 2019-05-02 15:48:52.108061100 -0400
@@ -91,6 +91,7 @@
commit 93324cf750bc289bb1cb8c1f0087367a8510c23d
Author: Ben Gamari <ben@smart-cactus.org>
Date: Mon Jul 15 13:34:47 2019 -0400
Adjust for base 4.13 MonadFail changes.
Adds a MonadFail instance for Stream as well
as removing fail from the Monad instance under
base 4.13.
diff --git a/changelog.md b/changelog.md
index 666ee3a..dac7930 100644
--- a/changelog.md
+++ b/changelog.md
@@ -19,6 +19,10 @@
Generalise type signature of `toList_`.
+ Compatibility with base 4.13.
+
+ Provide a MonadFail instance for Stream.
+
- 0.2.1.0
Adding `Semigroup` instances for GHC 8.4.
diff --git a/src/Streaming/Internal.hs b/src/Streaming/Internal.hs
index a789f68..cd6f7b4 100644
--- a/src/Streaming/Internal.hs
+++ b/src/Streaming/Internal.hs
@@ -91,6 +91,7 @@ import Control.Monad.Trans
import Control.Monad.Reader.Class
import Control.Monad.State.Class
import Control.Monad.Error.Class
+import qualified Control.Monad.Fail as Fail
+import Control.Monad.Fail as Fail
import Control.Applicative
import Data.Function ( on )
import Control.Monad.Morph
@@ -244,9 +245,14 @@
@@ -244,9 +245,14 @@ instance (Functor f, Monad m) => Monad (Stream f m) where
Return r -> f r
{-# INLINABLE (>>=) #-}
- fail = lift . fail
- {-#INLINE fail #-}
+#if !(MIN_VERSION_base(4,13,0))
fail = lift . fail
{-#INLINE fail #-}
+ fail = lift . Prelude.fail
+ {-# INLINE fail #-}
+#endif
+instance (Functor f, MonadFail m) => MonadFail (Stream f m) where
......@@ -24,3 +52,17 @@ diff -ru streaming-0.2.2.0.orig/src/Streaming/Internal.hs streaming-0.2.2.0/src/
-- _bind
-- :: (Functor f, Monad m)
diff --git a/streaming.cabal b/streaming.cabal
index cfc3a13..a1d0433 100644
--- a/streaming.cabal
+++ b/streaming.cabal
@@ -222,5 +222,9 @@ library
, transformers-base < 0.5
, ghc-prim
, containers
+
+ if !impl(ghc >= 8.0)
+ build-depends: fail == 4.9.*
+
hs-source-dirs: src
default-language: Haskell2010
......@@ -12,10 +12,10 @@ let
# GHC from the given bindist.
ghc =
let
commit = "633c6d7553d0f2c91245bcf47ae539cfdb7aaa13";
commit = "027df18eb894ef622f67b2f487a851dc534403e3";
src = fetchTarball {
url = "https://github.com/bgamari/ghc-artefact-nix/archive/${commit}.tar.gz";
sha256 = "0yl7dk8drb92ipgph1mxx8my4gy9py27m749zw6ah6np4gvdp9sx";
sha256 = "0ijdpqsg8b7hz89hpgmpzfvg70y6yfq4wrqgngvqlfri5hy9fmg3";
};
in nixpkgs.callPackage "${src}/artifact.nix" {} {
ncursesVersion = "6";
......@@ -34,6 +34,7 @@ let
enableLibraryProfiling = false;
enableExecutableProfiling = false;
hyperlinkSource = false;
broken = false;
configureFlags = (drv.configureFlags or []) ++ [
"--ghc-options=-ddump-timings"
"--ghc-options=\"${extraHcOpts}\""
......@@ -58,19 +59,39 @@ let
inputs = lib.concatLists (lib.filter lib.isList (builtins.split re drv));
in map import inputs;
# All Haskell packages built with the HEAD compiler.
haskellPackages = nixpkgs.haskellPackages;
# The packages which we are here to test
testedPackages = with nixpkgs.haskell.lib; with nixpkgs.haskellPackages; {
inherit lens aeson criterion scotty;
testedPackages = with nixpkgs.haskell.lib; with haskellPackages; {
inherit lens aeson criterion scotty generic-lens;
# servant: Don't distribute Sphinx documentation
servant = overrideCabal servant { postInstall = ""; };
# singletons: Disable testsuite since it often breaks due to spurious
# TH-pretty-printing changes
singletons = dontCheck singletons;
};
} // patchedPackages;
# All of the packages which we have patches for.
patchedPackages =
let
toPackageAttr = patchFile: _type:
let
parts = builtins.match "([a-zA-Z0-9-]+)-.*" patchFile;
pkgName = builtins.elemAt parts 0;
in lib.nameValuePair pkgName haskellPackages."${pkgName}";
brokenPackages = [
# vty isn't applied to its terminfo argument for some reason and I
# can't convinced vty.override to apply it.
"vty"
];
in builtins.removeAttrs (lib.mapAttrs' toPackageAttr (builtins.readDir ../patches)) brokenPackages;
inherit (nixpkgs) lib;
transHaskellDeps = drv:
if drv == null then [] else
let
haskellDeps = drv.passthru.getBuildInputs.haskellBuildInputs or [];
in [{
......@@ -82,9 +103,10 @@ let
version = drv.passthru.version;
}] ++ lib.concatMap transHaskellDeps haskellDeps;
# Used by the summarize.py script to get a picture of the packages built during the run.
summary = {
pkgs = lib.concatMap transHaskellDeps (lib.attrValues testedPackages);
roots = map (drv: drv.name) (lib.attrValues testedPackages);
roots = lib.concatMap (drv: if drv == null then [] else [drv.name]) (lib.attrValues testedPackages);
};
# Find Job ID of the given job name in the given pipeline
......@@ -117,8 +139,9 @@ let
'';
in {
inherit nixpkgs ghc testedPackages buildDepends;
inherit (nixpkgs) haskellPackages lib;
inherit testedPackages patchedPackages;
inherit nixpkgs ghc buildDepends;
inherit haskellPackages;
testedPackageNames = nixpkgs.lib.attrNames testedPackages;
inherit summary find-job;
}
......@@ -55,7 +55,9 @@ def export_dot(summary):
for pkg, dep in edges:
s += f' "{pkg}" -> "{dep}";\n'
for pkg in summary['pkgs']:
# Deduplicate
pkgs = {pkg['drvPath']: pkg for pkg in summary['pkgs']}
for pkg in pkgs.values():
color = 'lightblue'
if pkg['failed']:
color = 'indianred'
......@@ -67,9 +69,9 @@ def export_dot(summary):
return s
def show_failures(summary, log_excerpt=100):
failed = [pkg
failed = {pkg['drvPath']: pkg
for pkg in summary['pkgs']
if pkg['failed']]
if pkg['failed']}
if len(failed) == 0:
print('='*80)
print('No issues encountered.')
......@@ -78,33 +80,40 @@ def show_failures(summary, log_excerpt=100):
print('='*80)
print('These packages failed to build:')
print()
for pkg in failed:
for pkg in failed.values():
print(f"* {pkg['name']} ({pkg['drvPath']})")
print()
proc = subprocess.run(['nix', 'log', '--quiet', pkg['drvPath']],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
encoding='UTF-8')
if proc.returncode != 0:
print(f' Error: Failed to fetch log')
continue
print(f' ---- Last {log_excerpt} lines of log follow ----')
lines = proc.stdout.split('\n')
if len(lines) > log_excerpt:
print(' ⋮')
print('\n '.join(lines[-log_excerpt:]))
print(' ---- End of log ----------------------------')
print()
print()
if log_excerpt is not None:
print()
proc = subprocess.run(['nix', 'log', '--quiet', pkg['drvPath']],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
encoding='UTF-8')
if proc.returncode != 0:
print(f' Error: Failed to fetch log')
continue
print(f' ---- Last {log_excerpt} lines of log follow ----')
lines = proc.stdout.split('\n')
if len(lines) > log_excerpt:
print(' ⋮')
print('\n '.join(lines[-log_excerpt:]))
print(' ---- End of log ----------------------------')
print()
print()
print('='*80)
if __name__ == "__main__":
assert os.environ['GHC_TARBALL'] != None
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--no-logs', action='store_true', help="Don't export logs (useful when logs are unavailable as nix remote builds were used)")
args = parser.parse_args()
summary = read_summary()
export_logs(summary)
if not args.no_logs:
export_logs(summary)
json.dump(summary, Path('summary.json').open('w'))
show_failures(summary)
show_failures(summary, log_excerpt=None if args.no_logs else 100)
Path('summary.dot').write_text(export_dot(summary))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment