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