4
4
push :
5
5
branches : [ "master" ]
6
6
pull_request :
7
+ merge_group :
8
+
9
+ concurrency :
10
+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11
+ cancel-in-progress : true
7
12
8
13
permissions :
9
14
contents : read
10
15
11
16
jobs :
17
+ # Build and test
12
18
build :
13
-
14
19
runs-on : ${{ matrix.os }}
15
20
16
21
strategy :
17
22
fail-fast : false
18
23
matrix :
19
- ghc : ["8.10.7", "9.2.5 "]
20
- cabal : ["3.8.1 .0"]
24
+ ghc : ["8.10.7", "9.2.8", "9.4.8", "9.6.4", "9.8.2 "]
25
+ cabal : ["3.10.3 .0"]
21
26
os : [ubuntu-latest, windows-latest, macOS-latest]
22
27
23
28
steps :
@@ -34,12 +39,11 @@ jobs:
34
39
- name : " MacOS: Install system dependencies (brew)"
35
40
if : runner.os == 'macOS'
36
41
run : |
42
+ brew update
37
43
brew install pkg-config lmdb
38
- cp ./.github/workflows/lmdb.pc /usr/local/lib/pkgconfig
39
44
40
45
- name : " Windows: Install system dependencies via pacman (msys2)"
41
46
if : runner.os == 'Windows'
42
- shell : pwsh
43
47
run : |
44
48
ghcup run -- pacman --noconfirm -S `
45
49
mingw-w64-x86_64-pkg-config `
@@ -53,48 +57,53 @@ jobs:
53
57
54
58
- name : Setup Haskell
55
59
id : setup-haskell
56
- uses : haskell/ actions/setup@v2
60
+ uses : haskell- actions/setup@v2
57
61
with :
58
62
ghc-version : ${{ matrix.ghc }}
59
63
cabal-version : ${{ matrix.cabal }}
60
- cabal-update : false
64
+ cabal-update : true
61
65
62
- - name : " Linux/MacOS: Configure cabal.project.local"
63
- if : runner.os != 'Windows'
64
- run : |
65
- cp .github/workflows/cabal.project.local.Linux cabal.project.local
66
-
67
- - name : " Windows: configure cabal.project.local"
68
- if : runner.os == 'Windows'
66
+ - name : Configure the build
69
67
run : |
70
- cp .github/workflows/cabal.project.local.Windows cabal.project.local
71
-
72
- - name : Cabal update
73
- run : cabal update
68
+ cabal configure --enable-tests --enable-benchmark --ghc-options="-Werror" --ghc-options="-fno-ignore-asserts"
69
+ cat cabal.project.local
74
70
75
71
- name : Record cabal dependencies
76
72
id : record-deps
77
73
run : |
78
74
cabal build all --dry-run
79
75
80
- - name : Cache cabal store
81
- uses : actions/cache@v3
76
+ - name : " Restore cache"
77
+ uses : actions/cache/restore@v4
78
+ id : restore-cabal-cache
82
79
env :
83
- cache-name : cache-cabal
80
+ cache-name : cache-cabal-build
84
81
with :
85
82
path : ${{ steps.setup-haskell.outputs.cabal-store }}
86
- key : ${{ runner.os }}-${{ matrix.ghc }}-build- ${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
83
+ key : ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
87
84
restore-keys : |
88
- ${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-
89
- ${{ runner.os }}-${{ matrix.ghc }}-build-
90
- ${{ runner.os }}-${{ matrix.ghc }}-
91
- ${{ runner.os }}-
85
+ ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
86
+ ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-
87
+ ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-
92
88
93
89
- name : Install cabal dependencies
90
+ id : build-dependencies
94
91
run : cabal build --only-dependencies --enable-tests --enable-benchmarks all
95
92
93
+ - name : " Save cache"
94
+ uses : actions/cache/save@v4
95
+ id : save-cabal-cache
96
+ # Note: cache-hit will be set to true only when cache hit occurs for the
97
+ # exact key match. For a partial key match via restore-keys or a cache
98
+ # miss, it will be set to false.
99
+ if : steps.build-dependencies.outcome == 'success' && steps.restore-cabal-cache.outputs.cache-hit != 'true'
100
+ with :
101
+ path : ${{ steps.setup-haskell.outputs.cabal-store }}
102
+ key : ${{ steps.restore-cabal-cache.outputs.cache-primary-key }}
103
+
96
104
- name : Build
97
- run : cabal build --enable-tests --enable-benchmarks all
105
+ run : cabal build all
98
106
99
107
- name : Run tests
100
- run : cabal test all
108
+ run : |
109
+ cabal test -j1 --test-show-details=direct all
0 commit comments