1
1
---
2
- name : cabal -build
2
+ name : stack -build
3
3
on :
4
4
push :
5
5
branches : main
@@ -11,40 +11,51 @@ permissions:
11
11
12
12
jobs :
13
13
build :
14
- name : ${{ matrix.os }} / ghc ${{ matrix.ghc-version }}
14
+ name : lts- ${{ matrix.stack.lts }} / ghc- ${{ matrix.stack. ghc }} / ${{ matrix.os }}
15
15
runs-on : ${{ matrix.os }}-latest
16
16
strategy :
17
17
fail-fast : false
18
18
matrix :
19
19
os : [ubuntu]
20
- ghc-version :
21
- - 9.8
22
- - 9.6
23
- - 9.4
20
+ stack :
21
+ - lts : 23.28
22
+ ghc : 9.8.4
23
+
24
+ - lts : 22.44
25
+ ghc : 9.6.7
26
+
27
+ - lts : &default-lts 21.25
28
+ ghc : &default-ghc 9.4.8
24
29
25
30
include :
26
31
- os : windows
27
- ghc-version : 9.6
32
+ stack :
33
+ lts : *default-lts
34
+ ghc : *default-ghc
28
35
29
36
- os : macos
30
- ghc-version : 9.6
37
+ stack :
38
+ lts : 21.25
39
+ ghc : 9.8.4
31
40
32
41
steps :
33
42
- uses : actions/checkout@v3
34
43
35
- - name : Set up GHC ${{ matrix.ghc-version }}
44
+ - name : Set up Stack LTS ${{ matrix.stack-lts }}
36
45
uses : haskell-actions/setup@v2
37
46
id : setup
38
47
with :
39
- ghc-version : ${{ matrix.ghc-version }}
40
- # Defaults, added for clarity:
41
- cabal-version : latest
42
- cabal-update : true
48
+ ghc-version : ${{ matrix.stack. ghc }}
49
+ enable-stack : true
50
+ stack-setup-ghc : true
51
+ stack-no-global : true
43
52
44
53
- name : Configure the build
45
54
run : |
46
- cabal configure --enable-tests --enable-benchmarks --disable-documentation
47
- cabal build --dry-run
55
+ echo "with key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}"
56
+
57
+ stack config set resolver lts-${{ matrix.stack.lts }}
58
+ stack build --dry-run
48
59
# The last step generates dist-newstyle/cache/plan.json for the cache key.
49
60
50
61
- name : Restore cached dependencies
@@ -54,32 +65,32 @@ jobs:
54
65
key : ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
55
66
56
67
with :
57
- path : ${{ steps.setup.outputs.cabal-store }}
68
+ path : ${{ steps.setup.outputs.stack-root }}
58
69
key : ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
59
70
restore-keys : ${{ env.key }}-
60
71
61
72
- name : Install dependencies
62
- run : cabal build all --only-dependencies
73
+ run : stack build --only-dependencies
63
74
64
75
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
65
76
- name : Save cached dependencies
66
77
uses : actions/cache/save@v3
67
78
# Caches are immutable, trying to save with the same key would error.
68
79
if : ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }}
69
80
with :
70
- path : ${{ steps.setup.outputs.cabal-store }}
81
+ path : ${{ steps.setup.outputs.stack-root }}
71
82
key : ${{ steps.cache.outputs.cache-primary-key }}
72
83
73
84
- name : Build
74
- run : cabal build all
85
+ run : stack build
75
86
76
87
- name : Run tests
77
- run : cabal test all
88
+ run : stack test
78
89
79
90
- name : Check cabal file
80
- run : cabal check
91
+ run : stack check
81
92
continue-on-error : true
82
93
83
94
- name : Build documentation
84
- run : cabal haddock all
95
+ run : stack haddock
85
96
...
0 commit comments