Skip to content

Commit

Permalink
Merge pull request #44 from biocad/maksbotan/ghc-9.6
Browse files Browse the repository at this point in the history
GHC 9.6 compatibility
  • Loading branch information
maksbotan authored Jun 25, 2023
2 parents 90f7a44 + 6d8256b commit 9eab895
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 30 deletions.
45 changes: 26 additions & 19 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.15.20230128
# version: 0.16.3
#
# REGENDATA ("0.15.20230128",["github","cabal.project","--config","cabal.haskell-ci"])
# REGENDATA ("0.16.3",["github","cabal.project","--config","cabal.haskell-ci"])
#
name: Haskell-CI
on:
Expand All @@ -32,14 +32,19 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.4.4
- compiler: ghc-9.6.2
compilerKind: ghc
compilerVersion: 9.4.4
compilerVersion: 9.6.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.5
- compiler: ghc-9.4.5
compilerKind: ghc
compilerVersion: 9.2.5
compilerVersion: 9.4.5
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.7
compilerKind: ghc
compilerVersion: 9.2.7
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.0.2
Expand Down Expand Up @@ -70,20 +75,18 @@ jobs:
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
if [ "${{ matrix.setup-method }}" = ghcup ]; then
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
else
apt-add-repository -y 'ppa:hvr/ghc'
apt-get update
apt-get install -y "$HCNAME"
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
fi
env:
HCKIND: ${{ matrix.compilerKind }}
Expand All @@ -101,13 +104,13 @@ jobs:
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
else
HC=$HCDIR/bin/$HCKIND
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
fi
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
Expand Down Expand Up @@ -159,8 +162,8 @@ jobs:
- name: install cabal-plan
run: |
mkdir -p $HOME/.cabal/bin
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
rm -f cabal-plan.xz
chmod a+x $HOME/.cabal/bin/cabal-plan
Expand Down Expand Up @@ -234,18 +237,22 @@ jobs:
${CABAL} -vnormal check
- name: haddock
run: |
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
if [ $((HCNUMVER < 90000 || HCNUMVER >= 90400)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi
- name: unconstrained build
run: |
rm -f cabal.project.local
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
- name: prepare for constraint sets
run: |
rm -f cabal.project.local
- name: constraint set servant-0.20
run: |
if [ $((HCNUMVER >= 81000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.20.*' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER >= 81000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.20.*' all ; fi
- name: constraint set servant-0.19
run: |
if [ $((HCNUMVER >= 80800 && HCNUMVER < 90400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.19' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER >= 80800 && HCNUMVER < 90400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.19' all ; fi
if [ $((HCNUMVER >= 80800 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.19.*' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER >= 80800 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.19.*' all ; fi
- name: constraint set servant-0.18.2
run: |
if [ $((HCNUMVER >= 80800 && HCNUMVER < 90000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.18.2' --dependencies-only -j2 all ; fi
Expand Down
16 changes: 14 additions & 2 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ branches: master

distribution: focal

-- https://github.com/haskell-CI/haskell-ci/issues/658#issuecomment-1513692337
haddock-components: libs

-- Building docs on GHC 9.2 and 9.4 leads to myriad of different errors.
-- See https://github.com/haskell/cabal/issues/7462, https://github.com/haskell/cabal/issues/8707
-- and https://github.com/haskell/cabal/issues/8707
haddock: < 9.0 || >= 9.4

constraint-set servant-0.17
ghc: >= 8.0 && <8.10
constraints: servant ==0.17.*
Expand All @@ -19,5 +27,9 @@ constraint-set servant-0.18.2
constraints: servant ==0.18.2

constraint-set servant-0.19
ghc: >= 8.8 && <9.4
constraints: servant ==0.19
ghc: >= 8.8 && <9.6
constraints: servant ==0.19.*

constraint-set servant-0.20
ghc: >= 8.10 && <9.8
constraints: servant ==0.20.*
5 changes: 3 additions & 2 deletions example/example.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ tested-with:
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.5
|| ==9.4.4
|| ==9.2.7
|| ==9.4.5
|| ==9.6.2

library
ghc-options: -Wall
Expand Down
13 changes: 7 additions & 6 deletions servant-openapi3.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ tested-with:
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.5
|| ==9.4.4
|| ==9.2.7
|| ==9.4.5
|| ==9.6.2

extra-source-files:
README.md
Expand All @@ -55,8 +56,8 @@ source-repository head

custom-setup
setup-depends:
base >=4.9 && <4.18,
Cabal >= 1.24,
base >=4.9 && <4.19,
Cabal >= 1.24 && < 4,
cabal-doctest >=1.0.6 && <1.1

library
Expand All @@ -77,13 +78,13 @@ library
hs-source-dirs: src
build-depends: aeson >=1.4.2.0 && <1.6 || >=2.0.1.0 && <2.2
, aeson-pretty >=0.8.7 && <0.9
, base >=4.9.1.0 && <4.18
, base >=4.9.1.0 && <4.19
, base-compat >=0.10.5 && <0.14
, bytestring >=0.10.8.1 && <0.12
, http-media >=0.7.1.3 && <0.9
, insert-ordered-containers >=0.2.1.0 && <0.3
, lens >=4.17 && <5.3
, servant >=0.17 && <0.20
, servant >=0.17 && <0.21
, singleton-bool >=0.1.4 && <0.2
, openapi3 >=3.2.3 && <3.3
, text >=1.2.3.0 && <3
Expand Down
6 changes: 6 additions & 0 deletions src/Servant/OpenApi/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ instance (HasOpenApi sub) => HasOpenApi (RemoteHost :> sub) where
instance (HasOpenApi sub) => HasOpenApi (HttpVersion :> sub) where
toOpenApi _ = toOpenApi (Proxy :: Proxy sub)

#if MIN_VERSION_servant(0,20,0)
-- | @'WithResource'@ combinator does not change our specification at all.
instance (HasOpenApi sub) => HasOpenApi (WithResource res :> sub) where
toOpenApi _ = toOpenApi (Proxy :: Proxy sub)
#endif

-- | @'WithNamedContext'@ combinator does not change our specification at all.
instance (HasOpenApi sub) => HasOpenApi (WithNamedContext x c sub) where
toOpenApi _ = toOpenApi (Proxy :: Proxy sub)
Expand Down
2 changes: 1 addition & 1 deletion src/Servant/OpenApi/Internal/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import Servant.OpenApi.Internal.TypeLevel
-- >>> type ContactAPI = Get '[JSON] Contact
-- >>> hspec $ validateEveryToJSON (Proxy :: Proxy ContactAPI)
-- ...
-- ...No instance for (Arbitrary Contact)
-- ...No instance for ...Arbitrary Contact...
-- ... arising from a use of ‘validateEveryToJSON’
-- ...
validateEveryToJSON
Expand Down

0 comments on commit 9eab895

Please sign in to comment.