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
|
|
|
|
|
2021-05-14 21:09:45 +00:00
|
|
|
CI_PROJECT_DIR=$(pwd)
|
|
|
|
|
2020-04-15 07:45:18 +00:00
|
|
|
ecabal() {
|
2021-05-14 21:09:45 +00:00
|
|
|
cabal "$@"
|
2020-04-15 07:45:18 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 13:07:37 +00:00
|
|
|
eghcup() {
|
2021-05-14 21:09:45 +00:00
|
|
|
if [ "${OS}" = "WINDOWS" ] ; then
|
|
|
|
ghcup -v -c -s file:/$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml "$@"
|
|
|
|
else
|
|
|
|
ghcup -v -c -s file://$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml "$@"
|
|
|
|
fi
|
2020-04-15 13:07:37 +00:00
|
|
|
}
|
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-09-13 19:13:42 +00:00
|
|
|
ecabal test -w ghc-${GHC_VERSION} -ftui ghcup-test
|
2021-06-06 08:42:16 +00:00
|
|
|
ecabal haddock -w ghc-${GHC_VERSION} -ftui
|
2020-08-11 10:12:15 +00:00
|
|
|
elif [ "${OS}" = "LINUX" ] ; then
|
2021-02-24 14:19:29 +00:00
|
|
|
if [ "${ARCH}" = "32" ] ; then
|
2020-08-11 10:12:15 +00:00
|
|
|
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui -ftar
|
2020-09-13 19:13:42 +00:00
|
|
|
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui -ftar ghcup-test
|
2021-06-06 08:42:16 +00:00
|
|
|
ecabal haddock -w ghc-${GHC_VERSION} -finternal-downloader -ftui -ftar
|
2020-08-11 10:12:15 +00:00
|
|
|
else
|
|
|
|
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
2020-09-13 19:13:42 +00:00
|
|
|
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui ghcup-test
|
2021-06-06 08:42:16 +00:00
|
|
|
ecabal haddock -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
2020-08-11 10:12:15 +00:00
|
|
|
fi
|
2021-06-06 08:42:16 +00:00
|
|
|
elif [ "${OS}" = "FREEBSD" ] ; then
|
|
|
|
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui --constraint="zip +disable-zstd"
|
|
|
|
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui --constraint="zip +disable-zstd" ghcup-test
|
|
|
|
ecabal haddock -w ghc-${GHC_VERSION} -finternal-downloader -ftui --constraint="zip +disable-zstd"
|
2021-05-14 21:09:45 +00:00
|
|
|
elif [ "${OS}" = "WINDOWS" ] ; then
|
|
|
|
ecabal build -w ghc-${GHC_VERSION}
|
|
|
|
ecabal test -w ghc-${GHC_VERSION} ghcup-test
|
2021-06-06 08:42:16 +00:00
|
|
|
ecabal haddock -w ghc-${GHC_VERSION}
|
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-09-13 19:13:42 +00:00
|
|
|
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui ghcup-test
|
2021-06-06 08:42:16 +00:00
|
|
|
ecabal haddock -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
2020-04-15 07:45:18 +00:00
|
|
|
fi
|
|
|
|
|
2020-07-21 23:11:37 +00:00
|
|
|
|
2021-06-13 12:43:00 +00:00
|
|
|
if [ "${OS}" = "WINDOWS" ] ; then
|
|
|
|
ext=".exe"
|
|
|
|
else
|
|
|
|
ext=''
|
|
|
|
fi
|
|
|
|
cp "$(ecabal new-exec -w ghc-${GHC_VERSION} --verbose=0 --offline sh -- -c 'command -v ghcup')" "$CI_PROJECT_DIR"/.local/bin/ghcup${ext}
|
|
|
|
cp "$(ecabal new-exec -w ghc-${GHC_VERSION} --verbose=0 --offline sh -- -c 'command -v ghcup-gen')" "$CI_PROJECT_DIR"/.local/bin/ghcup-gen${ext}
|
2020-04-18 19:16:03 +00:00
|
|
|
|
|
|
|
### cleanup
|
|
|
|
|
2021-06-09 17:45:23 +00:00
|
|
|
if [ "${OS}" = "WINDOWS" ] ; then
|
|
|
|
rm -rf "${GHCUP_INSTALL_BASE_PREFIX}"/ghcup
|
|
|
|
else
|
|
|
|
rm -rf "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup
|
|
|
|
fi
|
2020-04-15 07:45:18 +00:00
|
|
|
|
2020-04-18 19:16:03 +00:00
|
|
|
### manual cli based testing
|
|
|
|
|
|
|
|
|
2020-08-09 15:39:02 +00:00
|
|
|
ghcup-gen check -f ghcup-${JSON_VERSION}.yaml
|
2020-04-15 07:45:18 +00:00
|
|
|
|
2020-04-18 15:29:44 +00:00
|
|
|
eghcup --numeric-version
|
2020-04-15 07:45:18 +00:00
|
|
|
|
2021-07-15 20:40:45 +00:00
|
|
|
eghcup install ghc ${GHC_VERSION}
|
2021-07-12 13:40:42 +00:00
|
|
|
[ `$(eghcup whereis ghc ${GHC_VERSION}) --numeric-version` = "${GHC_VERSION}" ]
|
2021-07-15 20:40:45 +00:00
|
|
|
eghcup set ghc ${GHC_VERSION}
|
|
|
|
eghcup install cabal ${CABAL_VERSION}
|
2021-07-12 13:40:42 +00:00
|
|
|
[ `$(eghcup whereis cabal ${CABAL_VERSION}) --numeric-version` = "${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
|
2021-06-09 17:45:23 +00:00
|
|
|
ghc-${ghc_ver} --version
|
|
|
|
if [ "${OS}" != "WINDOWS" ] ; then
|
|
|
|
ghci --version
|
|
|
|
ghci-${ghc_ver} --version
|
|
|
|
fi
|
2020-04-15 07:45:18 +00:00
|
|
|
|
2020-04-16 06:24:21 +00:00
|
|
|
|
2021-06-15 12:00:30 +00:00
|
|
|
if [ "${OS}" = "DARWIN" ] && [ "${ARCH}" = "ARM64" ] ; then
|
|
|
|
echo
|
|
|
|
else
|
|
|
|
# test installing new ghc doesn't mess with currently set GHC
|
|
|
|
# https://gitlab.haskell.org/haskell/ghcup-hs/issues/7
|
|
|
|
if [ "${OS}" = "LINUX" ] ; then
|
2021-07-19 14:49:18 +00:00
|
|
|
eghcup --downloader=wget prefetch ghc 8.10.3
|
|
|
|
eghcup --offline install ghc 8.10.3
|
2021-06-15 12:00:30 +00:00
|
|
|
else # test wget a bit
|
2021-07-19 14:49:18 +00:00
|
|
|
eghcup prefetch ghc 8.10.3
|
|
|
|
eghcup --offline install ghc 8.10.3
|
2021-06-15 12:00:30 +00:00
|
|
|
fi
|
|
|
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
2021-07-19 14:49:18 +00:00
|
|
|
eghcup --offline set 8.10.3
|
2021-06-15 12:00:30 +00:00
|
|
|
eghcup set 8.10.3
|
|
|
|
[ "$(ghc --numeric-version)" = "8.10.3" ]
|
|
|
|
eghcup set ${GHC_VERSION}
|
|
|
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
2021-07-19 14:49:18 +00:00
|
|
|
eghcup --offline rm 8.10.3
|
2021-06-15 12:00:30 +00:00
|
|
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
|
|
|
|
|
|
|
if [ "${OS}" = "DARWIN" ] ; then
|
2020-09-20 15:57:16 +00:00
|
|
|
eghcup install hls
|
2021-07-12 13:40:42 +00:00
|
|
|
$(eghcup whereis hls) --version
|
2021-05-14 22:31:36 +00:00
|
|
|
|
|
|
|
eghcup install stack
|
2021-07-12 13:40:42 +00:00
|
|
|
$(eghcup whereis stack) --version
|
2021-06-15 12:00:30 +00:00
|
|
|
elif [ "${OS}" = "LINUX" ] ; then
|
|
|
|
if [ "${ARCH}" = "64" ] ; then
|
|
|
|
eghcup install hls
|
|
|
|
haskell-language-server-wrapper --version
|
|
|
|
|
|
|
|
eghcup install stack
|
|
|
|
stack --version
|
|
|
|
fi
|
2020-09-20 15:57:16 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-07-15 11:32:48 +00:00
|
|
|
# check that lazy loading works for 'whereis'
|
|
|
|
cp "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml" "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml.bak"
|
|
|
|
echo '**' > "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml"
|
|
|
|
eghcup whereis ghc $(ghc --numeric-version)
|
|
|
|
mv -f "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml.bak" "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml"
|
2020-09-20 15:57:16 +00:00
|
|
|
|
2020-04-15 13:36:03 +00:00
|
|
|
eghcup rm $(ghc --numeric-version)
|
|
|
|
|
2021-03-07 10:59:45 +00:00
|
|
|
# https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/116
|
2021-05-14 21:09:45 +00:00
|
|
|
if [ "${OS}" = "LINUX" ] ; then
|
|
|
|
if [ "${ARCH}" = "64" ] ; then
|
|
|
|
eghcup install cabal -u https://oleg.fi/cabal-install-3.4.0.0-rc4/cabal-install-3.4.0.0-x86_64-ubuntu-16.04.tar.xz 3.4.0.0-rc4
|
|
|
|
eghcup rm cabal 3.4.0.0-rc4
|
|
|
|
fi
|
|
|
|
fi
|
2021-03-07 10:59:45 +00:00
|
|
|
|
2021-07-15 11:32:48 +00:00
|
|
|
|
2020-04-15 13:07:37 +00:00
|
|
|
eghcup upgrade
|
|
|
|
eghcup upgrade -f
|
2020-04-15 07:45:18 +00:00
|
|
|
|
2021-06-15 12:00:30 +00:00
|
|
|
|
|
|
|
# nuke
|
|
|
|
eghcup nuke
|
|
|
|
if [ "${OS}" = "WINDOWS" ] ; then
|
|
|
|
[ ! -e "${GHCUP_INSTALL_BASE_PREFIX}/ghcup" ]
|
|
|
|
else
|
|
|
|
[ ! -e "${GHCUP_INSTALL_BASE_PREFIX}/.ghcup" ]
|
|
|
|
fi
|