[commit: ghc] wip/test-hadrian-caching: Clear hadrian cache if hadrian executable changed (eb9944b)

git at git.haskell.org git at git.haskell.org
Thu Feb 21 15:13:09 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/test-hadrian-caching
Link       : http://ghc.haskell.org/trac/ghc/changeset/eb9944b8b4136096f284bfd6b1192c114e129e17/ghc

>---------------------------------------------------------------

commit eb9944b8b4136096f284bfd6b1192c114e129e17
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Wed Feb 20 21:05:44 2019 -0500

    Clear hadrian cache if hadrian executable changed


>---------------------------------------------------------------

eb9944b8b4136096f284bfd6b1192c114e129e17
 .gitlab-ci.yml                 |  9 +++++++--
 .gitlab/clear-hadrian-cache.sh | 19 +++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9a0d93f..306966d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -60,10 +60,14 @@ ghc-linters:
     - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
     - ./boot
     - ./configure $CONFIGURE_ARGS
+
+    # Clear cache if Hadrian itself has changed
+    - bash .gitlab/clear-hadrian-cache.sh
+
     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --shared=_cache
     - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` docs-haddock
-      # Make sure that caching works properly: _build should be recreated from
-      # the _cache if deleted
+    # Make sure that caching works properly: _build should be recreated from
+    # the _cache if deleted
     - |
       rm -R ./_build
       hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --shared=_cache
@@ -71,6 +75,7 @@ ghc-linters:
     key: hadrian
     paths:
       - _cache
+      - hadrian.sha256
       - cabal-cache
 
 validate-x86_64-linux-deb8-hadrian:
diff --git a/.gitlab/clear-hadrian-cache.sh b/.gitlab/clear-hadrian-cache.sh
new file mode 100644
index 0000000..77f36d8
--- /dev/null
+++ b/.gitlab/clear-hadrian-cache.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/bash
+
+set -e
+
+# Build hadrian
+cd hadrian
+cabal new-build hadrian
+cd ..
+hadrian=$(find hadrian/dist-newstyle -iname hadrian -executable -type f)
+
+# Did the executable change?
+touch hadrian.sha256
+sha256 $hadrian > hadrian.sha256.new
+if diff -q hadrian.sha256 hadrian.sha256.new; then
+    echo "Hadrian has changed. Deleting cache... "
+    mv hadrian.sha256.new hadrian.sha256
+    rm -R _cache
+fi
+



More information about the ghc-commits mailing list