Merge pull request #72 from maksbotan/maksbotan/support-servant-0.18
Support servant-server-0.18
This commit is contained in:
commit
0535413b1a
28
.travis.yml
28
.travis.yml
@ -2,9 +2,13 @@
|
|||||||
#
|
#
|
||||||
# haskell-ci '--config=cabal.haskell-ci' 'servant-quickcheck.cabal'
|
# haskell-ci '--config=cabal.haskell-ci' 'servant-quickcheck.cabal'
|
||||||
#
|
#
|
||||||
|
# To regenerate the script (for example after adjusting tested-with) run
|
||||||
|
#
|
||||||
|
# haskell-ci regenerate
|
||||||
|
#
|
||||||
# For more information, see https://github.com/haskell-CI/haskell-ci
|
# For more information, see https://github.com/haskell-CI/haskell-ci
|
||||||
#
|
#
|
||||||
# version: 0.9.20200121
|
# version: 0.10.1
|
||||||
#
|
#
|
||||||
version: ~> 1.0
|
version: ~> 1.0
|
||||||
language: c
|
language: c
|
||||||
@ -32,20 +36,20 @@ before_cache:
|
|||||||
- rm -rfv $CABALHOME/packages/head.hackage
|
- rm -rfv $CABALHOME/packages/head.hackage
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- compiler: ghc-8.8.1
|
- compiler: ghc-8.8.3
|
||||||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.1","cabal-install-3.0"]}}
|
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2"]}}
|
||||||
os: linux
|
os: linux
|
||||||
- compiler: ghc-8.6.5
|
- compiler: ghc-8.6.5
|
||||||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
|
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}}
|
||||||
os: linux
|
os: linux
|
||||||
- compiler: ghc-8.4.4
|
- compiler: ghc-8.4.4
|
||||||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.0"]}}
|
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}}
|
||||||
os: linux
|
os: linux
|
||||||
- compiler: ghc-8.2.2
|
- compiler: ghc-8.2.2
|
||||||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.0"]}}
|
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}}
|
||||||
os: linux
|
os: linux
|
||||||
- compiler: ghc-8.0.2
|
- compiler: ghc-8.0.2
|
||||||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.0"]}}
|
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}}
|
||||||
os: linux
|
os: linux
|
||||||
before_install:
|
before_install:
|
||||||
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
|
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
|
||||||
@ -95,6 +99,8 @@ install:
|
|||||||
- touch cabal.project
|
- touch cabal.project
|
||||||
- |
|
- |
|
||||||
echo "packages: ." >> cabal.project
|
echo "packages: ." >> cabal.project
|
||||||
|
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-quickcheck' >> cabal.project ; fi
|
||||||
|
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
|
||||||
- |
|
- |
|
||||||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-quickcheck)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-quickcheck)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
||||||
- cat cabal.project || true
|
- cat cabal.project || true
|
||||||
@ -103,8 +109,8 @@ install:
|
|||||||
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
|
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
|
||||||
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
|
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
|
||||||
- rm cabal.project.freeze
|
- rm cabal.project.freeze
|
||||||
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
|
- travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
|
||||||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
|
- travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
|
||||||
script:
|
script:
|
||||||
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
|
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
|
||||||
# Packaging...
|
# Packaging...
|
||||||
@ -120,6 +126,8 @@ script:
|
|||||||
- touch cabal.project
|
- touch cabal.project
|
||||||
- |
|
- |
|
||||||
echo "packages: ${PKGDIR_servant_quickcheck}" >> cabal.project
|
echo "packages: ${PKGDIR_servant_quickcheck}" >> cabal.project
|
||||||
|
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-quickcheck' >> cabal.project ; fi
|
||||||
|
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
|
||||||
- |
|
- |
|
||||||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-quickcheck)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-quickcheck)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
||||||
- cat cabal.project || true
|
- cat cabal.project || true
|
||||||
@ -146,5 +154,5 @@ script:
|
|||||||
# Constraint set base-compat-0.11
|
# Constraint set base-compat-0.11
|
||||||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.11.*' all
|
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.11.*' all
|
||||||
|
|
||||||
# REGENDATA ("0.9.20200121",["--config=cabal.haskell-ci","servant-quickcheck.cabal"])
|
# REGENDATA ("0.10.1",["--config=cabal.haskell-ci","servant-quickcheck.cabal"])
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
@ -1,2 +1,4 @@
|
|||||||
packages: .
|
packages: .
|
||||||
tests: true
|
tests: true
|
||||||
|
|
||||||
|
allow-newer: servant-blaze:servant
|
||||||
|
|||||||
@ -13,7 +13,7 @@ category: Web
|
|||||||
build-type: Simple
|
build-type: Simple
|
||||||
cabal-version: >=1.10
|
cabal-version: >=1.10
|
||||||
extra-source-files: CHANGELOG.yaml
|
extra-source-files: CHANGELOG.yaml
|
||||||
tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || == 8.8.1
|
tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || == 8.8.3
|
||||||
|
|
||||||
source-repository head
|
source-repository head
|
||||||
type: git
|
type: git
|
||||||
@ -49,9 +49,9 @@ library
|
|||||||
, pretty >=1.1 && <1.2
|
, pretty >=1.1 && <1.2
|
||||||
, process >=1.2 && <1.7
|
, process >=1.2 && <1.7
|
||||||
, QuickCheck >=2.7 && <2.15
|
, QuickCheck >=2.7 && <2.15
|
||||||
, servant >=0.17 && <0.18
|
, servant >=0.17 && <0.19
|
||||||
, servant-client >=0.17 && <0.18
|
, servant-client >=0.17 && <0.19
|
||||||
, servant-server >=0.17 && <0.18
|
, servant-server >=0.17 && <0.19
|
||||||
, split >=0.2 && <0.3
|
, split >=0.2 && <0.3
|
||||||
, string-conversions >=0.3 && <0.5
|
, string-conversions >=0.3 && <0.5
|
||||||
, temporary >=1.2 && <1.4
|
, temporary >=1.2 && <1.4
|
||||||
|
|||||||
@ -11,6 +11,9 @@ import Network.Wai.Handler.Warp (withApplication)
|
|||||||
import Prelude.Compat
|
import Prelude.Compat
|
||||||
import Servant (Context (EmptyContext), HasServer,
|
import Servant (Context (EmptyContext), HasServer,
|
||||||
Server, serveWithContext)
|
Server, serveWithContext)
|
||||||
|
#if MIN_VERSION_servant_server(0,18,0)
|
||||||
|
import Servant (DefaultErrorFormatters, ErrorFormatters, HasContextEntry, type (.++))
|
||||||
|
#endif
|
||||||
import Servant.Client (BaseUrl (..), Scheme (..))
|
import Servant.Client (BaseUrl (..), Scheme (..))
|
||||||
import System.IO.Unsafe (unsafePerformIO)
|
import System.IO.Unsafe (unsafePerformIO)
|
||||||
import Test.Hspec (Expectation, expectationFailure)
|
import Test.Hspec (Expectation, expectationFailure)
|
||||||
@ -37,7 +40,11 @@ withServantServer api = withServantServerAndContext api EmptyContext
|
|||||||
-- application.
|
-- application.
|
||||||
--
|
--
|
||||||
-- /Since 0.0.0.0/
|
-- /Since 0.0.0.0/
|
||||||
|
#if MIN_VERSION_servant_server(0,18,0)
|
||||||
|
withServantServerAndContext :: (HasServer a ctx, HasContextEntry (ctx .++ DefaultErrorFormatters) ErrorFormatters)
|
||||||
|
#else
|
||||||
withServantServerAndContext :: HasServer a ctx
|
withServantServerAndContext :: HasServer a ctx
|
||||||
|
#endif
|
||||||
=> Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r
|
=> Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r
|
||||||
withServantServerAndContext api ctx server t
|
withServantServerAndContext api ctx server t
|
||||||
= withApplication (return . serveWithContext api ctx =<< server) $ \port ->
|
= withApplication (return . serveWithContext api ctx =<< server) $ \port ->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user