@@ -271,6 +271,68 @@ jobs:
271
271
EXTRA_GHC : " /opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }}"
272
272
run : sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc ${{ env.EXTRA_GHC }}
273
273
274
+ build-alpine :
275
+ name : Build statically linked using alpine
276
+ runs-on : " ubuntu-latest"
277
+ container : " alpine:3.19"
278
+ steps :
279
+ - name : Install extra dependencies
280
+ shell : sh
281
+ run : |
282
+ apk add bash curl sudo jq pkgconfig \
283
+ zlib-dev zlib-static binutils-gold curl \
284
+ gcc g++ gmp-dev libc-dev libffi-dev make \
285
+ musl-dev ncurses-dev perl tar xz
286
+
287
+ - uses : actions/checkout@v4
288
+
289
+ # See https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#hackage-revisions
290
+ - name : Manually supplied constraints/allow-newer
291
+ if : ${{ github.event_name == 'workflow_dispatch' }}
292
+ run : |
293
+ echo 'allow-newer:' ${ALLOWNEWER} >> cabal.project.validate
294
+ echo 'constraints:' ${CONSTRAINTS} >> cabal.project.validate
295
+
296
+ # See the following link for a breakdown of the following step
297
+ # https://github.com/haskell/actions/issues/7#issuecomment-745697160
298
+ - uses : actions/cache@v3
299
+ with :
300
+ # validate.sh uses a special build dir
301
+ path : |
302
+ ${{ steps.setup-haskell.outputs.cabal-store }}
303
+ dist-*
304
+ key : ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-${{ github.sha }}
305
+ restore-keys : ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-
306
+
307
+ - uses : haskell-actions/setup@v2
308
+ id : setup-haskell
309
+ with :
310
+ ghc-version : ${{ env.GHC_FOR_RELEASE }}
311
+ cabal-version : latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133
312
+
313
+ - name : Enable statically linked executables
314
+ run : |
315
+ echo 'executable-static: true' >> cabal.project.validate
316
+
317
+ - name : Build
318
+ run : sh validate.sh $FLAGS -s build
319
+
320
+ - name : Tar cabal head executable
321
+ run : |
322
+ CABAL_EXEC=$(cabal list-bin --builddir=dist-newstyle-validate-ghc-${{ env.GHC_FOR_RELEASE }} --project-file=cabal.project.validate cabal-install:exe:cabal)
323
+ # We have to tar the executable to preserve executable permissions
324
+ # see https://github.com/actions/upload-artifact/issues/38
325
+ export CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-static-x86_64.tar.gz"
326
+ tar -czvf $CABAL_EXEC_TAR -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC")
327
+ echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> $GITHUB_ENV
328
+
329
+ - name : Upload cabal-install executable to workflow artifacts
330
+ uses : actions/upload-artifact@v3
331
+ with :
332
+ name : cabal-${{ runner.os }}-static-x86_64
333
+ path : ${{ env.CABAL_EXEC_TAR }}
334
+
335
+
274
336
# The previous jobs use a released version of cabal to build cabal HEAD itself
275
337
# This one uses the cabal HEAD generated executable in the previous step
276
338
# to build itself again, as sanity check
@@ -334,7 +396,7 @@ jobs:
334
396
if : github.ref == 'refs/heads/master'
335
397
336
398
# IMPORTANT! Any job added to the workflow should be added here too
337
- needs : [validate, validate-old-ghcs, dogfooding]
399
+ needs : [validate, validate-old-ghcs, build-alpine, dogfooding]
338
400
339
401
steps :
340
402
- uses : actions/download-artifact@v3
@@ -345,6 +407,10 @@ jobs:
345
407
with :
346
408
name : cabal-Linux-x86_64
347
409
410
+ - uses : actions/download-artifact@v3
411
+ with :
412
+ name : cabal-Linux-static-x86_64
413
+
348
414
- uses : actions/download-artifact@v3
349
415
with :
350
416
name : cabal-macOS-x86_64
@@ -359,6 +425,7 @@ jobs:
359
425
files : |
360
426
cabal-head-Windows-x86_64.tar.gz
361
427
cabal-head-Linux-x86_64.tar.gz
428
+ cabal-head-Linux-static-x86_64.tar.gz
362
429
cabal-head-macOS-x86_64.tar.gz
363
430
364
431
# We use this job as a summary of the workflow
@@ -370,7 +437,7 @@ jobs:
370
437
name : Validate post job
371
438
runs-on : ubuntu-latest
372
439
# IMPORTANT! Any job added to the workflow should be added here too
373
- needs : [validate, validate-old-ghcs, dogfooding]
440
+ needs : [validate, validate-old-ghcs, build-alpine, dogfooding]
374
441
375
442
steps :
376
443
- run : |
0 commit comments