mirror of
https://github.com/haskell-servant/servant-ekg.git
synced 2024-11-22 19:19:43 +01:00
Allow servant-0.16
This commit is contained in:
parent
8f5e9ad2bb
commit
4a280658d9
4 changed files with 46 additions and 47 deletions
84
.travis.yml
84
.travis.yml
|
@ -20,68 +20,66 @@ cache:
|
|||
- $HOME/.cabal/store
|
||||
|
||||
before_cache:
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
|
||||
# remove files that are regenerated by 'cabal update'
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
|
||||
|
||||
- rm -rfv $HOME/.cabal/packages/head.hackage
|
||||
- rm -rfv $CABALHOME/packages/head.hackage
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- compiler: "ghc-8.6.3"
|
||||
# env: TEST=--disable-tests BENCH=--disable-benchmarks
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.3], sources: [hvr-ghc]}}
|
||||
- compiler: "ghc-8.4.4"
|
||||
# env: TEST=--disable-tests BENCH=--disable-benchmarks
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}}
|
||||
- compiler: "ghc-8.2.2"
|
||||
# env: TEST=--disable-tests BENCH=--disable-benchmarks
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}}
|
||||
- compiler: "ghc-8.0.2"
|
||||
# env: TEST=--disable-tests BENCH=--disable-benchmarks
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}}
|
||||
|
||||
before_install:
|
||||
- HC=${CC}
|
||||
- HC=/opt/ghc/bin/${CC}
|
||||
- HCVER=$(echo "$TRAVIS_COMPILER" | sed 's/ghc-//')
|
||||
- echo $HCVER
|
||||
- HCPKG=${HC/ghc/ghc-pkg}
|
||||
- unset CC
|
||||
- CABAL=/opt/ghc/bin/cabal
|
||||
- CABALHOME=$HOME/.cabal
|
||||
- export PATH="$CABALHOME/bin:$PATH"
|
||||
- ROOTDIR=$(pwd)
|
||||
- mkdir -p $HOME/.local/bin
|
||||
- "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
|
||||
- HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
|
||||
- echo $HCNUMVER
|
||||
|
||||
install:
|
||||
- cabal --version
|
||||
- ${CABAL} --version
|
||||
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
|
||||
- BENCH=${BENCH---enable-benchmarks}
|
||||
- TEST=${TEST---enable-tests}
|
||||
- HADDOCK=${HADDOCK-true}
|
||||
- UNCONSTRAINED=${UNCONSTRAINED-true}
|
||||
- NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
|
||||
- TEST=--enable-tests
|
||||
- BENCH=--enable-benchmarks
|
||||
- GHCHEAD=${GHCHEAD-false}
|
||||
- travis_retry cabal update -v
|
||||
- "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
|
||||
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then export CABALHOME=$APPDATA/cabal; else export CABALHOME=$HOME/.cabal; fi
|
||||
- travis_retry ${CABAL} update -v
|
||||
- sed -i.bak 's/^jobs:/-- jobs:/' $CABALHOME/config
|
||||
- rm -fv cabal.project cabal.project.local
|
||||
- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
|
||||
- "printf 'packages: \".\"\\n' > cabal.project"
|
||||
- grep -Ev -- '^\s*--' $CABALHOME/config | grep -Ev '^\s*$'
|
||||
- rm -f cabal.project
|
||||
- touch cabal.project
|
||||
- "printf 'packages: \".\"\\n' >> cabal.project"
|
||||
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
|
||||
- "echo 'reorder-goals: True' >> cabal.project"
|
||||
- "echo 'max-backjumps: 100' >> cabal.project"
|
||||
- touch cabal.project.local
|
||||
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant-ekg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
|
||||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(servant-ekg)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
||||
- cat cabal.project || true
|
||||
- cat cabal.project.local || true
|
||||
- if [ -f "./configure.ac" ]; then
|
||||
(cd "." && autoreconf -i);
|
||||
fi
|
||||
- if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
|
||||
- rm -f cabal.project.freeze
|
||||
- cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
|
||||
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
|
||||
- ${CABAL} new-freeze -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dry
|
||||
- "cat \"cabal.project.freeze\" | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
|
||||
- rm "cabal.project.freeze"
|
||||
- ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
|
||||
- ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
|
||||
- rm -rf .ghc.environment.* "."/dist
|
||||
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
|
||||
|
||||
|
@ -89,33 +87,33 @@ install:
|
|||
# any command which exits with a non-zero exit code causes the build to fail.
|
||||
script:
|
||||
# test that source-distributions can be generated
|
||||
- cabal new-sdist all
|
||||
- ${CABAL} new-sdist all
|
||||
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
|
||||
- cd ${DISTDIR} || false
|
||||
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
|
||||
- "printf 'packages: servant-ekg-*/*.cabal\\n' > cabal.project"
|
||||
- rm -f cabal.project
|
||||
- touch cabal.project
|
||||
- "printf 'packages: \"servant-ekg-*/*.cabal\"\\n' >> cabal.project"
|
||||
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
|
||||
- "echo 'reorder-goals: True' >> cabal.project"
|
||||
- "echo 'max-backjumps: 100' >> cabal.project"
|
||||
- touch cabal.project.local
|
||||
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant-ekg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
|
||||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(servant-ekg)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
||||
- cat cabal.project || true
|
||||
- cat cabal.project.local || true
|
||||
# this builds all libraries and executables (without tests/benchmarks)
|
||||
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
|
||||
- ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all
|
||||
|
||||
# build & run tests, build benchmarks
|
||||
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
|
||||
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
|
||||
- ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} all
|
||||
- if [ "x$TEST" = "x--enable-tests" ]; then ${CABAL} new-test -w ${HC} ${TEST} ${BENCH} all; fi
|
||||
|
||||
# cabal check
|
||||
- (cd servant-ekg-* && cabal check)
|
||||
- (cd servant-ekg-* && ${CABAL} check)
|
||||
|
||||
# haddock
|
||||
- if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
|
||||
- ${CABAL} new-haddock -w ${HC} ${TEST} ${BENCH} all
|
||||
|
||||
# Build without installed constraints for packages in global-db
|
||||
- if $UNCONSTRAINED; then rm -f cabal.project.local; cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi
|
||||
- rm -f cabal.project.local; ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all;
|
||||
|
||||
# REGENDATA ["--output=.travis.yml","--branches=master","cabal.project"]
|
||||
# EOF
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
packages: .
|
||||
reorder-goals: True
|
||||
max-backjumps: 100
|
||||
|
|
|
@ -26,7 +26,7 @@ library
|
|||
base >=4.9 && <4.13
|
||||
, ekg-core >=0.1.1.6 && <0.2
|
||||
, http-types >=0.12.2 && <0.13
|
||||
, servant >=0.15 && <0.16
|
||||
, servant >=0.15 && <0.17
|
||||
, text >=1.2.3.0 && <1.3
|
||||
, time >=1.6.0.1 && <1.9
|
||||
, unordered-containers >=0.2.9.0 && <0.3
|
||||
|
|
|
@ -27,6 +27,9 @@ import Test.Hspec
|
|||
|
||||
import Servant.Ekg
|
||||
|
||||
#if !MIN_VERSION_servant_client(0,16,0)
|
||||
#define ClientError ServantError
|
||||
#endif
|
||||
|
||||
-- * Spec
|
||||
|
||||
|
@ -38,7 +41,7 @@ spec = describe "servant-ekg" $ do
|
|||
it "collects number of request" $ do
|
||||
withApp $ \port mvar -> do
|
||||
mgr <- newManager defaultManagerSettings
|
||||
let runFn :: ClientM a -> IO (Either ServantError a)
|
||||
let runFn :: ClientM a -> IO (Either ClientError a)
|
||||
runFn fn = runClientM fn (mkClientEnv mgr (BaseUrl Http "localhost" port ""))
|
||||
_ <- runFn $ getEp "name" Nothing
|
||||
_ <- runFn $ postEp (Greet "hi")
|
||||
|
|
Loading…
Reference in a new issue