-
Notifications
You must be signed in to change notification settings - Fork 17
329 lines (281 loc) · 11.3 KB
/
Copy pathci.yml
File metadata and controls
329 lines (281 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
name: CI
on:
push:
branches:
- "main"
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
# Set the default shell on all platforms.
defaults:
run:
shell: sh
# Set the default GHC and Cabal versions.
env:
DEFAULT_GHC_VERSION: "9.6"
DEFAULT_CABAL_VERSION: "3.12"
DEFAULT_CABAL_PROJECT_FILE: "cabal.project.debug"
jobs:
################################################################################
# Build
################################################################################
build:
name: |
${{ matrix.name
|| format(
'Build on {0}{1}{2}',
startsWith(matrix.os, 'ubuntu-') && 'Linux' || startsWith(matrix.os, 'macOS-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows',
matrix.ghc-version && format(' with GHC {0}', matrix.ghc-version),
matrix.cabal-version && format(' and Cabal {0}', matrix.cabal-version)
)
}}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v5
- name: 🗄️ Print Job info
run: |
echo 'matrix.os: ${{ matrix.os }}'
echo 'matrix.ghc-version: ${{ matrix.ghc-version || env.DEFAULT_GHC_VERSION }}'
echo 'matrix.cabal-version: ${{ matrix.os || env.DEFAULT_CABAL_VERSION }}'
echo 'matrix.cabal-flags: ${{ matrix.cabal-flags }}'
echo 'matrix.cabal-project-file: ${{ matrix.cabal-project-file || env.DEFAULT_CABAL_PROJECT_FILE }}'
echo 'toJSON(matrix): ${{ toJSON(matrix) }}'
- name: 🗄️ Print CPU info
uses: ./.github/actions/print-cpu-info
- name: 🛠️ Setup Haskell
id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc-version || env.DEFAULT_GHC_VERSION }}
cabal-version: ${{ matrix.cabal-version || env.DEFAULT_CABAL_VERSION }}
- name: 🛠️ Setup system dependencies (Linux)
if: ${{ runner.os == 'Linux' }}
run: sudo apt-get update && sudo apt-get -y install liburing-dev librocksdb-dev
env:
DEBIAN_FRONTEND: "noninteractive"
- name: 🛠️ Configure
run: |
cabal configure \
--project-file="${{ matrix.cabal-project-file || env.DEFAULT_CABAL_PROJECT_FILE }}" \
--enable-tests \
--enable-benchmarks \
--disable-documentation \
--ghc-options="-Werror" \
--flag="${{ matrix.cabal-flags }}"
cat "${{ matrix.cabal-project-file || env.DEFAULT_CABAL_PROJECT_FILE }}.local"
- name: 💾 Generate Cabal plan
run: |
cabal build all \
--project-file="${{ matrix.cabal-project-file || env.DEFAULT_CABAL_PROJECT_FILE }}" \
--dry-run
- name: 💾 Restore Cabal dependencies
uses: actions/cache/restore@v4
if: ${{ !env.ACT }}
id: cache-cabal
env:
key: build-${{ runner.os }}-ghc-${{ steps.setup-haskell.outputs.ghc-version }}-cabal-${{ steps.setup-haskell.outputs.cabal-version }}
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('dist-newstyle/cache/plan.json') }}
restore-keys: ${{ env.key }}-
- name: 🛠️ Build Cabal dependencies
run: |
cabal build all \
--project-file="${{ matrix.cabal-project-file || env.DEFAULT_CABAL_PROJECT_FILE }}" \
--only-dependencies
- name: 💾 Save Cabal dependencies
uses: actions/cache/save@v4
if: ${{ !env.ACT && steps.cache-cabal.outputs.cache-hit != 'true' }}
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ steps.cache-cabal.outputs.cache-primary-key }}
- name: 🏗️ Build
run: |
cabal build all \
--project-file="${{ matrix.cabal-project-file || env.DEFAULT_CABAL_PROJECT_FILE }}"
- name: 🧪 Test
id: test
run: |
cabal test all \
-j1 \
--test-show-details=direct \
--project-file="${{ matrix.cabal-project-file || env.DEFAULT_CABAL_PROJECT_FILE }}"
env:
TASTY_TIMEOUT: "5m"
# Golden test output is not printed to the screen, so if a golden test fails
# then it is not clear from the logs why the test fails. Uploading the
# directory containing the golden files after running the goldens tests
# allows us to diff the expected and actual golden file contents.
- name: 📦 Upload golden files
if: ${{ steps.test.outcome != 'success' && always() }}
uses: actions/upload-artifact@v4
with:
name: golden-files-${{ runner.os }}-ghc-${{ steps.setup-haskell.outputs.ghc-version }}-cabal-${{ steps.setup-haskell.outputs.cabal-version }}-plan-${{ hashFiles('dist-newstyle/cache/plan.json') }}
path: lsm-tree/test/golden-file-data
if-no-files-found: error
retention-days: 1
- name: 🛠️ Setup cabal-docspec (Linux)
if: ${{ runner.os == 'Linux' }}
uses: ./.github/actions/setup-cabal-docspec
- name: 🧪 Test with cabal-docspec (Linux)
if: ${{ runner.os == 'Linux' }}
run: ./scripts/test-cabal-docspec.sh
env:
SKIP_CABAL_BUILD: true
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
ghc-version: ["9.2", "9.4", "9.6", "9.8", "9.10", "9.12"]
cabal-version: ["3.12"]
# The inclusion of these default keys in the matrix ensures that any
# entry under include that assigns these keys creates a new matrix entry
cabal-flags: [""]
cabal-project-file: [""]
include:
# Include builds for various special cases
- name: "Build with +serialblockio"
os: "ubuntu-latest"
cabal-flags: "+serialblockio"
- name: "Build with cabal.project.release"
os: "ubuntu-latest"
cabal-project-file: "cabal.project.release"
################################################################################
# Lint with actionlint
################################################################################
lint-actionlint:
name: Lint with actionlint
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v5
- name: 🛠️ Setup actionlint
uses: ./.github/actions/setup-actionlint
with:
actionlint-version: "1.7.7"
- name: 🎗️ Lint with actionlint
run: ./scripts/lint-actionlint.sh
################################################################################
# Lint with cabal-fmt
################################################################################
lint-cabal-fmt:
name: Lint with cabal-fmt
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v5
- name: 🛠️ Setup cabal-fmt
uses: ./.github/actions/setup-cabal-fmt
with:
cabal-fmt-version: "0.1.12"
ghc-version: ${{ env.DEFAULT_GHC_VERSION }}
cabal-version: ${{ env.DEFAULT_CABAL_VERSION }}
# The index-state is fixed to enable caching and ensure that the version
# regardless of the current state of Hackage head.
# If you want a newer version of cabal-fmt, use a more recent time.
hackage-index-state: "2025-05-22T00:00:00Z"
- name: 🎗️ Lint with cabal-fmt
run: ./scripts/format-cabal-fmt.sh && git diff --exit-code
################################################################################
# Lint with cabal
################################################################################
lint-cabal:
name: Lint with cabal
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v5
- name: 🛠️ Setup Haskell
id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ env.DEFAULT_GHC_VERSION }}
cabal-version: ${{ env.DEFAULT_CABAL_VERSION }}
cabal-update: false
- name: 🎗️ Lint with cabal
run: ./scripts/lint-cabal.sh
################################################################################
# Lint with stylish-haskell
################################################################################
lint-stylish-haskell:
name: Lint with stylish-haskell
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v5
- name: 🛠️ Setup stylish-haskell
uses: ./.github/actions/setup-stylish-haskell
with:
stylish-haskell-version: "0.15.1.0"
ghc-version: "9.10"
cabal-version: ${{ env.DEFAULT_CABAL_VERSION }}
# The index-state is fixed to enable caching and ensure that the version
# regardless of the current state of Hackage head.
# If you want a newer version of stylish-haskell, use a more recent time.
hackage-index-state: "2025-05-21T09:13:36Z"
- name: 🎗️ Lint with stylish-haskell
run: ./scripts/format-stylish-haskell.sh && git diff --exit-code
################################################################################
# Lint for missing IO specialisations
################################################################################
lint-io-specialisations:
name: Lint for missing IO specialisations
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v5
- name: 🎗️ Lint for missing IO specialisations
run: ./scripts/lint-io-specialisations.sh
################################################################################
# Lint with generate-readme
################################################################################
lint-generate-readme:
name: Lint with generate-readme
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v5
- name: 🛠️ Generate README.md
uses: ./.github/actions/generate-readme
with:
ghc-version: ${{ env.DEFAULT_GHC_VERSION }}
cabal-version: ${{ env.DEFAULT_CABAL_VERSION }}
hackage-index-state: "2025-05-22T00:00:00Z"
- name: 🎗️ Lint with generate-readme
run: git diff --exit-code
################################################################################
# Lint with HLint
################################################################################
lint-hlint:
name: Lint with HLint
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v5
- name: 🛠️ Setup HLint
uses: haskell-actions/hlint-setup@v2
with:
version: "3.10"
- name: 🎗️ Lint with HLint
run: ./scripts/lint-hlint.sh
#############################################################################
# Lint with ShellCheck
#############################################################################
lint-shellcheck:
name: "Lint with ShellCheck"
runs-on: "ubuntu-latest"
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v5
- name: 🛠️ Install ShellCheck
uses: ./.github/actions/setup-shellcheck
with:
shellcheck-version: "0.10.0"
- name: 🎗️ Lint with ShellCheck
run: ./scripts/lint-shellcheck.sh