Skip to content

Commit

Permalink
ci: cache
Browse files Browse the repository at this point in the history
  • Loading branch information
stevana committed Nov 4, 2024
1 parent 2874bed commit fa145c0
Showing 1 changed file with 12 additions and 32 deletions.
44 changes: 12 additions & 32 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,28 +165,16 @@ jobs:
if: ${{ env.platform == 'x86_64-linux' }}
run: make push-image

- name: Restore cached dependencies (Linux only)
if: ${{ env.platform == 'x86_64-linux' }}
- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-ghc-${{ matrix.ghc-version }}-cabal-${{ matrix.cabal-version }}
paths: ${{ env.platform == 'x86_64-linux' &&
"${HOME}/.cache/cabal ${HOME}/.cabal/store dist-newstyle" ||
${{ steps.setup.outputs.cabal-store }}
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 }}
path: ${{ env.paths }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-plan-

Expand Down Expand Up @@ -214,23 +202,15 @@ jobs:
# Cache dependencies already here, so that we do not have to rebuild them
# should the subsequent steps fail.
- name: Save cached dependencies (Linux only)
if: ${{ env.platform == 'x86_64-linux' &&
steps.cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
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' &&
steps.cache.outputs.cache-hit != 'true' }}
- name: Save cached dependencies
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
env:
paths: ${{ env.platform == 'x86_64-linux' &&
"${HOME}/.cache/cabal ${HOME}/.cabal/store dist-newstyle" ||
${{ steps.setup.outputs.cabal-store }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
path: ${{ env.paths }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Build
Expand Down

0 comments on commit fa145c0

Please sign in to comment.