|
7 | 7 | strategy:
|
8 | 8 | fail-fast: false
|
9 | 9 | matrix:
|
10 |
| - ghc: ['8.4.4', '8.6.5', '8.8.4', '8.10.7', '9.0.1', '9.2.5', '9.4.5', '9.6.1'] |
11 |
| - os: ['ubuntu-latest', 'macos-latest'] |
| 10 | + ghc: ['8.6', '8.10', '9.4', '9.6', '9.8', '9.10'] |
| 11 | + os: ['ubuntu-latest'] |
| 12 | + include: |
| 13 | + - ghc: '9.10' |
| 14 | + os: 'macos-latest' |
12 | 15 | runs-on: ${{ matrix.os }}
|
13 | 16 |
|
14 | 17 | name: GHC ${{ matrix.ghc }} on ${{ matrix.os }}
|
15 | 18 | steps:
|
16 |
| - - uses: actions/checkout@v3 |
17 |
| - - uses: haskell/actions/setup@v2 |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Set up GHC ${{ matrix.ghc-version }} |
| 22 | + uses: haskell-actions/setup@v2 |
| 23 | + id: setup |
18 | 24 | with:
|
19 | 25 | ghc-version: ${{ matrix.ghc }}
|
20 |
| - cabal-version: '3.10.1.0' |
21 |
| - - name: Cache |
22 |
| - uses: actions/cache@v3 |
| 26 | + |
| 27 | + - name: Configure the build |
| 28 | + run: | |
| 29 | + cabal configure --enable-tests --enable-benchmarks --enable-documentation |
| 30 | + cabal build all --dry-run |
| 31 | + # The last step generates dist-newstyle/cache/plan.json for the cache key. |
| 32 | + |
| 33 | + - name: Restore cached dependencies |
| 34 | + uses: actions/cache/restore@v4 |
| 35 | + id: cache |
23 | 36 | env:
|
24 |
| - cache-name: cache-cabal |
| 37 | + key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} |
25 | 38 | with:
|
26 |
| - path: ~/.cabal |
27 |
| - key: ${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} |
28 |
| - restore-keys: | |
29 |
| - ${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}- |
30 |
| - ${{ runner.os }}-${{ matrix.ghc }}-build- |
31 |
| - ${{ runner.os }}-${{ matrix.ghc }}- |
32 |
| - ${{ runner.os }} |
| 39 | + path: ${{ steps.setup.outputs.cabal-store }} |
| 40 | + key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} |
| 41 | + restore-keys: ${{ env.key }}- |
33 | 42 |
|
34 | 43 | - name: Install dependencies
|
35 |
| - run: cabal build --only-dependencies --enable-tests --enable-benchmarks |
| 44 | + # If we had an exact cache hit, the dependencies will be up to date. |
| 45 | + if: steps.cache.outputs.cache-hit != 'true' |
| 46 | + run: cabal build all --only-dependencies |
| 47 | + |
| 48 | + # Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. |
| 49 | + - name: Save cached dependencies |
| 50 | + uses: actions/cache/save@v4 |
| 51 | + # If we had an exact cache hit, trying to save the cache would error because of key clash. |
| 52 | + if: steps.cache.outputs.cache-hit != 'true' |
| 53 | + with: |
| 54 | + path: ${{ steps.setup.outputs.cabal-store }} |
| 55 | + key: ${{ steps.cache.outputs.cache-primary-key }} |
| 56 | + |
36 | 57 | - name: Build
|
37 |
| - run: cabal build --enable-tests --enable-benchmarks all |
| 58 | + run: cabal build all |
| 59 | + |
38 | 60 | - name: Run tests
|
39 |
| - # 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. |
40 |
| - run: cabal test --enable-tests -f-hlint all |
41 |
| - - if: matrix.ghc != '8.4.4' |
42 |
| - # docs aren't built on ghc 8.4.4 because some dependency docs don't build on older GHCs |
43 |
| - name: Build Docs |
44 |
| - run: cabal haddock |
| 61 | + run: cabal test all |
| 62 | + |
| 63 | + - name: Check cabal file |
| 64 | + run: cabal check |
| 65 | + |
| 66 | + - name: Build documentation |
| 67 | + run: cabal haddock all |
0 commit comments