Skip to content

Commit 2eb9ab1

Browse files
committed
Check the GHC and cabal-install version which are used to build the release
1 parent 9b0afce commit 2eb9ab1

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

.gitlab/ci.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
1419
elif [[ "$(uname)" == "Linux" ]]; then
@@ -18,6 +23,19 @@ else
1823
. "$CI_PROJECT_DIR/.gitlab/ghcup.sh"
1924
fi
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+
2139
export CABAL_DIR="$CI_PROJECT_DIR/cabal"
2240

2341
case "$(uname)" in

0 commit comments

Comments
 (0)