ghcup-hs/.github/scripts/cabal-cache.sh

44 lines
683 B
Bash
Raw Normal View History

2022-12-20 08:49:16 +00:00
#!/bin/sh
set -eux
. .github/scripts/prereq.sh
. .github/scripts/common.sh
# ensure ghcup
if ! command -v ghcup ; then
install_ghcup
fi
2022-12-20 12:49:10 +00:00
if [ "${RUNNER_OS}" = "macOS" ] ; then
rm -rf "${CABAL_DIR}"/store/*
fi
2022-12-20 08:49:16 +00:00
# ensure ghc
ghcup install ghc --set 8.10.7
ghcup install cabal --set recommended
ghc --version
cabal --version
cabal update
2022-12-20 12:49:10 +00:00
git clone --single-branch --branch main https://github.com/haskell-works/cabal-cache.git
2022-12-20 08:49:16 +00:00
cd cabal-cache
2022-12-20 12:49:10 +00:00
if [ "${DISTRO}" = "Alpine" ] ; then
cabal build --ghc-options='-split-sections -optl-static'
else
cabal build
fi
2022-12-20 08:49:16 +00:00
binary=$(cabal list-bin cabal-cache)
cd ..
mkdir -p out
strip_binary "${binary}"
cp "${binary}" "out/${ARTIFACT}"