diff options
-rw-r--r-- | .gitlab-ci.yml | 9 | ||||
-rw-r--r-- | .gitlab/clear-hadrian-cache.sh | 19 |
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 + |