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