|
| 1 | +# The following workflow is based on the example provided by |
| 2 | +# haskell-actions/setup: |
| 3 | +# |
| 4 | +# https://github.com/haskell-actions/setup#model-cabal-workflow-with-caching |
| 5 | + |
1 | 6 | name: CI |
2 | 7 |
|
3 | 8 | on: push |
4 | 9 |
|
| 10 | +concurrency: |
| 11 | + group: build-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
5 | 14 | jobs: |
6 | 15 | build: |
7 | 16 | runs-on: ubuntu-latest |
8 | 17 | strategy: |
9 | 18 | matrix: |
10 | | - ghc: ['8.8', '8.10'] |
11 | | - |
| 19 | + ghc-version: ['8.10', '8.8'] |
12 | 20 | steps: |
13 | | - - uses: actions/checkout@v4 |
14 | | - - name: Setup Haskell |
15 | | - uses: haskell/actions/setup@v2 |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + - name: Setup Haskell tools |
| 24 | + uses: haskell-actions/setup@v2 |
| 25 | + id: setup |
16 | 26 | with: |
17 | | - ghc-version: ${{ matrix.ghc }} |
| 27 | + ghc-version: ${{ matrix.ghc-version }} |
18 | 28 | cabal-version: 'latest' |
19 | | - - uses: actions/cache@v3.3.2 |
| 29 | + cabal-update: true |
| 30 | + - name: Configure the build |
| 31 | + run: | |
| 32 | + cabal configure --enable-tests --disable-documentation |
| 33 | + cabal build all --dry-run |
| 34 | + - name: Restore cached dependencies |
| 35 | + uses: actions/cache/restore@v3 |
| 36 | + id: cache |
| 37 | + env: |
| 38 | + key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} |
| 39 | + with: |
| 40 | + path: ${{ steps.setup.outputs.cabal-store }} |
| 41 | + key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} |
| 42 | + restore-keys: ${{ env.key }}- |
| 43 | + - name: Install dependencies |
| 44 | + if: steps.cache.outputs.cache-hit != 'true' |
| 45 | + run: cabal build all --only-dependencies |
| 46 | + - name: Save cached dependencies |
| 47 | + uses: actions/cache/save@v3 |
| 48 | + if: steps.cache.outputs.cache-hit != 'true' |
20 | 49 | with: |
21 | | - path: ~/.cabal |
22 | | - key: cabal--${{ matrix.ghc }}-${{ hashFiles('*/*.cabal') }} |
23 | | - restore-keys: | |
24 | | - cabal--${{ matrix.ghc }}-${{ hashFiles('*/*.cabal') }} |
25 | | - cabal--${{ matrix.ghc }}- |
26 | | - cabal- |
27 | | - - run: cabal update |
28 | | - - run: cabal configure --enable-tests |
29 | | - - run: cabal build all --only-dependencies |
30 | | - - run: cabal build all |
31 | | - - run: cabal test all |
| 50 | + path: ${{ steps.setup.outputs.cabal-store }} |
| 51 | + key: ${{ steps.cache.outputs.cache-primary-key }} |
| 52 | + - name: Build |
| 53 | + run: cabal build all |
| 54 | + - name: Run tests |
| 55 | + run: cabal test all |
32 | 56 | env: |
33 | 57 | ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }} |
0 commit comments