Files
runner-images/images/linux/scripts/installers/haskell.sh
Vladimir Safonkin 82b4e13fb0 [Ubuntu] Move Haskell tests to separate file. (#2348)
* Move Haskell tests to separate file

* Minor fix
2020-12-25 12:36:01 +03:00

41 lines
1.6 KiB
Bash

#!/bin/bash -e
################################################################################
## File: haskell.sh
## Desc: Installs Haskell
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/invoke-tests.sh
# Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu.
# https://launchpad.net/~hvr/+archive/ubuntu/ghc
apt-get install -y software-properties-common
add-apt-repository -y ppa:hvr/ghc
apt-get update
# Get 3 latest Haskell Major.Minor versions
allGhcVersions=$(apt-cache search "^ghc-" | grep -Po '(\d*\.){2}\d*' | sort --unique --version-sort)
ghcMajorMinorVersions=$(echo "$allGhcVersions" | cut -d "." -f 1,2 | sort --unique --version-sort | tail -3)
for version in $ghcMajorMinorVersions; do
# Get latest patch version for given Major.Minor one (ex. 8.6.5 for 8.6) and install it
exactVersion=$(echo "$allGhcVersions" | grep $version | sort --unique --version-sort | tail -1)
apt-get install -y ghc-$exactVersion
ghcInstalledVersions+=("$exactVersion")
defaultGHCVersion=$exactVersion
done
# Get latest cabal version
cabalVersion=$(apt-cache search cabal-install-[0-9] | grep -Po '\d*\.\d*' | sort --unique --version-sort | tail -1)
apt-get install -y cabal-install-$cabalVersion
# Install the latest stable release of haskell stack
curl -sSL https://get.haskellstack.org/ | sh
# Create symlink for ghc and cabal in /usr/bin
ln -s "/opt/ghc/$defaultGHCVersion/bin/ghc" "/usr/bin/ghc"
ln -s "/opt/cabal/$cabalVersion/bin/cabal" "/usr/bin/cabal"
invoke_tests "Haskell"