Skip to content

Commit a02509a

Browse files
committed
check compatibility with GHC prereleases
This unnecessarily runs even when a prerelease isn't active, but if it fails then then we have bigger problems (like we do right now with a buggy 3.14.1.0 released).
1 parent 56594bd commit a02509a

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/ghc-prereleases.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Check GHC prereleases
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+
branches:
11+
- master
12+
pull_request:
13+
release:
14+
types:
15+
- created
16+
17+
jobs:
18+
19+
# Make sure we support the latest prerelease GHC. This means validating that Cabal doesn't
20+
# output a warning that the GHC is too new.
21+
#
22+
# It's generally pointless to run this when not around a release, but there's no good way
23+
# to automate checking for that so we just run pointlessly. (If it doesn't succeed, we have
24+
# bigger problems.)
25+
26+
ghc-prerelease:
27+
name: Check compatibility with latest GHC prerelease
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
32+
# install both ghc versions (release and prerelease)
33+
# note that there is no way to access the actual version of the prerelease
34+
# *or* a version-specific binary location (no, `ghc-version` doesn't work; it
35+
# regurgitates the input version unchanged, which in our case is a ghcup tag),
36+
# so we must install it second and rely on it being the default ghc. Since we
37+
# know the version of the other ghc, we *can* access it.
38+
39+
- uses: haskell-actions/setup@v2
40+
id: release-ghc
41+
with:
42+
# NOTE: for CI rewrite, use GHC_FOR_RELEASE
43+
ghc-version: "9.4.8"
44+
cabal-version: latest
45+
46+
# setup overwrites ghc, so we have to do this first *and* use the ghc-path output
47+
# (not ghc-exe, which points to the overwritten ghc which is usually the wrong one)
48+
- uses: haskell-actions/setup@v2
49+
id: prerelease-ghc
50+
with:
51+
ghc-version: latest-prerelease
52+
ghcup-release-channel: "https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml"
53+
54+
# first, build cabal-install
55+
- uses: actions/checkout@v4
56+
57+
# use the release project to silence the prerelease warning, to make
58+
# checking for the too-new-GHC warning easier
59+
- run: cabal build cabal --project-file=cabal.release.project -w ghc-${{ steps.release-ghc.outputs.ghc-version }}
60+
61+
# dry run build of Cabal with the prerelease
62+
# if there is a problem, the first two lines of the output will be a warning
63+
# note: as above, we must use the default ghc here because we can't get the
64+
# prerelease's actual name
65+
- run: $(cabal list-bin cabal -w ghc-${{ steps.release-ghc.outputs.ghc-version }}) build Cabal --dry-run -w ghc 2>&1 | tee build.log
66+
shell: bash
67+
68+
- run: |
69+
if grep -q unknown/unsupported build.log; then
70+
echo Cabal does not support latest GHC prerelease
71+
exit 1
72+
fi
73+
exit 0
74+
shell: bash

0 commit comments

Comments
 (0)