Skip to content

Commit

Permalink
wip: cache test
Browse files Browse the repository at this point in the history
  • Loading branch information
tgunnoe committed Nov 14, 2024
1 parent 77cfd3c commit 4750c1a
Showing 1 changed file with 34 additions and 32 deletions.
66 changes: 34 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,46 +28,48 @@ jobs:
- name: Add signing key for nix
run: echo "${{ secrets.NIX_SIGNING_KEY }}" > "${{ runner.temp }}/nix-key"

- name: Record dependencies to be used as cache keys
id: record-deps
run: |
nix develop && cd onchain
cabal build all --enable-tests --dry-run --minimize-conflict-set
cat dist-newstyle/cache/plan.json \
| jq '.["install-plan"][].id' \
| sort \
| uniq \
| tee dependencies.txt
- name: Enter nix shell
run: nix develop && cd onchain
# - name: Record dependencies to be used as cache keys
# id: record-deps
# run: |
# nix develop && cd onchain
# cabal build all --enable-tests --dry-run --minimize-conflict-set
# cat dist-newstyle/cache/plan.json \
# | jq '.["install-plan"][].id' \
# | sort \
# | uniq \
# | tee dependencies.txt

- name: Restore cache
uses: actions/cache/restore@v4
id: restore-cabal-cache
with:
path: |
~/.local/state/cabal/store
~/.cabal/store
onchain/dist-newstyle
# - name: Restore cache
# uses: actions/cache/restore@v4
# id: restore-cabal-cache
# with:
# path: |
# ~/.local/state/cabal/store
# ~/.cabal/store
# onchain/dist-newstyle

key: ${{ runner.os }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('cabal.project*') }}
# key: ${{ runner.os }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('cabal.project*') }}

restore-keys: |
${{ runner.os }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }}
${{ runner.os }}-${{ env.CABAL_CACHE_VERSION }}-
# restore-keys: |
# ${{ runner.os }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }}
# ${{ runner.os }}-${{ env.CABAL_CACHE_VERSION }}-

- name: Build dependencies
id: build-dependencies
run: cabal build all --only-dependencies

- name: Save cache
uses: actions/cache/save@v4
id: save-cabal-cache
if: steps.build-dependencies.outcome == 'success' && steps.restore-cabal-cache.outputs.cache-hit != 'true'
with:
path: |
~/.local/state/cabal/store
~/.cabal/store
onchain/dist-newstyle
key: ${{ steps.restore-cabal-cache.outputs.cache-primary-key }}
# - name: Save cache
# uses: actions/cache/save@v4
# id: save-cabal-cache
# if: steps.build-dependencies.outcome == 'success' && steps.restore-cabal-cache.outputs.cache-hit != 'true'
# with:
# path: |
# ~/.local/state/cabal/store
# ~/.cabal/store
# onchain/dist-newstyle
# key: ${{ steps.restore-cabal-cache.outputs.cache-primary-key }}

- name: Lint sources
run: |
Expand Down

0 comments on commit 4750c1a

Please sign in to comment.