@@ -221,6 +221,20 @@ jobs:
221
221
if : matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS
222
222
run : sh validate.sh $FLAGS -s solver-benchmarks-run
223
223
224
+ # Save the release sdists for later validation
225
+ # only do this on one platform/ghc because the sdists are the same everywhere
226
+ # NB. we only test cabal-install, and any ghc will do here since it's not used
227
+ - name : Create release sdists
228
+ if : runner.os == 'Linux' && matrix.ghc == env.GHC_FOR_RELEASE
229
+ run : cabal sdist cabal-install
230
+
231
+ - name : Upload release sdists to workflow artifacts
232
+ if : runner.os == 'Linux' && matrix.ghc == env.GHC_FOR_RELEASE
233
+ uses : actions/upload-artifact@v4
234
+ with :
235
+ name : cabal-sdists
236
+ path : dist-newstyle/sdist/*
237
+
224
238
validate-old-ghcs :
225
239
name : Validate old ghcs ${{ matrix.extra-ghc }}
226
240
runs-on : ubuntu-latest
@@ -390,6 +404,60 @@ jobs:
390
404
- name : Build using cabal HEAD
391
405
run : sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s build
392
406
407
+ # Dogfood the generated sdists, to avoid bugs like https://github.com/haskell/cabal/issues/9833
408
+ # No caching, since the point is to verify they can be installed "from scratch"
409
+ dogfood-sdists :
410
+ name : Dogfood validated sdists on ${{ matrix.os }} ghc-${{ matrix.ghc }}
411
+ runs-on : ${{ matrix.os }}
412
+ if : ${{ github.ref_name }} != 'master'
413
+ needs : validate
414
+ strategy :
415
+ matrix :
416
+ os : [ubuntu-latest]
417
+ # this should be kept up to date with the list above
418
+ # sharing these with the main validate job is possible but extremely painful; sadly,
419
+ # you can't simply reference another job's matrix
420
+ ghc :
421
+ [
422
+ " 9.10.1" ,
423
+ " 9.8.2" ,
424
+ " 9.6.4" ,
425
+ " 9.4.8" ,
426
+ " 9.2.8" ,
427
+ " 9.0.2" ,
428
+ " 8.10.7" ,
429
+ " 8.8.4" ,
430
+ ]
431
+
432
+ steps :
433
+
434
+ - uses : haskell-actions/setup@v2
435
+ id : setup-haskell
436
+ with :
437
+ ghc-version : ${{ matrix.ghc }}
438
+ cabal-version : latest
439
+
440
+ - name : Download sdists from workflow artifacts
441
+ uses : actions/download-artifact@v4
442
+ with :
443
+ name : cabal-sdists
444
+ path : .
445
+
446
+ - name : Install from sdists
447
+ run : |
448
+ # skip if a suitable Cabal isn't in the index (i.e. new major version, not released yet)
449
+ # we only want to test cabal-install, to ensure that it works with existing Cabals
450
+ sdist="$(ls cabal-install-*.tar.gz | sed -n '/^cabal-install-[0-9.]*\.tar\.gz$/{;p;q;}')"
451
+ tar xf "$sdist" "${sdist/.tar.gz}/cabal-install.cabal"
452
+ # (don't look at this too closely)
453
+ ver="$(sed -n '/^[Vv]ersion:[ \t]*\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9.]*$/{;s//\1/;p;q;}' "${sdist/.tar.gz}/cabal-install.cabal")"
454
+ # why???
455
+ if cabal list --simple-output Cabal | grep -q "^Cabal $cbl\\.""; then
456
+ cabal build "$sdist" --prefer-oldest
457
+ else
458
+ exit 0
459
+ fi
460
+
393
461
prerelease-head :
394
462
name : Create a GitHub prerelease with the binary artifacts
395
463
runs-on : ubuntu-latest
@@ -437,7 +505,7 @@ jobs:
437
505
name : Validate post job
438
506
runs-on : ubuntu-latest
439
507
# IMPORTANT! Any job added to the workflow should be added here too
440
- needs : [validate, validate-old-ghcs, build-alpine, dogfooding]
508
+ needs : [validate, validate-old-ghcs, build-alpine, dogfooding, dogfood-sdists ]
441
509
442
510
steps :
443
511
- run : |
0 commit comments