@@ -3,6 +3,16 @@ name: CI
33# Trigger the workflow on push or pull request, but only for the master branch
44on :
55 pull_request :
6+ paths :
7+ - ' lib/**'
8+ - ' src/**'
9+ - ' test/**'
10+ - ' lib/base/base.agda-lib'
11+ - ' agda2hs.cabal'
12+ - ' cabal.project'
13+ - ' Makefile'
14+ - ' .github/workflows/**.yml'
15+ branches : [master]
616 push :
717 paths :
818 - ' lib/**'
@@ -22,12 +32,11 @@ jobs:
2232 strategy :
2333 matrix :
2434 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 ]
35+ cabal : [3.14.2.0 ]
36+ deploy-ghc : [9.6.7 ]
37+ ghc : [9.6.7 , 9.8.4 , 9.10.3 , 9.12.2 ]
2838 steps :
29- - uses : actions/checkout@v3
30- if : github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
39+ - uses : actions/checkout@v6
3140
3241 # Takes care of ghc and cabal. See https://github.com/haskell/actions.
3342 - uses : haskell-actions/setup@v2
@@ -37,42 +46,64 @@ jobs:
3746 ghc-version : ${{ matrix.ghc }}
3847 cabal-version : ${{ matrix.cabal }}
3948
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
49+ # Andreas, 2025-11-28: Since the freeze file contains a timestamp of the Hackage index
50+ # and the index changes several times a day,
51+ # the freeze file is not very useful as a cache key.
52+ # Instead, use the plan.json file (see below).
53+ # # Generate a cabal.project.freeze file with all dependencies. We use the
54+ # # hash of this as the cache key, so when a dependency changes we upload a
55+ # # new cache.
56+ # - name: Freeze
57+ # run: cabal freeze
4558
46- # Install fix-whitespace since we need it for tests.
47- # This is done after the freeze to make sure we re-use the packages
48- - name : Install fix-whitespace
59+ - name : Configure the build plan
4960 run : |
50- echo "import: cabal.project" > cabal.project.ci
51- cabal install fix-whitespace --project-file=cabal.project.ci
61+ cabal build --dry-run
62+ # cabal build --dry-run creates dist-newstyle/cache/plan.json
63+
64+ # Andreas, 2025-11-28, AIM XLI, use fix-whitespace-action
65+ # # Install fix-whitespace since we need it for tests.
66+ # # This is done after the freeze to make sure we re-use the packages
67+ # - name: Install fix-whitespace
68+ # run: |
69+ # echo "import: cabal.project" > cabal.project.ci
70+ # cabal install fix-whitespace --project-file=cabal.project.ci
5271
5372 # Cache the contents of ~/.cabal/store to avoid rebuilding dependencies for
5473 # every build. `restore-keys` makes it use the latest cache even if the
5574 # fingerprint doesn't match, so we don't need to start from scratch every
5675 # time a dependency changes.
57- - uses : actions/cache@v3
58- name : Cache ~/.cabal/store
76+ - uses : actions/cache/restore@v4
77+ name : Restore cached ~/.cabal/store
78+ id : cache
5979 with :
6080 path : ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
61- key : ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
81+ # The freeze file is a bad key, use dist-newstyle/cache/plan.json instead.
82+ # key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
83+ key : ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }}
6284 restore-keys : ${{ runner.os }}-${{ matrix.ghc }}-
6385
86+ - name : Run fix-whitespace
87+ uses : andreasabel/fix-whitespace-action@v1
88+
6489 - name : Run test suite
65- run : make test && git diff --exit-code
90+ run : make test-on-CI && git diff --exit-code
6691
6792 - name : Generate Prelude HTML
6893 if : ${{ (matrix.ghc == matrix.deploy-ghc) && (github.ref == 'refs/heads/master') }}
6994 run : make libHtml
7095
7196 - name : Deploy Prelude HTML
7297 if : ${{ (matrix.ghc == matrix.deploy-ghc) && (github.ref == 'refs/heads/master') }}
73- uses : peaceiris/actions-gh-pages@v3
98+ uses : peaceiris/actions-gh-pages@v4
7499 with :
75100 github_token : ${{ secrets.GITHUB_TOKEN }}
76101 publish_dir : html
77102 destination_dir : lib
78103
104+ - uses : actions/cache/save@v4
105+ name : Cache ~/.cabal/store
106+ if : always() && steps.cache.outputs.cache-hit != 'true'
107+ with :
108+ path : ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
109+ key : ${{ steps.cache.outputs.cache-primary-key }}
0 commit comments