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