Skip to content

Commit d29c2ed

Browse files
committed
make sure cabal-install is compatible with Cabal
See haskell#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 fb2ac8c commit d29c2ed

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/check-sdist.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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
38+
# sharing these with the main validate job is possible but extremely painful; sadly,
39+
# you can't simply reference another job's matrix
40+
ghc:
41+
[
42+
"9.10.1",
43+
"9.8.2",
44+
"9.6.4",
45+
"9.4.8",
46+
"9.2.8",
47+
"9.0.2",
48+
"8.10.7",
49+
"8.8.4",
50+
]
51+
52+
steps:
53+
54+
- uses: haskell-actions/setup@v2
55+
id: setup-haskell
56+
with:
57+
ghc-version: ${{ matrix.ghc }}
58+
cabal-version: latest
59+
60+
- uses: actions/checkout@v4
61+
62+
- name: Make sdist
63+
run: cabal sdist cabal-install
64+
65+
- name: Install from sdist
66+
run: |
67+
# skip if a suitable Cabal isn't in the index (i.e. new major version, not released yet)
68+
# we only want to test cabal-install, to ensure that it works with existing Cabals
69+
# (don't look at this too closely)
70+
sdist="$(ls dist-newstyle/sdist/cabal-install-*.tar.gz | sed -n '\,^dist-newstyle/sdist/cabal-install-[0-9.]*\.tar\.gz$,{;p;q;}')"
71+
# extract the cabal-install major version
72+
ver="$(echo "$sdist" | sed -n 's,^dist-newstyle/sdist/cabal-install-\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9.]*$,\1,p')"
73+
# why does `cabal list` force me to do this???
74+
if cabal list --simple-output Cabal | grep -q "^Cabal $cbl\\."; then
75+
# sigh, someone broke installing from tarballs
76+
rm -rf cabal*.project Cabal Cabal-syntax cabal-install-solver cabal-install
77+
tar xfz "$sdist"
78+
cd "cabal-install-$cbl"*
79+
cabal install --prefer-oldest
80+
else
81+
echo No released Cabal version to test against.
82+
exit 0
83+
fi

0 commit comments

Comments
 (0)