@@ -6,9 +6,14 @@ source "$CI_PROJECT_DIR/.gitlab/common.sh"
66
77# # Figure out how to get the Haskell toolchain.
88
9- # For backport, the centos image no longer has the right GHC version, so use
10- # ghcup.
11- if [[ -f /etc/os-release && " $( grep ^ID /etc/os-release) " =~ " centos" ]]; then
9+ echo " Base image has GHC version: $( $GHC --numeric-version) "
10+
11+ # Check that GHC_VERSION and the version in the image match.
12+ if [[ " $( $GHC --numeric-version) " != " ${GHC_VERSION} " ]]; then
13+ echo " Incorrect ghc version installed, installing via ghcup. $( $GHC --numeric-version) != ${GHC_VERSION} "
14+ . " $CI_PROJECT_DIR /.gitlab/ghcup.sh"
15+ elif [[ " $( cabal --numeric-version) " != " ${CABAL_INSTALL_VERSION} " ]]; then
16+ echo " Incorrect cabal version installed, installing via ghcup. $( cabal --numeric-version) != ${CABAL_INSTALL_VERSION} "
1217 . " $CI_PROJECT_DIR /.gitlab/ghcup.sh"
1318# All the other ones are fine.
1419elif [[ " $( uname) " == " Linux" ]]; then
1823 . " $CI_PROJECT_DIR /.gitlab/ghcup.sh"
1924fi
2025
26+
27+ if [[ " $( ghc --numeric-version) " != " ${GHC_VERSION} " ]]; then
28+ fail " Failed to install GHC version (actual: $( ghc --numeric-version) , expected: ${GHC_VERSION} " ;
29+ fi
30+
31+ if [[ " $( cabal --numeric-version) " != " ${CABAL_INSTALL_VERSION} " ]]; then
32+ fail " Failed to install GHC version (actual: $( ghc --numeric-version) , expected: ${GHC_VERSION} " ;
33+ fi
34+
35+ echo " Using GHC version: $( ghc --numeric-version) " ;
36+ echo " Using cabal-install version: $( cabal --numeric-version) " ;
37+
38+
2139export CABAL_DIR=" $CI_PROJECT_DIR /cabal"
2240
2341case " $( uname) " in
0 commit comments