Skip to content

Commit

Permalink
Make cabal-cache non-fatal
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Jul 7, 2023
1 parent 055df58 commit 48483d0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .github/scripts/cabal-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

case "$(uname -s)" in
MSYS_*|MINGW*)
ext=".exe"
;;
*)
ext=""
;;
esac

if [ "${CABAL_CACHE_DISABLE}" = "yes" ] ; then
echo "cabal-cache disabled (CABAL_CACHE_DISABLE set)"
elif [ "${CABAL_CACHE_NONFATAL}" = "yes" ] ; then
time "cabal-cache${ext}" "$@" || echo "cabal-cache failed (CABAL_CACHE_NONFATAL set)"
else
time "cabal-cache${ext}" "$@"
exit $?
fi

8 changes: 6 additions & 2 deletions .github/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sync_from() {
cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store"
fi

cabal-cache sync-from-archive \
cabal-cache.sh sync-from-archive \
--host-name-override=${S3_HOST} \
--host-port-override=443 \
--host-ssl-override=True \
Expand All @@ -29,7 +29,7 @@ sync_to() {
cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store"
fi

cabal-cache sync-to-archive \
cabal-cache.sh sync-to-archive \
--host-name-override=${S3_HOST} \
--host-port-override=443 \
--host-ssl-override=True \
Expand Down Expand Up @@ -115,6 +115,10 @@ download_cabal_cache() {
mv "cabal-cache${exe}" "${dest}${exe}"
chmod +x "${dest}${exe}"
fi

# install shell wrapper
cp "${CI_PROJECT_DIR}"/.github/scripts/cabal-cache.sh "$HOME"/.local/bin/
chmod +x "$HOME"/.local/bin/cabal-cache.sh
)
}

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
schedule:
- cron: '0 2 * * *'

env:
CABAL_CACHE_DISABLE: ${{ vars.CABAL_CACHE_DISABLE }}
CABAL_CACHE_NONFATAL: ${{ vars.CABAL_CACHE_NONFATAL }}

jobs:
build-linux:
name: Build linux binary
Expand Down

0 comments on commit 48483d0

Please sign in to comment.