Skip to content

Commit 52d2ec1

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 52d2ec1

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/ghc-prereleases.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
# setup overwrites ghc, so we have to do this first *and* use the ghc-path output
34+
# (not ghc-exe, which points to the overwritten ghc which is usually the wrong one)
35+
- uses: haskell-actions/setup@v2
36+
id: prerelease-ghc
37+
with:
38+
ghc-version: latest-prerelease
39+
ghcup-release-channel: "https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml"
40+
41+
- uses: haskell-actions/setup@v2
42+
id: release-ghc
43+
with:
44+
# NOTE: for CI rewrite, use GHC_FOR_RELEASE
45+
ghc-version: "9.4.8"
46+
cabal-version: latest
47+
48+
# first, build cabal-install
49+
- uses: actions/checkout@v4
50+
51+
# use the release project to silence the prerelease warning, to make
52+
# checking for the too-new-GHC warning easier
53+
- run: cabal build cabal --project-file=cabal.release.project -w ghc-${{ steps.release-ghc.outputs.ghc-version }}
54+
55+
# dry run build of Cabal with the prerelease
56+
# if there is a problem, the first two lines of the output will be a warning
57+
- run: $(cabal list-bin cabal -w ghc-${{ steps.release-ghc.outputs.ghc-version }}) build Cabal --dry-run -w ghc-${{ steps.prerelease-ghc.outputs.ghc-version }} 2>&1 | tee build.log
58+
shell: bash
59+
60+
- run: |
61+
if grep -q unknown/unsupported build.log; then
62+
echo Cabal does not support latest GHC prerelease
63+
exit 1
64+
fi
65+
exit 0
66+
shell: bash

0 commit comments

Comments
 (0)