Update CI script to build examples too

Lennart Spitzner 2020-09-28 10:49:24 +02:00
parent 9901a2240a
commit 7ffad18fd2
3 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,4 @@
#!/bin/bash
OUTDIR="ci-out" OUTDIR="ci-out"
SUMMARY="$OUTDIR/0-summary" SUMMARY="$OUTDIR/0-summary"
@ -16,8 +17,10 @@ function build-one {
# nix-build --no-out-link nix/all.nix -A "\"$ATTRPATH\".butcher.components.tests"\ # nix-build --no-out-link nix/all.nix -A "\"$ATTRPATH\".butcher.components.tests"\
# 2> >(tee "$OUTDIR/$ATTRPATH-2-build-test.txt" >&2) # 2> >(tee "$OUTDIR/$ATTRPATH-2-build-test.txt" >&2)
# (($? == 0)) || { echo "$ATTRPATH: build test failed" >> "$SUMMARY"; return 1; } # (($? == 0)) || { echo "$ATTRPATH: build test failed" >> "$SUMMARY"; return 1; }
OUT=$(nix-build -o "$OUTDIR/$ATTRPATH-test-result.txt" nix/all.nix -A "\"$ATTRPATH\".butcher.checks.tests"\ nix-build -o "$OUTDIR/$ATTRPATH-build" nix/all.nix -A "\"$ATTRPATH\".allComponents"\
2> >(tee "$OUTDIR/$ATTRPATH-build.txt" >&2)) 2> >(tee "$OUTDIR/$ATTRPATH-build.txt" >&2)
(($? == 0)) || { echo "$ATTRPATH: all-component build failed" >> "$SUMMARY"; return 1; }
nix-build -o "$OUTDIR/$ATTRPATH-test-result.txt" nix/all.nix -A "\"$ATTRPATH\".butcher.checks.tests"
(($? == 0)) || { echo "$ATTRPATH: run test failed" >> "$SUMMARY"; return 1; } (($? == 0)) || { echo "$ATTRPATH: run test failed" >> "$SUMMARY"; return 1; }
echo "$ATTRPATH: $(grep examples "$OUTDIR/$ATTRPATH-test-result.txt")" >> "$SUMMARY" echo "$ATTRPATH: $(grep examples "$OUTDIR/$ATTRPATH-test-result.txt")" >> "$SUMMARY"
} }

View File

@ -11,7 +11,8 @@
let let
butcher-nix = pkgs.haskell-nix.callCabalProjectToNix { butcher-nix = pkgs.haskell-nix.callCabalProjectToNix {
src = cleanedSource; src = cleanedSource;
inherit index-state index-sha256 plan-sha256 materialized configureArgs; inherit index-state index-sha256 plan-sha256 materialized;
configureArgs = configureArgs + " -fbutcher-examples";
# ghc = pkgs.haskell-nix.compiler.${ghc-ver}; # ghc = pkgs.haskell-nix.compiler.${ghc-ver};
compiler-nix-name = ghc-ver; compiler-nix-name = ghc-ver;
}; };
@ -26,12 +27,20 @@ in rec {
pkg-def-extras = pkg-def-extras; pkg-def-extras = pkg-def-extras;
modules = [ modules = [
{ ghc.package = pkgs.haskell-nix.compiler.${ghc-ver}; } { ghc.package = pkgs.haskell-nix.compiler.${ghc-ver}; }
# (pkgs.haskell-nix.mkCacheModule generatedCache)
{ packages.butcher.flags.butcher-examples = true; }
]; ];
}; };
in pkg-set.config.hsPkgs; in pkg-set.config.hsPkgs;
inherit (hsPkgs) butcher; inherit (hsPkgs) butcher;
inherit (hsPkgs.butcher) checks; inherit (hsPkgs.butcher) checks;
allComponents = pkgs.linkFarm
"allComponents"
(builtins.map
(x: { name = x.name; path = x; })
(pkgs.haskell-nix.haskellLib.getAllComponents butcher));
shell = hsPkgs.shellFor { shell = hsPkgs.shellFor {
# Include only the *local* packages of your project. # Include only the *local* packages of your project.
packages = ps: with ps; [ packages = ps: with ps; [

View File

@ -50,12 +50,20 @@ let
hsPkgs = (pkgs.haskell-nix.mkStackPkgSet { hsPkgs = (pkgs.haskell-nix.mkStackPkgSet {
stack-pkgs = butcher-plan; stack-pkgs = butcher-plan;
pkg-def-extras = pkg-def-extras; pkg-def-extras = pkg-def-extras;
modules = pkgs.lib.singleton (pkgs.haskell-nix.mkCacheModule generatedCache); modules = [ (pkgs.haskell-nix.mkCacheModule generatedCache)
{ packages.butcher.flags.butcher-examples = true; }
];
}).config.hsPkgs; }).config.hsPkgs;
in { in rec {
inherit butcher-nix butcher-plan hsPkgs pkgs; inherit butcher-nix butcher-plan hsPkgs pkgs;
inherit (hsPkgs) butcher; inherit (hsPkgs) butcher;
inherit (hsPkgs.butcher) checks; inherit (hsPkgs.butcher) checks;
allComponents = pkgs.linkFarm
"allComponents"
(builtins.map
(x: { name = x.name; path = x; })
(pkgs.haskell-nix.haskellLib.getAllComponents butcher));
shell = hsPkgs.shellFor { shell = hsPkgs.shellFor {
# Include only the *local* packages of your project. # Include only the *local* packages of your project.
packages = ps: with ps; [ packages = ps: with ps; [