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