summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-02-20 21:05:44 -0500
committerBen Gamari <ben@smart-cactus.org>2019-02-20 21:05:44 -0500
commiteb9944b8b4136096f284bfd6b1192c114e129e17 (patch)
tree67e14d804f54308545b59eda7316840ce91b5391
parent053af3cafac4f5a9fd64e80eb0444cebf078cb15 (diff)
downloadhaskell-wip/test-hadrian-caching.tar.gz
Clear hadrian cache if hadrian executable changedwip/test-hadrian-caching
-rw-r--r--.gitlab-ci.yml9
-rw-r--r--.gitlab/clear-hadrian-cache.sh19
2 files changed, 26 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9a0d93f3be..306966d998 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 0000000000..77f36d8b54
--- /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
+