2020-04-15 07:45:18 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
. "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup_env"
|
|
|
|
|
|
|
|
mkdir -p "$CI_PROJECT_DIR"/.local/bin
|
|
|
|
|
|
|
|
ecabal() {
|
|
|
|
cabal --store-dir="$(pwd)"/.store "$@"
|
|
|
|
}
|
|
|
|
|
2020-04-15 13:07:37 +00:00
|
|
|
eghcup() {
|
|
|
|
ghcup -v -c -s file://$(pwd)/ghcup-${JSON_VERSION}.json "$@"
|
|
|
|
}
|
2020-04-15 07:45:18 +00:00
|
|
|
|
2020-04-29 21:01:51 +00:00
|
|
|
git describe --always
|
2020-04-18 19:16:03 +00:00
|
|
|
|
|
|
|
### build
|
|
|
|
|
2020-04-15 07:45:18 +00:00
|
|
|
ecabal update
|
|
|
|
|
|
|
|
if [ "${OS}" = "DARWIN" ] ; then
|
2020-07-06 20:39:16 +00:00
|
|
|
ecabal build -w ghc-${GHC_VERSION} -ftui
|
2020-04-28 15:56:39 +00:00
|
|
|
else
|
2020-07-06 20:39:16 +00:00
|
|
|
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
2020-04-15 07:45:18 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup')" .
|
|
|
|
cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup-gen')" .
|
|
|
|
|
|
|
|
cp ./ghcup "$CI_PROJECT_DIR"/.local/bin/ghcup
|
|
|
|
cp ./ghcup-gen "$CI_PROJECT_DIR"/.local/bin/ghcup-gen
|
2020-04-18 19:16:03 +00:00
|
|
|
|
|
|
|
### cleanup
|
|
|
|
|
2020-04-15 07:45:18 +00:00
|
|
|
rm -rf "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup
|
|
|
|
|
2020-04-18 19:16:03 +00:00
|
|
|
|
|
|
|
### manual cli based testing
|
|
|
|
|
|
|
|
|
2020-04-15 07:45:18 +00:00
|
|
|
ghcup-gen check -f ghcup-${JSON_VERSION}.json
|
|
|
|
|
2020-04-18 15:29:44 +00:00
|
|
|
eghcup --numeric-version
|
2020-04-15 07:45:18 +00:00
|
|
|
|
2020-04-18 19:16:03 +00:00
|
|
|
# TODO: rm once we have tarballs
|
|
|
|
if [ "${OS}" = "FREEBSD" ] ; then
|
|
|
|
GHC_VERSION=8.6.3
|
|
|
|
CABAL_VERSION=2.4.1.0
|
|
|
|
fi
|
|
|
|
|
2020-04-15 13:07:37 +00:00
|
|
|
eghcup install ${GHC_VERSION}
|
|
|
|
eghcup set ${GHC_VERSION}
|
2020-04-18 19:16:03 +00:00
|
|
|
eghcup install-cabal ${CABAL_VERSION}
|
2020-04-15 07:45:18 +00:00
|
|
|
|
|
|
|
cabal --version
|
|
|
|
|
2020-04-15 13:07:37 +00:00
|
|
|
eghcup debug-info
|
2020-04-15 07:45:18 +00:00
|
|
|
|
2020-04-15 13:07:37 +00:00
|
|
|
eghcup list
|
|
|
|
eghcup list -t ghc
|
|
|
|
eghcup list -t cabal
|
2020-04-15 07:45:18 +00:00
|
|
|
|
2020-04-16 06:24:21 +00:00
|
|
|
ghc_ver=$(ghc --numeric-version)
|
2020-04-15 07:45:18 +00:00
|
|
|
ghc --version
|
|
|
|
ghci --version
|
|
|
|
ghc-$(ghc --numeric-version) --version
|
|
|
|
ghci-$(ghc --numeric-version) --version
|
|
|
|
|
2020-04-16 06:24:21 +00:00
|
|
|
|
|
|
|
# test installing new ghc doesn't mess with currently set GHC
|
|
|
|
# https://gitlab.haskell.org/haskell/ghcup-hs/issues/7
|
2020-04-29 18:14:38 +00:00
|
|
|
if [ "${OS}" = "LINUX" ] ; then
|
2020-04-29 17:17:59 +00:00
|
|
|
eghcup --downloader=wget install 8.4.4
|
2020-04-29 18:14:38 +00:00
|
|
|
else # test wget a bit
|
|
|
|
eghcup install 8.4.4
|
2020-04-29 17:12:58 +00:00
|
|
|
fi
|
2020-04-16 06:24:21 +00:00
|
|
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
|
|
|
eghcup set 8.4.4
|
|
|
|
eghcup set 8.4.4
|
|
|
|
[ "$(ghc --numeric-version)" = "8.4.4" ]
|
|
|
|
eghcup set ${GHC_VERSION}
|
|
|
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
|
|
|
eghcup rm 8.4.4
|
|
|
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
|
|
|
|
2020-04-15 13:36:03 +00:00
|
|
|
eghcup rm $(ghc --numeric-version)
|
|
|
|
|
2020-04-15 13:07:37 +00:00
|
|
|
eghcup upgrade
|
|
|
|
eghcup upgrade -f
|
2020-04-15 07:45:18 +00:00
|
|
|
|