-
Notifications
You must be signed in to change notification settings - Fork 106
294 lines (276 loc) · 18.1 KB
/
haskell.yml
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
name: Haskell CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# INFO: The following configuration block ensures that only one build runs per branch,
# which may be desirable for projects with a costly build process.
# Remove this block from the CI workflow to let each CI job run to completion.
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
# INFO: The caching strategy was created following this post https://github.com/commercialhaskell/stack/issues/5754#issuecomment-1696156869
env:
#-- increment this if you think cache of GHC installation needs cold rebuild
MANUAL_CACHE_RESET_COMPILER: v0
#-- increment this if you think cache of .stack-work needs cold rebuild
MANUAL_CACHE_RESET_PRODUCTS: v0
#-- increment this to force-rebuild the cache of dependency packages
MANUAL_CACHE_RESET_TESTDEPS: v0
#-- should never be needed, as stackage snapshots are immutable
# MANUAL_CACHE_RESET_SNAPSHOT: v0
jobs:
build-haskell:
runs-on: ubuntu-latest
strategy:
matrix:
versions:
- { lts: "22.27", ghc: "9.6.5" }
steps:
- name: Cache GHC installation
uses: actions/cache@v4
id: ghcup
env:
MANUAL_RESET: ${{ env.MANUAL_CACHE_RESET_COMPILER }}
with:
path: |
~/.ghcup/bin/*
~/.ghcup/cache/*
~/.ghcup/config.yaml
~/.ghcup/ghc/${{ matrix.versions.ghc }}
key: CI-ghcup-${{ env.MANUAL_RESET }}--${{ matrix.versions.ghc }}
- uses: haskell-actions/setup@v2
if: steps.ghcup.outputs.cache-hit != 'true'
with:
ghc-version: ${{ matrix.versions.ghc }}
enable-stack: true
stack-version: 'latest'
cabal-update: false
- name: Cache Pantry (Stackage package index)
id: pantry
uses: actions/cache@v4
with:
path: ~/.stack/pantry
key: CI-pantry-${{ matrix.versions.lts }}
- name: Recompute Stackage package index
if: steps.pantry.outputs.cache-hit != 'true'
run: stack update # populates ~/.stack/pantry
- name: Cache Haskell dependencies
uses: actions/cache@v4
env:
MANUAL_RESET: ${{ env.MANUAL_CACHE_RESET_TESTDEPS }}
with:
#-- NOTE no, shouldn't cache the entire ~/.stack -- that'd be bad. just these 2:
path: |
~/.stack/stack.sqlite3
~/.stack/snapshots
#-- NOTE the caching key structure:
#-- * fixed ID string -- to indicate scope & purpose, descriptive;
#-- * manual reset -- on top level, stupid simple manual override;
#-- * resolver version -- helps maintain sleek size of the cache;
#-- * lockfile hashsum -- as invalidation trigger of the correct granularity.
#-- Since this cache only stores built *dependency packages* (not project code!),
#-- we should invalidate/reupload it on each change to the dependency forest (≈lockfile).
#--
#-- All this decides when cache gets REBUILT (invalidated & recreated):
key: CI-testdeps-${{ env.MANUAL_RESET }}--${{ matrix.versions.lts }}--${{ hashFiles('stack-${{ matrix.versions.ghc }}.yaml.lock') }}
#-- All this adds fallbacks to UNPACK stale cache copies, prefix-matched:
restore-keys: |
CI-testdeps-${{ env.MANUAL_RESET }}--${{ matrix.versions.lts }}--
CI-testdeps-${{ env.MANUAL_RESET }}--
- name: Clone project
uses: actions/checkout@v2
- name: Cache per-branch Haskell project buildstate
uses: actions/cache@v4
env:
MANUAL_RESET: ${{ env.MANUAL_CACHE_RESET_PRODUCTS }}
with:
#-- I wasn't able to find the non absolute path and I decided to set the full path. This is britle
#-- The list of .stack-work folders needs to be recreated periodically with: find . -name .stack-work
path: |
${{ github.workspace }}/.stack-work
${{ github.workspace }}/examples/.stack-work
${{ github.workspace }}/gen/.stack-work
${{ github.workspace }}/lib/gogol/.stack-work
${{ github.workspace }}/lib/services/gogol-abusiveexperiencereport/.stack-work
${{ github.workspace }}/lib/services/gogol-analytics/.stack-work
${{ github.workspace }}/lib/services/gogol-speech/.stack-work
${{ github.workspace }}/lib/services/gogol-videointelligence/.stack-work
${{ github.workspace }}/lib/services/gogol-androidmanagement/.stack-work
${{ github.workspace }}/lib/services/gogol-bigquerydatatransfer/.stack-work
${{ github.workspace }}/lib/services/gogol-slides/.stack-work
${{ github.workspace }}/lib/services/gogol-webmaster-tools/.stack-work
${{ github.workspace }}/lib/services/gogol-play-moviespartner/.stack-work
${{ github.workspace }}/lib/services/gogol-youtube-reporting/.stack-work
${{ github.workspace }}/lib/services/gogol-urlshortener/.stack-work
${{ github.workspace }}/lib/services/gogol-compute/.stack-work
${{ github.workspace }}/lib/services/gogol-replicapool-updater/.stack-work
${{ github.workspace }}/lib/services/gogol-storage-transfer/.stack-work
${{ github.workspace }}/lib/services/gogol-servicenetworking/.stack-work
${{ github.workspace }}/lib/services/gogol-deploymentmanager/.stack-work
${{ github.workspace }}/lib/services/gogol-groups-migration/.stack-work
${{ github.workspace }}/lib/services/gogol-streetviewpublish/.stack-work
${{ github.workspace }}/lib/services/gogol-adexchange-seller/.stack-work
${{ github.workspace }}/lib/services/gogol-serviceuser/.stack-work
${{ github.workspace }}/lib/services/gogol-poly/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-calendar/.stack-work
${{ github.workspace }}/lib/services/gogol-adexchange-buyer/.stack-work
${{ github.workspace }}/lib/services/gogol-games-configuration/.stack-work
${{ github.workspace }}/lib/services/gogol-android-publisher/.stack-work
${{ github.workspace }}/lib/services/gogol-resourcemanager/.stack-work
${{ github.workspace }}/lib/services/gogol-analyticsreporting/.stack-work
${{ github.workspace }}/lib/services/gogol-file/.stack-work
${{ github.workspace }}/lib/services/gogol-dlp/.stack-work
${{ github.workspace }}/lib/services/gogol-storage/.stack-work
${{ github.workspace }}/lib/services/gogol-plus/.stack-work
${{ github.workspace }}/lib/services/gogol-fonts/.stack-work
${{ github.workspace }}/lib/services/gogol-vision/.stack-work
${{ github.workspace }}/lib/services/gogol-siteverification/.stack-work
${{ github.workspace }}/lib/services/gogol-firebase-rules/.stack-work
${{ github.workspace }}/lib/services/gogol-youtube-analytics/.stack-work
${{ github.workspace }}/lib/services/gogol-firebasehosting/.stack-work
${{ github.workspace }}/lib/services/gogol-ml/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudprofiler/.stack-work
${{ github.workspace }}/lib/services/gogol-clouderrorreporting/.stack-work
${{ github.workspace }}/lib/services/gogol-composer/.stack-work
${{ github.workspace }}/lib/services/gogol-replicapool/.stack-work
${{ github.workspace }}/lib/services/gogol-healthcare/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudasset/.stack-work
${{ github.workspace }}/lib/services/gogol-accessapproval/.stack-work
${{ github.workspace }}/lib/services/gogol-appstate/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudidentity/.stack-work
${{ github.workspace }}/lib/services/gogol-partners/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudsearch/.stack-work
${{ github.workspace }}/lib/services/gogol-qpxexpress/.stack-work
${{ github.workspace }}/lib/services/gogol-servicecontrol/.stack-work
${{ github.workspace }}/lib/services/gogol-indexing/.stack-work
${{ github.workspace }}/lib/services/gogol-spectrum/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-tasks/.stack-work
${{ github.workspace }}/lib/services/gogol-doubleclick-bids/.stack-work
${{ github.workspace }}/lib/services/gogol-language/.stack-work
${{ github.workspace }}/lib/services/gogol-adexchangebuyer2/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudtrace/.stack-work
${{ github.workspace }}/lib/services/gogol-sourcerepo/.stack-work
${{ github.workspace }}/lib/services/gogol-tracing/.stack-work
${{ github.workspace }}/lib/services/gogol-discovery/.stack-work
${{ github.workspace }}/lib/services/gogol-servicemanagement/.stack-work
${{ github.workspace }}/lib/services/gogol-dataproc/.stack-work
${{ github.workspace }}/lib/services/gogol-firebaseremoteconfig/.stack-work
${{ github.workspace }}/lib/services/gogol-firebase-dynamiclinks/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-licensing/.stack-work
${{ github.workspace }}/lib/services/gogol-admin-datatransfer/.stack-work
${{ github.workspace }}/lib/services/gogol-iamcredentials/.stack-work
${{ github.workspace }}/lib/services/gogol-billing/.stack-work
${{ github.workspace }}/lib/services/gogol-script/.stack-work
${{ github.workspace }}/lib/services/gogol-run/.stack-work
${{ github.workspace }}/lib/services/gogol-translate/.stack-work
${{ github.workspace }}/lib/services/gogol-datafusion/.stack-work
${{ github.workspace }}/lib/services/gogol-dfareporting/.stack-work
${{ github.workspace }}/lib/services/gogol-serviceconsumermanagement/.stack-work
${{ github.workspace }}/lib/services/gogol-bigquery/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudfunctions/.stack-work
${{ github.workspace }}/lib/services/gogol-searchconsole/.stack-work
${{ github.workspace }}/lib/services/gogol-monitoring/.stack-work
${{ github.workspace }}/lib/services/gogol-oslogin/.stack-work
${{ github.workspace }}/lib/services/gogol-testing/.stack-work
${{ github.workspace }}/lib/services/gogol-customsearch/.stack-work
${{ github.workspace }}/lib/services/gogol-binaryauthorization/.stack-work
${{ github.workspace }}/lib/services/gogol-drive/.stack-work
${{ github.workspace }}/lib/services/gogol-proximitybeacon/.stack-work
${{ github.workspace }}/lib/services/gogol-gmail/.stack-work
${{ github.workspace }}/lib/services/gogol-plus-domains/.stack-work
${{ github.workspace }}/lib/services/gogol-securitycenter/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudprivatecatalog/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudiot/.stack-work
${{ github.workspace }}/lib/services/gogol-android-enterprise/.stack-work
${{ github.workspace }}/lib/services/gogol-jobs/.stack-work
${{ github.workspace }}/lib/services/gogol-identity-toolkit/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-activity/.stack-work
${{ github.workspace }}/lib/services/gogol-groups-settings/.stack-work
${{ github.workspace }}/lib/services/gogol-blogger/.stack-work
${{ github.workspace }}/lib/services/gogol-pubsub/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudprivatecatalogproducer/.stack-work
${{ github.workspace }}/lib/services/gogol-books/.stack-work
${{ github.workspace }}/lib/services/gogol-adsense-host/.stack-work
${{ github.workspace }}/lib/services/gogol-dialogflow/.stack-work
${{ github.workspace }}/lib/services/gogol-civicinfo/.stack-work
${{ github.workspace }}/lib/services/gogol-youtube/.stack-work
${{ github.workspace }}/lib/services/gogol-fitness/.stack-work
${{ github.workspace }}/lib/services/gogol-servicebroker/.stack-work
${{ github.workspace }}/lib/services/gogol-alertcenter/.stack-work
${{ github.workspace }}/lib/services/gogol-fusiontables/.stack-work
${{ github.workspace }}/lib/services/gogol-mirror/.stack-work
${{ github.workspace }}/lib/services/gogol-adsense/.stack-work
${{ github.workspace }}/lib/services/gogol-consumersurveys/.stack-work
${{ github.workspace }}/lib/services/gogol-acceleratedmobilepageurl/.stack-work
${{ github.workspace }}/lib/services/gogol-firestore/.stack-work
${{ github.workspace }}/lib/services/gogol-websecurityscanner/.stack-work
${{ github.workspace }}/lib/services/gogol-commentanalyzer/.stack-work
${{ github.workspace }}/lib/services/gogol-sheets/.stack-work
${{ github.workspace }}/lib/services/gogol-logging/.stack-work
${{ github.workspace }}/lib/services/gogol-safebrowsing/.stack-work
${{ github.workspace }}/lib/services/gogol-digitalassetlinks/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudkms/.stack-work
${{ github.workspace }}/lib/services/gogol-apps-reseller/.stack-work
${{ github.workspace }}/lib/services/gogol-adexperiencereport/.stack-work
${{ github.workspace }}/lib/services/gogol-oauth2/.stack-work
${{ github.workspace }}/lib/services/gogol-dns/.stack-work
${{ github.workspace }}/lib/services/gogol-docs/.stack-work
${{ github.workspace }}/lib/services/gogol-serviceusage/.stack-work
${{ github.workspace }}/lib/services/gogol-iap/.stack-work
${{ github.workspace }}/lib/services/gogol-doubleclick-search/.stack-work
${{ github.workspace }}/lib/services/gogol-admin-reports/.stack-work
${{ github.workspace }}/lib/services/gogol-toolresults/.stack-work
${{ github.workspace }}/lib/services/gogol-factchecktools/.stack-work
${{ github.workspace }}/lib/services/gogol-playcustomapp/.stack-work
${{ github.workspace }}/lib/services/gogol-driveactivity/.stack-work
${{ github.workspace }}/lib/services/gogol-containeranalysis/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudshell/.stack-work
${{ github.workspace }}/lib/services/gogol-manufacturers/.stack-work
${{ github.workspace }}/lib/services/gogol-people/.stack-work
${{ github.workspace }}/lib/services/gogol-texttospeech/.stack-work
${{ github.workspace }}/lib/services/gogol-admin-directory/.stack-work
${{ github.workspace }}/lib/services/gogol-games-management/.stack-work
${{ github.workspace }}/lib/services/gogol-bigtableadmin/.stack-work
${{ github.workspace }}/lib/services/gogol-debugger/.stack-work
${{ github.workspace }}/lib/services/gogol-libraryagent/.stack-work
${{ github.workspace }}/lib/services/gogol-redis/.stack-work
${{ github.workspace }}/lib/services/gogol-remotebuildexecution/.stack-work
${{ github.workspace }}/lib/services/gogol-container/.stack-work
${{ github.workspace }}/lib/services/gogol-pagespeed/.stack-work
${{ github.workspace }}/lib/services/gogol-shopping-content/.stack-work
${{ github.workspace }}/lib/services/gogol-datastore/.stack-work
${{ github.workspace }}/lib/services/gogol-iam/.stack-work
${{ github.workspace }}/lib/services/gogol-appengine/.stack-work
${{ github.workspace }}/lib/services/gogol-spanner/.stack-work
${{ github.workspace }}/lib/services/gogol-kgsearch/.stack-work
${{ github.workspace }}/lib/services/gogol-surveys/.stack-work
${{ github.workspace }}/lib/services/gogol-vault/.stack-work
${{ github.workspace }}/lib/services/gogol-runtimeconfig/.stack-work
${{ github.workspace }}/lib/services/gogol-sqladmin/.stack-work
${{ github.workspace }}/lib/services/gogol-androiddeviceprovisioning/.stack-work
${{ github.workspace }}/lib/services/gogol-containerbuilder/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudscheduler/.stack-work
${{ github.workspace }}/lib/services/gogol-cloudtasks/.stack-work
${{ github.workspace }}/lib/services/gogol-accesscontextmanager/.stack-work
${{ github.workspace }}/lib/services/gogol-games/.stack-work
${{ github.workspace }}/lib/services/gogol-classroom/.stack-work
${{ github.workspace }}/lib/services/gogol-tpu/.stack-work
${{ github.workspace }}/lib/services/gogol-genomics/.stack-work
${{ github.workspace }}/lib/services/gogol-chat/.stack-work
${{ github.workspace }}/lib/services/gogol-dataflow/.stack-work
${{ github.workspace }}/lib/services/gogol-tagmanager/.stack-work
${{ github.workspace }}/lib/gogol-core/.stack-work
${{ github.workspace }}/.stack-work
key: CI-builddir-${{ env.MANUAL_RESET }}--${{ matrix.versions.ghc }}--${{ github.head_ref }}
- name: Debug cache contents pre compilation
run: du -sh ${{ github.workspace }}/.stack-work && ls -R ${{ github.workspace }}/.stack-work
- name: Install dependencies
run: stack build --system-ghc --stack-yaml stack-${{ matrix.versions.ghc }}.yaml --only-dependencies
- name: Run tests
run: stack test --system-ghc --stack-yaml stack-${{ matrix.versions.ghc }}.yaml
- name: Build
run: stack build --system-ghc --stack-yaml stack-${{ matrix.versions.ghc }}.yaml
- name: Debug cache contents post compilation
run: du -sh ${{ github.workspace }}/.stack-work && ls -R ${{ github.workspace }}/.stack-work