Skip to content

Commit a69d193

Browse files
committed
Use helper function for logging ghcup logs and exiting on failure
1 parent 70fe92f commit a69d193

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.github/scripts/bindist.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ case "${TARBALL_EXT}" in
2121
# from the oldest version in the list
2222
: "${GHCS:="$(cd "$CI_PROJECT_DIR/out/${ARTIFACT}" && rm -f ./*.json && for ghc in * ; do printf "%s\n" "$ghc" ; done | sort -r | tr '\n' ' ')"}"
2323
emake --version
24-
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" GHCS="${GHCS}" bindist || ( cat /github/workspace/.ghcup/logs/* ; fail "make bindist failed" )
25-
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" bindist-tar || ( cat /github/workspace/.ghcup/logs/* ; fail "make bindist failed" )
24+
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" GHCS="${GHCS}" bindist || fail_with_ghcup_logs "make bindist failed"
25+
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" bindist-tar || fail_with_ghcup_logs "make bindist failed"
2626
;;
2727
*)
2828
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}"

.github/scripts/build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ uname
1111
pwd
1212
env
1313

14-
# ensure ghcup
14+
# Ensure ghcup is present and properly configured.
15+
# Sets up the vanilla channel, as HLS CI provides binaries
16+
# for GHCup's vanilla channel.
1517
install_ghcup
1618

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

2022

2123
# build
22-
ghcup install ghc "${GHC_VERSION}" || cat /github/workspace/.ghcup/logs/*
24+
ghcup install ghc "${GHC_VERSION}" || fail_with_ghcup_logs "install ghc"
2325
ghcup set ghc "${GHC_VERSION}"
2426
sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project
2527
ecabal update

.github/scripts/common.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ error() { echo_color "${RED}" "$1"; }
182182
warn() { echo_color "${LT_BROWN}" "$1"; }
183183
info() { echo_color "${LT_BLUE}" "$1"; }
184184

185+
fail_with_ghcup_logs() {
186+
cat /github/workspace/.ghcup/logs/*
187+
fail "$!"
188+
}
185189
fail() { error "error: $1"; exit 1; }
186190

187191
run() {

0 commit comments

Comments
 (0)