Skip to content

Commit 30c62de

Browse files
committed
update CI
1 parent cd2a813 commit 30c62de

File tree

1 file changed

+46
-14
lines changed

1 file changed

+46
-14
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,58 @@ jobs:
1414
matrix:
1515
ghc:
1616
- "latest"
17+
- "9.12.2"
1718
- "9.10.1"
18-
- "9.8.2"
19-
- "9.6.2"
20-
- "9.4.7"
21-
- "9.2.5"
19+
- "9.8.4"
20+
- "9.6.7"
21+
- "9.4.8"
22+
- "9.2.8"
2223
- "9.0.2"
2324

2425
steps:
25-
- name: Checkout commit
26-
uses: actions/checkout@v3
27-
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main'
26+
- uses: actions/checkout@v4
2827

29-
- name: Set up GHC & cabal
30-
uses: haskell/actions/setup@v2
28+
- name: Set up GHC ${{ matrix.ghc }}
29+
uses: haskell-actions/setup@v2
30+
id: setup
3131
with:
3232
ghc-version: ${{ matrix.ghc }}
33-
cabal-version: "latest"
33+
# Defaults, added for clarity:
34+
cabal-version: 'latest'
35+
cabal-update: true
3436

35-
- name: Build
36-
run: cabal build
37+
- name: Configure the build
38+
run: |
39+
cabal configure --disable-documentation
40+
cabal build all --dry-run
41+
# The last step generates dist-newstyle/cache/plan.json for the cache key.
3742

38-
- name: Test
39-
run: cabal test
43+
- name: Restore cached dependencies
44+
uses: actions/cache/restore@v4
45+
id: cache
46+
env:
47+
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
48+
with:
49+
path: ${{ steps.setup.outputs.cabal-store }}
50+
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
51+
restore-keys: ${{ env.key }}-
52+
53+
- name: Install dependencies
54+
# If we had an exact cache hit, the dependencies will be up to date.
55+
if: steps.cache.outputs.cache-hit != 'true'
56+
run: cabal build all --only-dependencies
57+
58+
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
59+
- name: Save cached dependencies
60+
uses: actions/cache/save@v4
61+
# If we had an exact cache hit, trying to save the cache would error because of key clash.
62+
if: steps.cache.outputs.cache-hit != 'true'
63+
with:
64+
path: ${{ steps.setup.outputs.cabal-store }}
65+
key: ${{ steps.cache.outputs.cache-primary-key }}
66+
67+
- name: Build if-instance
68+
run: cabal build if-instance
69+
70+
- name: Test if-instance
71+
run: cabal test if-instance

0 commit comments

Comments
 (0)