From 84cb830158a9306c389b4baefe94da5cf31cfc03 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 27 Sep 2024 11:25:46 -0400 Subject: [PATCH] Need to cabal update after cache restore Otherwise the cache restore rolls back the hackage index. Thanks @fgaz for letting me know. Also changed formatting to match https://github.com/haskell-actions/setup?tab=readme-ov-file#model-cabal-workflow-with-caching more. --- .github/workflows/haskell.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index d01883a..9e999db 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -13,12 +13,9 @@ jobs: name: GHC ${{ matrix.ghc }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - uses: haskell/actions/setup@v2 - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: '3.10.1.0' + - name: Cache + # Needs to be an early step so e.g. `cabal update` isn't undone uses: actions/cache@v3 env: cache-name: cache-cabal @@ -31,13 +28,23 @@ jobs: ${{ runner.os }}-${{ matrix.ghc }}- ${{ runner.os }} + - uses: actions/checkout@v3 + + - uses: haskell/actions/setup@v2 + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: '3.10.1.0' + - name: Install dependencies run: cabal build --only-dependencies --enable-tests --enable-benchmarks + - name: Build run: cabal build --enable-tests --enable-benchmarks all + - name: Run tests # We don't run hlint tests, because different versions of hlint have different suggestions, and we don't want to worry about satisfying them all. run: cabal test --enable-tests -f-hlint all + - if: matrix.ghc != '8.4.4' # docs aren't built on ghc 8.4.4 because some dependency docs don't build on older GHCs name: Build Docs