Skip to content

Commit d0faf3f

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.) (cherry picked from commit 3a7a0b7)
1 parent b6fb6f5 commit d0faf3f

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

.github/workflows/check-sdist.yml

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

0 commit comments

Comments
 (0)