summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-09-03 21:31:32 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-09 18:31:40 -0400
commit5aae5b325ccef857800f1840665a0e1b152e9b88 (patch)
tree81e00f6fbe87e2c7a69be5084376d29e767a492e /.gitlab
parent7911d0d983a68eb0d54d7c1ba51326d6be737aae (diff)
downloadhaskell-5aae5b325ccef857800f1840665a0e1b152e9b88.tar.gz
gitlab-ci: Bump Docker images
We now generate our Docker images via Dhall definitions, as described in ghc/ci-images!52. Additionally, we are far more careful about where tools come from, using the ALEX, HAPPY, HSCOLOR, and GHC environment variables (set in the Dockerfiles) to find bootstrapping tools.
Diffstat (limited to '.gitlab')
-rwxr-xr-x.gitlab/ci.sh42
1 files changed, 25 insertions, 17 deletions
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh
index 5a42709c24..4b37a00b83 100755
--- a/.gitlab/ci.sh
+++ b/.gitlab/ci.sh
@@ -152,22 +152,26 @@ function show_tool() {
function set_toolchain_paths() {
needs_toolchain=1
case "$(uname)" in
- Linux) needs_toolchain="" ;;
+ Linux) needs_toolchain="0" ;;
*) ;;
esac
- if [[ -n "$needs_toolchain" ]]; then
+ if [[ "$needs_toolchain" = 1 ]]; then
# These are populated by setup_toolchain
GHC="$toolchain/bin/ghc$exe"
CABAL="$toolchain/bin/cabal$exe"
HAPPY="$toolchain/bin/happy$exe"
ALEX="$toolchain/bin/alex$exe"
else
- GHC="$(which ghc)"
- CABAL="/usr/local/bin/cabal"
- HAPPY="$HOME/.cabal/bin/happy"
- ALEX="$HOME/.cabal/bin/alex"
+ # These are generally set by the Docker image but
+ # we provide these handy fallbacks in case the
+ # script isn't run from within a GHC CI docker image.
+ if [ -z "$GHC" ]; then GHC="$(which ghc)"; fi
+ if [ -z "$CABAL" ]; then GHC="$(which cabal)"; fi
+ if [ -z "$HAPPY" ]; then GHC="$(which happy)"; fi
+ if [ -z "$ALEX" ]; then GHC="$(which alex)"; fi
fi
+
export GHC
export CABAL
export HAPPY
@@ -204,12 +208,12 @@ function setup() {
}
function fetch_ghc() {
- local v="$GHC_VERSION"
- if [[ -z "$v" ]]; then
- fail "GHC_VERSION is not set"
- fi
-
if [ ! -e "$GHC" ]; then
+ local v="$GHC_VERSION"
+ if [[ -z "$v" ]]; then
+ fail "neither GHC nor GHC_VERSION are not set"
+ fi
+
start_section "fetch GHC"
url="https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-${boot_triple}.tar.xz"
info "Fetching GHC binary distribution from $url..."
@@ -233,12 +237,12 @@ function fetch_ghc() {
}
function fetch_cabal() {
- local v="$CABAL_INSTALL_VERSION"
- if [[ -z "$v" ]]; then
- fail "CABAL_INSTALL_VERSION is not set"
- fi
-
if [ ! -e "$CABAL" ]; then
+ local v="$CABAL_INSTALL_VERSION"
+ if [[ -z "$v" ]]; then
+ fail "neither CABAL nor CABAL_INSTALL_VERSION are not set"
+ fi
+
start_section "fetch GHC"
case "$(uname)" in
# N.B. Windows uses zip whereas all others use .tar.xz
@@ -279,7 +283,11 @@ function fetch_cabal() {
function setup_toolchain() {
fetch_ghc
fetch_cabal
- cabal_install="$CABAL v2-install --index-state=$hackage_index_state --installdir=$toolchain/bin"
+
+ cabal_install="$CABAL v2-install \
+ --with-compiler=$GHC \
+ --index-state=$hackage_index_state --installdir=$toolchain/bin"
+
# Avoid symlinks on Windows
case "$(uname)" in
MSYS_*|MINGW*) cabal_install="$cabal_install --install-method=copy" ;;