Skip to content

Commit

Permalink
Avoid newer versions of safe with old GHCs
Browse files Browse the repository at this point in the history
This is necessary because newer versions of `safe` use the -W
syntax instead of the -fwarn syntax.
  • Loading branch information
goldfirere authored and RyanGlScott committed Feb 13, 2024
1 parent 4396d36 commit 7e5baf6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ jobs:
- name: initial cabal.project for sdist
run: |
touch cabal.project
echo "packages: $GITHUB_WORKSPACE/source/units-defs" >> cabal.project
echo "packages: $GITHUB_WORKSPACE/source/units" >> cabal.project
echo "packages: $GITHUB_WORKSPACE/source/units-test" >> cabal.project
echo "packages: $GITHUB_WORKSPACE/source/units-defs" >> cabal.project
cat cabal.project
- name: sdist
run: |
Expand All @@ -205,25 +205,27 @@ jobs:
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
- name: generate cabal.project
run: |
PKGDIR_units_defs="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/units-defs-[0-9.]*')"
echo "PKGDIR_units_defs=${PKGDIR_units_defs}" >> "$GITHUB_ENV"
PKGDIR_units="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/units-[0-9.]*')"
echo "PKGDIR_units=${PKGDIR_units}" >> "$GITHUB_ENV"
PKGDIR_units_test="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/units-test-[0-9.]*')"
echo "PKGDIR_units_test=${PKGDIR_units_test}" >> "$GITHUB_ENV"
PKGDIR_units_defs="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/units-defs-[0-9.]*')"
echo "PKGDIR_units_defs=${PKGDIR_units_defs}" >> "$GITHUB_ENV"
rm -f cabal.project cabal.project.local
touch cabal.project
touch cabal.project.local
echo "packages: ${PKGDIR_units_defs}" >> cabal.project
echo "packages: ${PKGDIR_units}" >> cabal.project
echo "packages: ${PKGDIR_units_test}" >> cabal.project
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package units-defs" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
echo "packages: ${PKGDIR_units_defs}" >> cabal.project
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package units" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package units-test" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package units-defs" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
cat >> cabal.project <<EOF
if ! impl ( ghc >= 8.0 )
constraints: safe < 0.3.18
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(units|units-defs|units-test)$/; }' >> cabal.project.local
cat cabal.project
Expand Down Expand Up @@ -253,12 +255,12 @@ jobs:
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
- name: cabal check
run: |
cd ${PKGDIR_units_defs} || false
${CABAL} -vnormal check
cd ${PKGDIR_units} || false
${CABAL} -vnormal check
cd ${PKGDIR_units_test} || false
${CABAL} -vnormal check
cd ${PKGDIR_units_defs} || false
${CABAL} -vnormal check
- name: haddock
run: |
if [ $((HCNUMVER < 80000 || HCNUMVER >= 80400)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi
Expand Down
4 changes: 4 additions & 0 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
-- Work around https://github.com/haskell/haddock/issues/574
haddock: <8.0 || >=8.4

raw-project
if !impl(ghc >= 8.0)
constraints: safe < 0.3.18
3 changes: 3 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
packages: */*.cabal

if !impl(ghc >= 8.0)
constraints: safe < 0.3.18

0 comments on commit 7e5baf6

Please sign in to comment.