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

38 lines
1013 B
Bash
Raw Permalink Normal View History

2022-10-20 12:37:50 +00:00
#!/bin/sh
set -eux
2022-11-22 11:41:44 +00:00
. .github/scripts/common.sh
2022-10-20 12:37:50 +00:00
2023-01-14 13:00:32 +00:00
git_describe
2022-11-22 11:41:44 +00:00
# ensure ghcup
2023-01-14 13:00:32 +00:00
install_ghcup
2022-11-22 11:41:44 +00:00
# ensure cabal-cache
2023-01-14 13:00:32 +00:00
download_cabal_cache "$HOME/.local/bin/cabal-cache"
2022-10-20 12:37:50 +00:00
2023-01-14 13:00:32 +00:00
# install toolchain (if necessary)
ghcup -v install ghc --set --force "$GHC_VER"
ghcup -v install cabal --force "$CABAL_VER"
ghc --version
cabal --version
GHC="ghc-${GHC_VER}"
2022-10-20 12:37:50 +00:00
# build
ecabal update
2023-01-14 13:00:32 +00:00
build_with_cache --project-file=cabal.project.release -w "${GHC}" --enable-tests
2022-11-22 11:41:44 +00:00
# set up artifacts
mkdir -p out
2023-01-14 13:00:32 +00:00
binary=$(cabal --project-file=cabal.project.release list-bin ghcup)
binary_test=$(cabal --project-file=cabal.project.release list-bin ghcup-test)
2023-09-02 08:32:46 +00:00
binary_opttest=$(cabal --project-file=cabal.project.release list-bin ghcup-optparse-test)
2022-10-20 12:37:50 +00:00
ver=$("${binary}" --numeric-version)
2022-11-22 11:41:44 +00:00
strip_binary "${binary}"
2023-01-13 04:07:32 +00:00
cp "${binary}" "out/${ARTIFACT}-${ver}${ext}"
cp "${binary_test}" "out/test-${ARTIFACT}-${ver}${ext}"
2023-09-02 08:32:46 +00:00
cp "${binary_opttest}" "out/test-optparse-${ARTIFACT}-${ver}${ext}"
2022-10-20 12:37:50 +00:00
cp ./dist-newstyle/cache/plan.json "out/${ARTIFACT}.plan.json"