Skip to content

Commit a4544b3

Browse files
committed
make sure cabal-install is compatible with Cabal
See #9833 If a ghc ships with a compatible Cabal, it will be preferred by the solver on `cabal install cabal-install`; the new `cabal-install` should in fact be compatible. So we test this on release branches that have had at least one release on Hackage. (Ideally we'd check ghc instead, but we can't do that from GHA. Even checking Hackage is pretty painful.)
1 parent 1ff41e8 commit a4544b3

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/check-sdist.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Check sdist
2+
3+
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
4+
concurrency:
5+
group: ${{ github.ref }}-${{ github.workflow }}
6+
cancel-in-progress: true
7+
8+
on:
9+
push:
10+
paths-ignore:
11+
- "doc/**"
12+
- "**/README.md"
13+
- "CONTRIBUTING.md"
14+
branches:
15+
- master
16+
pull_request:
17+
paths-ignore:
18+
- "doc/**"
19+
- "**/README.md"
20+
- "CONTRIBUTING.md"
21+
release:
22+
types:
23+
- created
24+
25+
jobs:
26+
27+
# Dogfood the generated sdist, to avoid bugs like https://github.com/haskell/cabal/issues/9833
28+
# No caching, since the point is to verify they can be installed "from scratch"
29+
# Don't run on master or a PR targeting master, because there's never an installable Cabal
30+
dogfood-sdists:
31+
name: Dogfood sdist on ${{ matrix.os }} ghc-${{ matrix.ghc }}
32+
if: github.ref != 'refs/heads/master' && github.base_ref != 'master'
33+
runs-on: ${{ matrix.os }}
34+
strategy:
35+
matrix:
36+
os: [ubuntu-latest]
37+
# this should be kept up to date with the list in validate.yml, but should be the
38+
# *first* compiler release so we validate against what is hopefully the first
39+
# release of a corresponding Cabal and friends. it can also be short since it's
40+
# highly unlikely that we are releasing really old branches.
41+
ghc:
42+
[
43+
"9.10.1",
44+
"9.8.1",
45+
"9.6.1",
46+
"9.4.1",
47+
]
48+
49+
steps:
50+
51+
- uses: haskell-actions/setup@v2
52+
id: setup-haskell
53+
with:
54+
ghc-version: ${{ matrix.ghc }}
55+
cabal-version: latest
56+
57+
- uses: actions/checkout@v4
58+
59+
- name: Make sdist
60+
run: cabal sdist cabal-install
61+
62+
- name: Install from sdist
63+
run: |
64+
# skip if a suitable Cabal isn't in this ghc's bootlibs, since that's the case
65+
# that causes failures for users (otherwise cabal-install will install a matching
66+
# version itself)
67+
# we only want to test cabal-install, to ensure that it works with existing Cabals
68+
# (don't look at this too closely)
69+
sdist="$(ls dist-newstyle/sdist/cabal-install-*.tar.gz | sed -n '\,^dist-newstyle/sdist/cabal-install-[0-9.]*\.tar\.gz$,{;p;q;}')"
70+
# extract the cabal-install major version
71+
ver="$(echo "$sdist" | sed -n 's,^dist-newstyle/sdist/cabal-install-\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9.]*$,\1,p')"
72+
# dunno if this will ever be extended to freebsd, but grep -q is a gnu-ism
73+
if ghc-pkg --global --simple-output list Cabal | grep "^Cabal-$cbl\\." >/dev/null; then
74+
# sigh, someone broke installing from tarballs
75+
rm -rf cabal*.project Cabal Cabal-syntax cabal-install-solver cabal-install
76+
tar xfz "$sdist"
77+
cd "cabal-install-$cbl"*
78+
cabal install
79+
else
80+
echo No matching bootlib Cabal version to test against.
81+
exit 0
82+
fi

0 commit comments

Comments
 (0)