Skip to content

Commit

Permalink
Fix CI to check that generation script has run
Browse files Browse the repository at this point in the history
… based on the discussion in #138

CI wasn't checking that the `./scripts/generate.sh` script had been
run, which this change fixes
  • Loading branch information
Gabriella439 committed Sep 11, 2020
1 parent ad3369f commit ad5778c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
40 changes: 35 additions & 5 deletions nix/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ let
in
''echo './${inputFile} → ./${outputFile}'
${pkgsNew.dhall-json}/bin/dhall-to-yaml --file $out/${inputFile} > $out/${outputFile}
'';
'';

in
pkgsNew.runCommand "package-${drv.name}" { XDG_CACHE_HOME="."; } ''
Expand All @@ -106,15 +106,40 @@ let
outputFile = "README.md";
in
pkgsNew.lib.optionalString (version == preferredVersion)
''echo './${inputFile} → ./${outputFile}'
${pkgsNew.dhall}/bin/dhall text --file $out/${inputFile} | ${pkgsNew.gnused}/bin/sed 's_\.\./package.dhall_https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall_g' > $out/${outputFile}
''
if (version == preferredVersion)
then
''echo './${inputFile} → ./${outputFile}'
${pkgsNew.dhall}/bin/dhall text --file $out/${inputFile} | ${pkgsNew.gnused}/bin/sed 's_\.\./package.dhall_https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall_g' > $out/${outputFile}
''
else
''
${pkgsNew.coreutils}/bin/rm --recursive $out/examples
''
}
${pkgsNew.coreutils}/bin/rm --recursive $out/docs
'';

dhall-kubernetes = pkgsNew.callPackage ./dhall-kubernetes.nix {};

dhall-kubernetes-tests =
let
process = version: derivation: {
name = "${version}-test";
value =
pkgsNew.runCommand "test-dhall-kubernetes-${version}" {} ''
${pkgsNew.rsync}/bin/rsync --archive ${derivation}/ ./${version}.expected
${pkgsNew.rsync}/bin/rsync --archive ${../. + "/${version}"}/ ./${version}.actual
${pkgsNew.diffutils}/bin/diff --recursive ./${version}.{actual,expected}
touch $out
'';
};

in
pkgsNew.lib.mapAttrs' process pkgsNew.dhall-kubernetes;

haskellPackages = pkgsOld.haskellPackages.override (old: {
overrides =
let
Expand All @@ -135,6 +160,11 @@ let
in
(import "${dhall-haskell}/default.nix").dhall-openapi;

};

in
(import "${dhall-haskell}/default.nix").dhall-openapi;

};

in
Expand Down
3 changes: 2 additions & 1 deletion release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ let
# master in).
rev = pkgs.runCommand "rev" {} ''echo "${src.rev}" > $out'';
} // builtins.removeAttrs pkgs.dhall-kubernetes
[ "override" "overrideDerivation" ];
[ "override" "overrideDerivation" ]
// pkgs.dhall-kubernetes-tests;

dhall-kubernetes = pkgs.releaseTools.aggregate {
name = "dhall-kubernetes-aggregate";
Expand Down

0 comments on commit ad5778c

Please sign in to comment.