From efb745854ac8d25a21ca63d4bcc0cedaf2652c14 Mon Sep 17 00:00:00 2001 From: Gabriel Gonzalez Date: Fri, 11 Sep 2020 18:11:01 -0700 Subject: [PATCH] Fix CI to check that generation script has run (#145) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … based on the discussion in #138 CI wasn't checking that the `./scripts/generate.sh` script had been run, which this change fixes --- nix/nixpkgs.nix | 35 ++++++++++++++++++++++++++++++----- release.nix | 4 +++- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix index e254bb1a..77defb99 100644 --- a/nix/nixpkgs.nix +++ b/nix/nixpkgs.nix @@ -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="."; } '' @@ -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 diff --git a/release.nix b/release.nix index 1a736a52..fb5ba207 100644 --- a/release.nix +++ b/release.nix @@ -12,7 +12,9 @@ let # master in). rev = pkgs.runCommand "rev" {} ''echo "${src.rev}" > $out''; } // builtins.removeAttrs pkgs.dhall-kubernetes - [ "override" "overrideDerivation" ]; + [ "override" "overrideDerivation" ] + // builtins.removeAttrs pkgs.dhall-kubernetes-tests + [ "override-test" "overrideDerivation-test" ]; dhall-kubernetes = pkgs.releaseTools.aggregate { name = "dhall-kubernetes-aggregate";