Skip to content

Commit

Permalink
make sure cabal-install is compatible with Cabal
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
geekosaur committed Aug 22, 2024
1 parent fb2ac8c commit dadc2ad
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/check-sdist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
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
workflow_call:

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 the index (i.e. new major version, not released yet)
# 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')"
# why does `cabal list` force me to do this???
#@@@ temporarily always run to ensure this doesn't pull Cabal from the tree
#if cabal list --simple-output Cabal | grep -q "^Cabal $cbl\\."; then
# I sure hope this works…
cabal build "$sdist" --prefer-oldest --ignore-project
#else
# echo No released Cabal version to test against.
# exit 0
#fi

0 comments on commit dadc2ad

Please sign in to comment.