4
4
push :
5
5
branches :
6
6
- main
7
+ schedule :
8
+ - cron : ' 0 0 * * *'
7
9
workflow_call :
8
10
9
11
jobs :
10
12
build_and_test :
11
- strategy :
12
- matrix :
13
- stack_yaml :
14
- - stack-ghc-8.10.yaml
15
- - stack-ghc-9.0.yaml
16
- # - stack-ghc-9.2.yaml
17
- - stack-ghc-9.4.yaml
18
- - stack-persistent-2.13.yaml
19
- - stack-persistent-2.14.yaml
20
- include :
21
- - stack_yaml : stack.yaml
22
- latest : true
23
-
24
- name : build_and_test (${{ matrix.stack_yaml }})
25
- runs-on : ubuntu-22.04
13
+ name : build_and_test
14
+ runs-on : ubuntu-latest
26
15
services :
27
16
postgres :
28
17
image : postgres:13.1
@@ -32,82 +21,178 @@ jobs:
32
21
ports :
33
22
- 5432:5432
34
23
env :
35
- STACK_YAML : ${{ matrix.stack_yaml }}
36
24
TEST_POSTGRESQL : 1
37
25
38
26
steps :
39
- - uses : actions/checkout@v3
40
-
41
- - uses : actions/cache@v3
27
+ -
28
+ uses : actions/checkout@v3
29
+ -
30
+ uses : actions/cache@v3
42
31
with :
43
32
path : ~/.stack
44
- key : ${{ runner.os }}-stack-cache-${{ hashFiles(matrix.stack_yaml, 'package.yaml') }}
45
- - run : stack test --coverage
46
-
47
- - name : Check that files are unmodified
33
+ key : ${{ runner.os }}-stack-cache-${{ hashFiles('stack.yaml', 'package.yaml') }}
34
+ -
35
+ run : stack test --coverage
36
+ -
37
+ name : Check that files are unmodified
48
38
run : git diff --exit-code
49
-
50
- # upload coverage data
51
- - name : Generate coverage data
52
- run : stack install hpc-lcov && hpc-lcov
53
- - uses : codecov/codecov-action@v3
39
+ -
40
+ name : Check for any outdated packages
41
+ run : cabal outdated --exit-code
42
+ -
43
+ name : Generate coverage data
44
+ run : |
45
+ HPC_LCOV_VERSION=1.1.1
46
+ curl -fsSL \
47
+ "https://github.com/brandonchinn178/hpc-lcov/releases/download/v${HPC_LCOV_VERSION}/hpc-lcov-${HPC_LCOV_VERSION}-linux-x86_64" \
48
+ -o /usr/local/bin/hpc-lcov
49
+ chmod +x /usr/local/bin/hpc-lcov
50
+ hpc-lcov
51
+ -
52
+ uses : codecov/codecov-action@v3
54
53
with :
55
54
files : lcov.info
56
- if : ${{ matrix.latest }}
55
+
56
+ compat_test :
57
+ strategy :
58
+ matrix :
59
+ ghc_version :
60
+ - ' 8.10'
61
+ - ' 9.0'
62
+ - ' 9.4'
63
+ - ' 9.6'
64
+ persistent_version :
65
+ - ' 2.13'
66
+ - ' 2.14'
67
+ include :
68
+ - ghc_version : ' 8.10.1'
69
+ persistent_version : ' 2.13'
70
+ oldest : true
71
+ exclude :
72
+ - ghc_version : ' 9.4'
73
+ persistent_version : ' 2.13'
74
+ - ghc_version : ' 9.6'
75
+ persistent_version : ' 2.13'
76
+
77
+ name : compat_test (ghc-${{ matrix.ghc_version }}, persistent-${{ matrix.persistent_version }})
78
+ runs-on : ubuntu-latest
79
+
80
+ steps :
81
+ -
82
+ uses : actions/checkout@v3
83
+ -
84
+ id : setup
85
+ name : Set up GHC ${{ matrix.ghc_version }}
86
+ uses : haskell-actions/setup@v2
87
+ with :
88
+ ghc-version : ${{ matrix.ghc_version }}
89
+ -
90
+ name : Configure the build
91
+ run :
92
+ cabal configure
93
+ --enable-test
94
+ --test-options='--color=always'
95
+ --test-show-details=streaming
96
+ --constraint='persistent ^>= ${{ matrix.persistent_version }}'
97
+ --constraint='persistent < 2.13.3.4 || >= 2.14.0.2'
98
+ -
99
+ # TODO: remove
100
+ if : ${{ matrix.ghc_version == '9.6' }}
101
+ run :
102
+ cabal configure
103
+ --enable-append
104
+ --allow-newer='persistent:template-haskell'
105
+ --allow-newer='unliftio-pool:transformers'
106
+ --allow-newer='explainable-predicates:base'
107
+ --allow-newer='explainable-predicates:template-haskell'
108
+ -
109
+ if : ${{ matrix.oldest }}
110
+ name : Use oldest dependencies
111
+ run :
112
+ cabal configure
113
+ --enable-append --prefer-oldest
114
+ --constraint 'conduit >= 1.3.1'
115
+ --constraint 'silently >= 0.0.3'
116
+ --constraint 'string-conversions >= 0.4'
117
+ --constraint 'unix-time >= 0.3.8'
118
+ -
119
+ name : Get build plan
120
+ run : cabal build --dry-run
121
+ -
122
+ name : Get current month to clear cache
123
+ run : echo "CURR_MONTH=$(date +%B)" | tee -a "$GITHUB_ENV"
124
+ -
125
+ uses : actions/cache@v3
126
+ with :
127
+ path : ${{ steps.setup.outputs.cabal-store }}
128
+ key : ${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-${{ hashFiles('**/plan.json') }}
129
+ restore-keys : |
130
+ ${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-
131
+ -
132
+ name : Build + Test
133
+ run : cabal test
57
134
58
135
lint :
59
136
runs-on : ubuntu-latest
60
137
env :
61
138
HLINT_VERSION : ' 3.5'
62
- FOURMOLU_VERSION : ' 0.10.1 .0'
139
+ FOURMOLU_VERSION : ' 0.13.0 .0'
63
140
steps :
64
- - uses : actions/checkout@v3
65
-
66
- - name : Install hlint
141
+ -
142
+ uses : actions/checkout@v3
143
+ -
144
+ name : Install hlint
67
145
run : |
68
146
HLINT_ARCHIVE="hlint-${HLINT_VERSION}-x86_64-linux.tar.gz"
69
147
curl -sSLO "https://github.com/ndmitchell/hlint/releases/download/v${HLINT_VERSION}/${HLINT_ARCHIVE}"
70
148
tar xzf "${HLINT_ARCHIVE}" -C /usr/local/bin/ --strip-components=1 "hlint-${HLINT_VERSION}/hlint"
71
-
72
- - name : Install fourmolu
149
+ -
150
+ name : Install fourmolu
73
151
run : |
74
152
curl -sSL \
75
153
"https://github.com/fourmolu/fourmolu/releases/download/v${FOURMOLU_VERSION}/fourmolu-${FOURMOLU_VERSION}-linux-x86_64" \
76
154
-o /usr/local/bin/fourmolu
77
155
chmod +x /usr/local/bin/fourmolu
78
-
79
- - run : pip install pre-commit
80
- - run : pre-commit run --all-files -v --show-diff-on-failure
156
+ -
157
+ run : pip install pre-commit
158
+ -
159
+ run : pre-commit run --all-files -v --show-diff-on-failure
81
160
env :
82
161
SKIP : no-commit-to-branch
83
162
84
163
check_sdist :
85
164
runs-on : ubuntu-latest
86
165
steps :
87
- - uses : actions/checkout@v3
88
- - uses : actions/cache@v3
166
+ -
167
+ uses : actions/checkout@v3
168
+ -
169
+ uses : actions/cache@v3
89
170
with :
90
171
path : ~/.stack
91
172
key : ${{ runner.os }}-check_sdist-${{ hashFiles('stack.yaml', 'package.yaml') }}
92
-
93
- - name : Strip unreleased section from CHANGELOG
173
+ -
174
+ name : Strip unreleased section from CHANGELOG
94
175
run : sed -i -n '/^# Unreleased/d; /^#/,$p' CHANGELOG.md
95
-
96
- - name : Create sdist bundle
176
+ -
177
+ name : Create sdist bundle
97
178
run : stack sdist --test-tarball --tar-dir .
98
-
99
- - uses : actions/upload-artifact@v3
179
+ -
180
+ uses : actions/upload-artifact@v3
100
181
with :
101
182
name : persistent-mtl-sdist
102
183
path : persistent-mtl-*.tar.gz
103
184
104
185
check_codegen :
105
186
runs-on : ubuntu-latest
106
187
steps :
107
- - uses : actions/checkout@v3
108
- - uses : actions/cache@v3
188
+ -
189
+ uses : actions/checkout@v3
190
+ -
191
+ uses : actions/cache@v3
109
192
with :
110
193
path : ~/.stack
111
194
key : ${{ runner.os }}-check_codegen-${{ hashFiles('stack.yaml') }}
112
- - run : scripts/generate/run.sh
113
- - run : git diff --exit-code *.hs
195
+ -
196
+ run : scripts/generate/run.sh
197
+ -
198
+ run : git diff --exit-code *.hs
0 commit comments