ghcup-hs/.github/scripts/hls.sh

73 lines
1.7 KiB
Bash
Raw Normal View History

2022-10-20 12:37:50 +00:00
#!/usr/bin/env bash
set -eux
2022-11-22 11:41:44 +00:00
. .github/scripts/common.sh
2022-10-20 12:37:50 +00:00
mkdir -p "$CI_PROJECT_DIR"/.local/bin
### build
if [ "${OS}" = "Windows" ] ; then
GHCUP_DIR="${GHCUP_INSTALL_BASE_PREFIX}"/ghcup
else
GHCUP_DIR="${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup
fi
rm -rf "${GHCUP_DIR}"
mkdir -p "${GHCUP_BIN}"
ls -lah out
find out
cp "out/${ARTIFACT}"-* "$GHCUP_BIN/ghcup${ext}"
chmod +x "$GHCUP_BIN/ghcup${ext}"
echo "$PATH"
"$GHCUP_BIN/ghcup${ext}" --version
eghcup --version
sha_sum "$GHCUP_BIN/ghcup${ext}"
sha_sum "$(raw_eghcup --offline whereis ghcup)"
2022-11-22 11:41:44 +00:00
git_describe
2022-10-20 12:37:50 +00:00
eghcup install ghc "${GHC_VERSION}"
2023-01-14 13:00:32 +00:00
eghcup install cabal "${CABAL_VERSION}"
2022-10-20 12:37:50 +00:00
ecabal update
2022-11-22 11:41:44 +00:00
if ! command -v cabal-cache ; then
download_cabal_cache "$HOME/.local/bin/cabal-cache"
fi
if ! cabal-cache version ; then
build_cabal_cache "$HOME/.local/bin"
fi
2022-10-20 12:37:50 +00:00
2022-11-22 11:41:44 +00:00
eghcup debug-info
2022-10-20 12:37:50 +00:00
2022-11-22 11:41:44 +00:00
(
cd /tmp
git clone --depth 1 --branch "${HLS_TARGET_VERSION}" \
https://github.com/haskell/haskell-language-server.git \
"haskell-language-server-${HLS_TARGET_VERSION}"
cd "haskell-language-server-${HLS_TARGET_VERSION}/"
ecabal configure -w "ghc-${GHC_VERSION}" --disable-profiling --disable-tests --jobs="$(nproc)"
ecabal build --dependencies-only -w "ghc-${GHC_VERSION}" --disable-profiling --disable-tests --jobs="$(nproc)" --dry-run
2023-01-14 13:00:32 +00:00
sync_from
2022-11-22 11:41:44 +00:00
ecabal build --dependencies-only -w "ghc-${GHC_VERSION}" --disable-profiling --disable-tests --jobs="$(nproc)" || sync_to
2023-01-14 13:00:32 +00:00
sync_to
2022-11-22 11:41:44 +00:00
)
eghcup -v compile hls -j "$(nproc)" -g "${HLS_TARGET_VERSION}" --ghc "${GHC_VERSION}"
[ "$($(eghcup whereis hls "${HLS_TARGET_VERSION}") --numeric-version)" = "${HLS_TARGET_VERSION}" ] ||
[ "$($(eghcup whereis hls "${HLS_TARGET_VERSION}") --numeric-version | sed 's/.0$//')" = "${HLS_TARGET_VERSION}" ]
2022-10-20 12:37:50 +00:00
# nuke
eghcup nuke
[ ! -e "${GHCUP_DIR}" ]