Skip to content

Commit

Permalink
ci: tweak caching
Browse files Browse the repository at this point in the history
  • Loading branch information
stevana committed Nov 4, 2024
1 parent 436fc1f commit 9673b28
Showing 1 changed file with 44 additions and 21 deletions.
65 changes: 44 additions & 21 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,49 +165,72 @@ jobs:
if: ${{ env.platform == 'x86_64-linux' }}
run: make push-image

- name: Restore cached dependencies
- name: Restore cached dependencies (Linux only)
if: ${{ env.platform == 'x86_64-linux' }}
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-ghc-${{ matrix.ghc-version }}-cabal-${{ matrix.cabal-version }}
with:
path: |
${HOME}/.cache/cabal
${HOME}/.cabal/store
dist-newstyle
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-plan-

- name: Restore cached dependencies (MacOS and Windows only)
if: ${{ env.platform != 'x86_64-linux' }}
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-ghc-${{ matrix.ghc-version }}-cabal-${{ matrix.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
# ${HOME}/.cache/cabal
# ${HOME}/.cabal/store
# dist-newstyle
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-plan-

- name: Build dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: make build-deps

#- name: Debug .cache/cabal cache
# run: |
# ls -Rlh ${HOME}/.cache/cabal || true
- name: Debug .cache/cabal cache
if: ${{ env.platform != 'x86_64-windows' }}
run: |
ls -Rlh ${HOME}/.cache/cabal || true
#- name: Debug .cabal/store cache
# run: |
# echo ${{ steps.setup.outputs.cabal-store }}
# ls -Rlh ${{ steps.setup.outputs.cabal-store }} || true
# echo "==="
# ls -Rlh ${HOME}/.cabal/store || true
- name: Debug .cabal/store cache
if: ${{ env.platform != 'x86_64-windows' }}
run: |
echo ${{ steps.setup.outputs.cabal-store }}
ls -Rlh ${{ steps.setup.outputs.cabal-store }} || true
echo "==="
ls -Rlh ${HOME}/.cabal/store || true
#- name: Debug dist-newstyle cache
# run: |
# ls -Rlh dist-newstyle || true
- name: Debug dist-newstyle cache
if: ${{ env.platform != 'x86_64-windows' }}
run: |
ls -Rlh dist-newstyle || true
# Cache dependencies already here, so that we do not have to rebuild them
# should the subsequent steps fail.
- name: Save cached dependencies
- name: Save cached dependencies (Linux only)
if: ${{ env.platform == 'x86_64-linux' }}
uses: actions/cache/save@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
${HOME}/.cache/cabal
${HOME}/.cabal/store
dist-newstyle
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Save cached dependencies (MacOS and Windows only)
if: ${{ env.platform != 'x86_64-linux' }}
uses: actions/cache/save@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
#path: |
# ${HOME}/.cache/cabal
# ${HOME}/.cabal/store
# dist-newstyle
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Build
Expand Down

0 comments on commit 9673b28

Please sign in to comment.