Skip to content

Commit b844e82

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 fb2ac8c commit b844e82

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+
workflow_call:
25+
26+
jobs:
27+
28+
# Dogfood the generated sdist, to avoid bugs like https://github.com/haskell/cabal/issues/9833
29+
# No caching, since the point is to verify they can be installed "from scratch"
30+
# Don't run on master or a PR targeting master, because there's never an installable Cabal
31+
dogfood-sdists:
32+
name: Dogfood sdist on ${{ matrix.os }} ghc-${{ matrix.ghc }}
33+
# if: github.ref != 'refs/heads/master' && github.base_ref != 'master'
34+
runs-on: ${{ matrix.os }}
35+
strategy:
36+
matrix:
37+
os: [ubuntu-latest]
38+
# this should be kept up to date with the list in validate.yml
39+
# sharing these with the main validate job is possible but extremely painful; sadly,
40+
# you can't simply reference another job's matrix
41+
ghc:
42+
[
43+
"9.10.1",
44+
"9.8.2",
45+
"9.6.4",
46+
"9.4.8",
47+
"9.2.8",
48+
"9.0.2",
49+
"8.10.7",
50+
"8.8.4",
51+
]
52+
53+
steps:
54+
55+
- uses: haskell-actions/setup@v2
56+
id: setup-haskell
57+
with:
58+
ghc-version: ${{ matrix.ghc }}
59+
cabal-version: latest
60+
61+
- uses: actions/checkout@v4
62+
63+
- name: Make sdist
64+
run: cabal sdist cabal-install
65+
66+
- name: Install from sdist
67+
run: |
68+
# skip if a suitable Cabal isn't in the index (i.e. new major version, not released yet)
69+
# we only want to test cabal-install, to ensure that it works with existing Cabals
70+
# (don't look at this too closely)
71+
sdist="$(ls dist-newstyle/sdist/cabal-install-*.tar.gz | sed -n '\,^dist-newstyle/sdist/cabal-install-[0-9.]*\.tar\.gz$,{;p;q;}')"
72+
# extract the cabal-install major version
73+
ver="$(echo "$sdist" | sed -n 's,^dist-newstyle/sdist/cabal-install-\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9.]*$,\1,p')"
74+
# why does `cabal list` force me to do this???
75+
#@@@ temporarily always run to ensure this doesn't pull Cabal from the tree
76+
#if cabal list --simple-output Cabal | grep -q "^Cabal $cbl\\."; then
77+
# I sure hope this works…
78+
cabal install "$sdist" --prefer-oldest --ignore-project
79+
#else
80+
# echo No released Cabal version to test against.
81+
# exit 0
82+
#fi

0 commit comments

Comments
 (0)