Skip to content

Commit

Permalink
Use helper function for logging ghcup logs and exiting on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
fendor committed Jan 22, 2025
1 parent 9722fcb commit 8acc256
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/bindist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ case "${TARBALL_EXT}" in
# from the oldest version in the list
: "${GHCS:="$(cd "$CI_PROJECT_DIR/out/${ARTIFACT}" && rm -f ./*.json && for ghc in * ; do printf "%s\n" "$ghc" ; done | sort -r | tr '\n' ' ')"}"
emake --version
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" GHCS="${GHCS}" bindist || ( cat /github/workspace/.ghcup/logs/* ; fail "make bindist failed" )
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" bindist-tar || ( cat /github/workspace/.ghcup/logs/* ; fail "make bindist failed" )
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" GHCS="${GHCS}" bindist || fail_with_ghcup_logs "make bindist failed"
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" bindist-tar || fail_with_ghcup_logs "make bindist failed"
;;
*)
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}"
Expand Down
6 changes: 4 additions & 2 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ uname
pwd
env

# ensure ghcup
# Ensure ghcup is present and properly configured.
# Sets up the vanilla channel, as HLS CI provides binaries
# for GHCup's vanilla channel.
install_ghcup

# ensure cabal-cache
download_cabal_cache "$HOME/.local/bin/cabal-cache"


# build
ghcup install ghc "${GHC_VERSION}" || cat /github/workspace/.ghcup/logs/*
ghcup install ghc "${GHC_VERSION}" || fail_with_ghcup_logs "install ghc"
ghcup set ghc "${GHC_VERSION}"
sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project
ecabal update
Expand Down
4 changes: 4 additions & 0 deletions .github/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ error() { echo_color "${RED}" "$1"; }
warn() { echo_color "${LT_BROWN}" "$1"; }
info() { echo_color "${LT_BLUE}" "$1"; }

fail_with_ghcup_logs() {
cat /github/workspace/.ghcup/logs/*
fail "$!"
}
fail() { error "error: $1"; exit 1; }

run() {
Expand Down

0 comments on commit 8acc256

Please sign in to comment.