fix CI slowness issues

One issue was that we were computing the restore key on the hash of a
file before creating said file when restoring, but after creating the
file when saving, so there was a constant mismatch.

The second issue is that we were not caching dist-newstyle, so we would
always rebuild our "local" dependencies such as binary-symbols,
elf-edit, etc.
This commit is contained in:
Valentin Robert 2023-08-09 20:16:01 -07:00
parent 2d2f22b440
commit b8bbdcdaf1

View File

@ -44,15 +44,6 @@ jobs:
ghc-version: ${{ matrix.ghc-ver }}
cabal-version: ${{ matrix.cabal }}
- uses: actions/cache/restore@v3
name: Restore cabal store cache
with:
path: /home/runner/.cabal/store/ghc-${{ matrix.ghc-ver }}
# Prefer previous SHA hash if it is still cached
key: ${{ env.CACHE_VERSION }}-linux-${{ matrix.ghc-ver }}-${{ hashFiles('cabal.project.freeze') }}-${{ github.sha }}
# otherwise just use most recent build.
restore-keys: ${{ env.CACHE_VERSION }}-linux-${{ matrix.ghc-ver }}-${{ hashFiles('cabal.project.freeze') }}
- name: System Dependencies
run: |
sudo apt update
@ -74,6 +65,19 @@ jobs:
cp cabal.project.werror cabal.project.local
cp cabal.project.freeze.ghc-${{ matrix.ghc-ver }} cabal.project.freeze
# WARNING: Make sure this step remains after the step that creates
# cabal.project.freeze, or the cache key will be incorrect!
- uses: actions/cache/restore@v3
name: Restore cabal store cache
with:
path: |
/home/runner/.cabal/store/ghc-${{ matrix.ghc-ver }}
dist-newstyle
# Prefer previous SHA hash if it is still cached
key: ${{ env.CACHE_VERSION }}-linux-${{ matrix.ghc-ver }}-${{ hashFiles('cabal.project.freeze') }}-${{ github.sha }}
# otherwise just use most recent build.
restore-keys: ${{ env.CACHE_VERSION }}-linux-${{ matrix.ghc-ver }}-${{ hashFiles('cabal.project.freeze') }}
- name: Cabal update
run: cabal update
# Build macaw-base dependencies and crucible separately just so later
@ -139,6 +143,8 @@ jobs:
name: Save cabal store cache
if: always()
with:
path: /home/runner/.cabal/store/ghc-${{ matrix.ghc-ver }}
path: |
/home/runner/.cabal/store/ghc-${{ matrix.ghc-ver }}
dist-newstyle
# Prefer previous SHA hash if it is still cached
key: ${{ env.CACHE_VERSION }}-linux-${{ matrix.ghc-ver }}-${{ hashFiles('cabal.project.freeze') }}-${{ github.sha }}