Skip to content

Commit 1495ff2

Browse files
committed
Improve CI
- Make full use of haskell-actions/setup, like picking the latest GHC minor version for you. Also, it already does a `cabal update`. - Use `cabal configure` to fix the configuration. - Freeze file isn't a good cache key as it contains a time stamp. Use the build plan (`plan.json`) instead. - Bump actions to their latest version. - Cache: `restore-keys` automatically includes `key`
1 parent 8f6f1c9 commit 1495ff2

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,31 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
ghc: ["8.10.7", "9.0.2", "9.2.5", "9.4.4", "9.6.1"]
15+
ghc: ["8.10", "9.0", "9.2", "9.4", "9.6"]
1616
env:
1717
CONFIG: "--enable-tests"
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
2020
- name: "Setup haskell"
21-
uses: haskell/actions/setup@v2
21+
uses: haskell-actions/setup@v2
2222
id: setup-haskell
2323
with:
2424
ghc-version: ${{ matrix.ghc }}
25-
cabal-version: 3.8.1.0
26-
- run: cabal update
27-
- run: cabal freeze $CONFIG
28-
- uses: actions/cache@v2
25+
cabal-version: latest
26+
cabal-update: true
27+
- run: |
28+
cabal configure $CONFIG
29+
cabal build --dry-run
30+
# The latter generates dist-newstyle/cache/plan.json which serves as cache key.
31+
- uses: actions/cache@v3
2932
with:
3033
path: ${{ steps.setup-haskell.outputs.cabal-store }}
31-
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
34+
key: ${{ runner.os }}-${{ steps.setup-haskell.outputs.ghc-version }}-${{ hashFiles('dist-newstyle/cache/plan.json') }}
3235
restore-keys: |
33-
${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
34-
${{ runner.os }}-${{ matrix.ghc }}-
35-
- run: cabal build $CONFIG
36-
- run: cabal test $CONFIG
37-
- run: cabal haddock $CONFIG
36+
${{ runner.os }}-${{ steps.setup-haskell.outputs.ghc-version }}-
37+
- run: cabal build
38+
- run: cabal test
39+
- run: cabal haddock
3840
- run: cabal sdist
3941

4042
check-changelogs:
@@ -48,7 +50,7 @@ jobs:
4850
- name: Install dependencies
4951
run: sudo apt install -y fd-find
5052

51-
- uses: actions/checkout@v3
53+
- uses: actions/checkout@v4
5254

5355
- name: git fetch
5456
run: git fetch origin master:master

0 commit comments

Comments
 (0)