Skip to content

Commit 41d0ace

Browse files
committed
Update CI to latest GHC and action versions, modernize caching
- separate caching into restore and save step - always save cache even if build failed (speeds up next attempt) - use build plan rather than freeze file as cache key
1 parent bb5f086 commit 41d0ace

File tree

3 files changed

+44
-21
lines changed

3 files changed

+44
-21
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ jobs:
2222
strategy:
2323
matrix:
2424
os: [ubuntu-latest] # macOS-latest, windows-latest
25-
cabal: [3.10.3]
26-
deploy-ghc: [9.6.6]
27-
ghc: [9.4.8, 9.6.6, 9.8.2, 9.10.1]
25+
cabal: [3.14.2.0]
26+
deploy-ghc: [9.6.7]
27+
ghc: [9.6.7, 9.8.4, 9.10.3, 9.12.2]
2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v6
3030
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
3131

3232
# Takes care of ghc and cabal. See https://github.com/haskell/actions.
@@ -37,11 +37,20 @@ jobs:
3737
ghc-version: ${{ matrix.ghc }}
3838
cabal-version: ${{ matrix.cabal }}
3939

40-
# Generate a cabal.project.freeze file with all dependencies. We use the
41-
# hash of this as the cache key, so when a dependency changes we upload a
42-
# new cache.
43-
- name: Freeze
44-
run: cabal freeze
40+
# Andreas, 2025-11-28: Since the freeze file contains a timestamp of the Hackage index
41+
# and the index changes several times a day,
42+
# the freeze file is not very useful as a cache key.
43+
# Instead, use the plan.json file (see below).
44+
# # Generate a cabal.project.freeze file with all dependencies. We use the
45+
# # hash of this as the cache key, so when a dependency changes we upload a
46+
# # new cache.
47+
# - name: Freeze
48+
# run: cabal freeze
49+
50+
- name: Configure the build plan
51+
run: |
52+
cabal build --dry-run
53+
# cabal build --dry-run creates dist-newstyle/cache/plan.json
4554

4655
# Install fix-whitespace since we need it for tests.
4756
# This is done after the freeze to make sure we re-use the packages
@@ -54,11 +63,14 @@ jobs:
5463
# every build. `restore-keys` makes it use the latest cache even if the
5564
# fingerprint doesn't match, so we don't need to start from scratch every
5665
# time a dependency changes.
57-
- uses: actions/cache@v3
58-
name: Cache ~/.cabal/store
66+
- uses: actions/cache/restore@v4
67+
name: Restore cached ~/.cabal/store
68+
id: cache
5969
with:
6070
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
61-
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
71+
# The freeze file is a bad key, use dist-newstyle/cache/plan.json instead.
72+
# key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
73+
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }}
6274
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
6375

6476
- name: Run test suite
@@ -70,9 +82,15 @@ jobs:
7082

7183
- name: Deploy Prelude HTML
7284
if: ${{ (matrix.ghc == matrix.deploy-ghc) && (github.ref == 'refs/heads/master') }}
73-
uses: peaceiris/actions-gh-pages@v3
85+
uses: peaceiris/actions-gh-pages@v4
7486
with:
7587
github_token: ${{ secrets.GITHUB_TOKEN }}
7688
publish_dir: html
7789
destination_dir: lib
7890

91+
- uses: actions/cache/save@v4
92+
name: Cache ~/.cabal/store
93+
if: always() && steps.cache.outputs.cache-hit != 'true'
94+
with:
95+
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
96+
key: ${{ steps.cache.outputs.cache-primary-key }}

.github/workflows/docs.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
deploy:
2020
strategy:
2121
matrix:
22-
python-version: ["3.10.8"]
22+
python-version: ["3.14"]
2323

2424
env:
2525
DOCS_DIR: docs
@@ -28,21 +28,26 @@ jobs:
2828

2929
runs-on: ubuntu-latest
3030
steps:
31+
3132
- name: Checkout
32-
uses: actions/checkout@v3
33+
uses: actions/checkout@v6
34+
3335
- name: Set up Python ${{ matrix.python-version }}
34-
uses: actions/setup-python@v4
36+
uses: actions/setup-python@v6
3537
with:
3638
python-version: ${{ matrix.python-version }}
39+
3740
- name: Install dependencies
3841
run: |
3942
pip install -r ${{ env.DOCS_DIR }}/requirements.txt
43+
4044
- name: Build User Manual in HTML
4145
run: |
4246
cd ${{ env.DOCS_DIR }}
4347
make html
48+
4449
- name: Deploy to GitHub Pages
45-
uses: peaceiris/actions-gh-pages@v3
50+
uses: peaceiris/actions-gh-pages@v4
4651
with:
4752
github_token: ${{ secrets.GITHUB_TOKEN }}
4853
publish_dir: ${{ env.DOCS_BUILD_HTML_DIR }}

.github/workflows/nix-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
- pretty: "Typecheck with Agda"
3434
derivation: containers-lib
3535
steps:
36-
- uses: actions/checkout@v3
37-
- uses: nixbuild/nix-quick-install-action@v30
36+
- uses: actions/checkout@v6
37+
- uses: nixbuild/nix-quick-install-action@v34
3838
with:
3939
nix_conf: |
4040
keep-env-derivations = true
@@ -50,8 +50,8 @@ jobs:
5050
name: "Test building inside a nix shell"
5151
runs-on: ubuntu-latest
5252
steps:
53-
- uses: actions/checkout@v3
54-
- uses: nixbuild/nix-quick-install-action@v30
53+
- uses: actions/checkout@v6
54+
- uses: nixbuild/nix-quick-install-action@v34
5555
with:
5656
nix_conf: |
5757
keep-env-derivations = true

0 commit comments

Comments
 (0)