Merge branch 'retry-cache'
This commit is contained in:
commit
cb0d8b80c3
22
.github/scripts/common.sh
vendored
22
.github/scripts/common.sh
vendored
@ -10,6 +10,16 @@ ecabal() {
|
||||
cabal "$@"
|
||||
}
|
||||
|
||||
sync_from_retry() {
|
||||
if [ "${RUNNER_OS}" != "Windows" ] ; then
|
||||
cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store"
|
||||
else
|
||||
cabal_store_path="${CABAL_DIR}/store"
|
||||
fi
|
||||
|
||||
sync_from || { sleep 9 ; rm -rf "${cabal_store_path:?}"/* ; sync_from || { sleep 20 ; rm -rf "${cabal_store_path:?}"/* ; sync_from ; } }
|
||||
}
|
||||
|
||||
sync_from() {
|
||||
if [ "${RUNNER_OS}" != "Windows" ] ; then
|
||||
cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store"
|
||||
@ -24,6 +34,10 @@ sync_from() {
|
||||
--archive-uri "s3://ghcup-hs/${RUNNER_OS}-${ARCH}-${DISTRO}"
|
||||
}
|
||||
|
||||
sync_to_retry() {
|
||||
sync_to || { sleep 9 ; sync_to || { sleep 20 ; sync_to ; } }
|
||||
}
|
||||
|
||||
sync_to() {
|
||||
if [ "${RUNNER_OS}" != "Windows" ] ; then
|
||||
cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store"
|
||||
@ -129,11 +143,11 @@ download_cabal_cache() {
|
||||
build_with_cache() {
|
||||
ecabal configure "$@"
|
||||
ecabal build --dependencies-only "$@" --dry-run
|
||||
sync_from
|
||||
ecabal build --dependencies-only "$@" || sync_to
|
||||
sync_to
|
||||
sync_from_retry
|
||||
ecabal build --dependencies-only "$@" || sync_to_retry
|
||||
sync_to_retry
|
||||
ecabal build "$@"
|
||||
sync_to
|
||||
sync_to_retry
|
||||
}
|
||||
|
||||
install_ghcup() {
|
||||
|
4
.github/scripts/hls.sh
vendored
4
.github/scripts/hls.sh
vendored
@ -57,9 +57,9 @@ eghcup debug-info
|
||||
cd "haskell-language-server-${HLS_TARGET_VERSION}/"
|
||||
ecabal configure -w "ghc-${GHC_VERSION}" --disable-profiling --disable-tests --jobs="$(nproc)"
|
||||
ecabal build --dependencies-only -w "ghc-${GHC_VERSION}" --disable-profiling --disable-tests --jobs="$(nproc)" --dry-run
|
||||
sync_from
|
||||
sync_from_retry
|
||||
ecabal build --dependencies-only -w "ghc-${GHC_VERSION}" --disable-profiling --disable-tests --jobs="$(nproc)" || sync_to
|
||||
sync_to
|
||||
sync_to_retry
|
||||
)
|
||||
|
||||
eghcup -v compile hls -j "$(nproc)" -g "${HLS_TARGET_VERSION}" --ghc "${GHC_VERSION}"
|
||||
|
37
.github/workflows/cache.yaml
vendored
Normal file
37
.github/workflows/cache.yaml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Cache eviction
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
key:
|
||||
description: Which cache to evict
|
||||
required: true
|
||||
default: '/'
|
||||
type: choice
|
||||
options:
|
||||
- FreeBSD-64-na
|
||||
- Linux-32-Alpine
|
||||
- Linux-64-Alpine
|
||||
- Linux-64-Ubuntu
|
||||
- Linux-ARM-Ubuntu
|
||||
- Linux-ARM64-Ubuntu
|
||||
- Windows-64-na
|
||||
- macOS-64-na
|
||||
- macOS-ARM64-na
|
||||
- /
|
||||
jobs:
|
||||
evict:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Remove from S3
|
||||
uses: vitorsgomes/s3-rm-action@master
|
||||
with:
|
||||
args: --recursive
|
||||
env:
|
||||
AWS_S3_ENDPOINT: ${{ secrets.S3_HOST }}
|
||||
AWS_S3_BUCKET: ghcup-hs
|
||||
AWS_REGION: us-west-2
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
PATH_TO_DELETE: ${{ github.event.inputs.key }}
|
Loading…
Reference in New Issue
Block a user