Merge pull request #1172 from haskell-servant/http-media-0.8

Http media 0.8
This commit is contained in:
Oleg Grenrus 2019-04-16 14:57:57 +03:00 committed by GitHub
commit 269da4f7be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 207 additions and 135 deletions

View file

@ -4,23 +4,21 @@
# #
# For more information, see https://github.com/haskell-CI/haskell-ci # For more information, see https://github.com/haskell-CI/haskell-ci
# #
# version: 0.2.1 # version: 0.3.20190413
# #
language: c language: c
dist: xenial dist: xenial
git: git:
submodules: false # whether to recursively clone submodules # whether to recursively clone submodules
submodules: false
branches: branches:
only: only:
- master - master
- release-0.16
cache: cache:
directories: directories:
- $HOME/.cabal/packages - $HOME/.cabal/packages
- $HOME/.cabal/store - $HOME/.cabal/store
before_cache: before_cache:
- rm -fv $CABALHOME/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'
@ -29,78 +27,113 @@ before_cache:
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache - 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
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
- rm -rfv $CABALHOME/packages/head.hackage - rm -rfv $CABALHOME/packages/head.hackage
matrix: matrix:
include: include:
- compiler: "ghc-8.6.4" - compiler: ghc-8.6.4
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.4], sources: [hvr-ghc]}} addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.4","cabal-install-2.4"]}}
- compiler: "ghc-8.4.4" - compiler: ghc-8.4.4
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}} addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}
- compiler: "ghc-8.2.2" - compiler: ghc-8.2.2
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}} addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}
- compiler: "ghc-8.0.2" - compiler: ghc-8.0.2
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}} addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}
before_install: before_install:
- HC=/opt/ghc/bin/${CC} - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
- HCPKG=${HC/ghc/ghc-pkg} - HCPKG="$HC-pkg"
- unset CC - unset CC
- CABAL=/opt/ghc/bin/cabal - CABAL=/opt/ghc/bin/cabal
- CABALHOME=$HOME/.cabal - CABALHOME=$HOME/.cabal
- export PATH="$CABALHOME/bin:$PATH" - export PATH="$CABALHOME/bin:$PATH"
- ROOTDIR=$(pwd) - TOP=$(pwd)
- 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
- CABAL="$CABAL -vnormal+nowrap+markoutput"
- set -o pipefail
- |
echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
echo 'BEGIN { state = "output"; }' >> .colorful.awk
echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
echo ' if (state == "cabal") {' >> .colorful.awk
echo ' print blue($0)' >> .colorful.awk
echo ' } else {' >> .colorful.awk
echo ' print $0' >> .colorful.awk
echo ' }' >> .colorful.awk
echo '}' >> .colorful.awk
- cat .colorful.awk
- |
color_cabal_output () {
awk -f $TOP/.colorful.awk
}
- echo text | color_cabal_output
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 '?')]"
- TEST=--enable-tests - TEST=--enable-tests
- BENCH=--enable-benchmarks - BENCH=--enable-benchmarks
- GHCHEAD=${GHCHEAD-false} - GHCHEAD=${GHCHEAD-false}
- travis_retry ${CABAL} update -v - rm -f $CABALHOME/config
- sed -i.bak 's/^jobs:/-- jobs:/' $CABALHOME/config - |
- rm -fv cabal.project cabal.project.local echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
- "sed -i.bak 's/-- ghc-options:.*/ghc-options: -j2/' $CABALHOME/config" echo "remote-build-reporting: anonymous" >> $CABALHOME/config
- grep -Ev -- '^\s*--' $CABALHOME/config | grep -Ev '^\s*$' echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
- rm -f cabal.project echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
echo "world-file: $CABALHOME/world" >> $CABALHOME/config
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
echo "install-dirs user" >> $CABALHOME/config
echo " prefix: $CABALHOME" >> $CABALHOME/config
echo "repository hackage.haskell.org" >> $CABALHOME/config
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
- |
echo "program-default-options" >> $CABALHOME/config
echo " ghc-options: -j2" >> $CABALHOME/config
- cat $CABALHOME/config
- rm -fv cabal.project cabal.project.local cabal.project.freeze
- travis_retry ${CABAL} v2-update -v
# Generate cabal.project
- rm -rf cabal.project cabal.project.local cabal.project.freeze
- touch cabal.project - touch cabal.project
- "printf 'packages: \"servant\"\\n' >> cabal.project" - |
- "printf 'packages: \"servant-client\"\\n' >> cabal.project" echo 'packages: "servant"' >> cabal.project
- "printf 'packages: \"servant-client-core\"\\n' >> cabal.project" echo 'packages: "servant-client"' >> cabal.project
- "printf 'packages: \"servant-http-streams\"\\n' >> cabal.project" echo 'packages: "servant-client-core"' >> cabal.project
- "printf 'packages: \"servant-docs\"\\n' >> cabal.project" echo 'packages: "servant-http-streams"' >> cabal.project
- "printf 'packages: \"servant-foreign\"\\n' >> cabal.project" echo 'packages: "servant-docs"' >> cabal.project
- "printf 'packages: \"servant-server\"\\n' >> cabal.project" echo 'packages: "servant-foreign"' >> cabal.project
- "printf 'packages: \"doc/tutorial\"\\n' >> cabal.project" echo 'packages: "servant-server"' >> cabal.project
- "printf 'packages: \"servant-machines\"\\n' >> cabal.project" echo 'packages: "doc/tutorial"' >> cabal.project
- "printf 'packages: \"servant-conduit\"\\n' >> cabal.project" echo 'packages: "servant-machines"' >> cabal.project
- "printf 'packages: \"servant-pipes\"\\n' >> cabal.project" echo 'packages: "servant-conduit"' >> cabal.project
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/basic-auth\"\\n' >> cabal.project ; fi" echo 'packages: "servant-pipes"' >> cabal.project
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/curl-mock\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/basic-auth"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/basic-streaming\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/curl-mock"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/db-postgres-pool\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/basic-streaming"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/db-sqlite-simple\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/db-postgres-pool"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/file-upload\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/db-sqlite-simple"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/generic\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/file-upload"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/https\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/generic"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/pagination\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/https"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/testing\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/pagination"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/structuring-apis\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/testing"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/using-custom-monad\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/structuring-apis"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/using-free-client\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/using-custom-monad"' >> cabal.project ; fi
- "echo 'constraints: foundation >=0.0.14' >> cabal.project" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/using-free-client"' >> cabal.project ; fi
- "echo 'constraints: memory <0.14.12 || >0.14.12' >> cabal.project" - |
- "echo 'allow-newer: servant-quickcheck:servant' >> cabal.project" echo "constraints: foundation >=0.0.14" >> cabal.project
- "echo 'allow-newer: servant-quickcheck:servant-client' >> cabal.project" echo "constraints: memory <0.14.12 || >0.14.12" >> cabal.project
- "echo 'allow-newer: servant-quickcheck:servant-server' >> cabal.project" echo "allow-newer: servant-quickcheck:servant" >> cabal.project
- "echo 'allow-newer: servant-quickcheck:hspec' >> cabal.project" echo "allow-newer: servant-quickcheck:servant-client" >> cabal.project
- "echo 'allow-newer: servant-quickcheck:http-client' >> cabal.project" echo "allow-newer: servant-quickcheck:servant-server" >> cabal.project
- "echo 'optimization: False' >> cabal.project " echo "allow-newer: servant-quickcheck:hspec" >> cabal.project
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project" echo "allow-newer: servant-quickcheck:http-client" >> cabal.project
- touch cabal.project.local echo "allow-newer: http-media" >> cabal.project
echo "optimization: False" >> cabal.project
echo "write-ghc-environment-files: always" >> cabal.project
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-db-sqlite-simple|cookbook-file-upload|cookbook-generic|cookbook-https|cookbook-pagination|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-machines|servant-pipes|servant-server|tutorial)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-db-sqlite-simple|cookbook-file-upload|cookbook-generic|cookbook-https|cookbook-pagination|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-machines|servant-pipes|servant-server|tutorial)$' | 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
@ -128,72 +161,84 @@ install:
- if [ -f "doc/cookbook/structuring-apis/configure.ac" ]; then (cd "doc/cookbook/structuring-apis" && autoreconf -i); fi - if [ -f "doc/cookbook/structuring-apis/configure.ac" ]; then (cd "doc/cookbook/structuring-apis" && autoreconf -i); fi
- if [ -f "doc/cookbook/using-custom-monad/configure.ac" ]; then (cd "doc/cookbook/using-custom-monad" && autoreconf -i); fi - if [ -f "doc/cookbook/using-custom-monad/configure.ac" ]; then (cd "doc/cookbook/using-custom-monad" && autoreconf -i); fi
- if [ -f "doc/cookbook/using-free-client/configure.ac" ]; then (cd "doc/cookbook/using-free-client" && autoreconf -i); fi - if [ -f "doc/cookbook/using-free-client/configure.ac" ]; then (cd "doc/cookbook/using-free-client" && autoreconf -i); fi
- rm -f cabal.project.freeze - ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output
- rm -rf .ghc.environment.* "servant"/dist "servant-client"/dist "servant-client-core"/dist "servant-http-streams"/dist "servant-docs"/dist "servant-foreign"/dist "servant-server"/dist "doc/tutorial"/dist "servant-machines"/dist "servant-conduit"/dist "servant-pipes"/dist "doc/cookbook/basic-auth"/dist "doc/cookbook/curl-mock"/dist "doc/cookbook/basic-streaming"/dist "doc/cookbook/db-postgres-pool"/dist "doc/cookbook/db-sqlite-simple"/dist "doc/cookbook/file-upload"/dist "doc/cookbook/generic"/dist "doc/cookbook/https"/dist "doc/cookbook/pagination"/dist "doc/cookbook/testing"/dist "doc/cookbook/structuring-apis"/dist "doc/cookbook/using-custom-monad"/dist "doc/cookbook/using-free-client"/dist - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) - rm cabal.project.freeze
# Here starts the actual work to be performed for the package under test;
# any command which exits with a non-zero exit code causes the build to fail.
script: script:
# test that source-distributions can be generated - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
- echo Packaging... && echo -en 'travis_fold:start:sdist\\r' # Packaging...
- ${CABAL} new-sdist all - echo 'Packaging...' && echo -en 'travis_fold:start:sdist\\r'
- ${CABAL} v2-sdist all | color_cabal_output
- echo -en 'travis_fold:end:sdist\\r' - echo -en 'travis_fold:end:sdist\\r'
- echo Unpacking... && echo -en 'travis_fold:start:unpack\\r' # Unpacking...
- echo 'Unpacking...' && echo -en 'travis_fold:start:unpack\\r'
- 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 '{}' \;
- rm -f cabal.project # Generate cabal.project
- rm -rf cabal.project cabal.project.local cabal.project.freeze
- touch cabal.project - touch cabal.project
- "printf 'packages: \"servant-*/*.cabal\"\\n' >> cabal.project" - |
- "printf 'packages: \"servant-client-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "servant-*/*.cabal"' >> cabal.project
- "printf 'packages: \"servant-client-core-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "servant-client-*/*.cabal"' >> cabal.project
- "printf 'packages: \"servant-http-streams-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "servant-client-core-*/*.cabal"' >> cabal.project
- "printf 'packages: \"servant-docs-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "servant-http-streams-*/*.cabal"' >> cabal.project
- "printf 'packages: \"servant-foreign-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "servant-docs-*/*.cabal"' >> cabal.project
- "printf 'packages: \"servant-server-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "servant-foreign-*/*.cabal"' >> cabal.project
- "printf 'packages: \"tutorial-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "servant-server-*/*.cabal"' >> cabal.project
- "printf 'packages: \"servant-machines-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "tutorial-*/*.cabal"' >> cabal.project
- "printf 'packages: \"servant-conduit-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "servant-machines-*/*.cabal"' >> cabal.project
- "printf 'packages: \"servant-pipes-*/*.cabal\"\\n' >> cabal.project" echo 'packages: "servant-conduit-*/*.cabal"' >> cabal.project
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-basic-auth-*/*.cabal\"\\n' >> cabal.project ; fi" echo 'packages: "servant-pipes-*/*.cabal"' >> cabal.project
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-curl-mock-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-basic-auth-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-basic-streaming-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-curl-mock-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-db-postgres-pool-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-basic-streaming-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-db-sqlite-simple-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-db-postgres-pool-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-file-upload-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-db-sqlite-simple-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-generic-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-file-upload-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-https-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-generic-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-pagination-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-https-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-testing-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-pagination-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-structuring-apis-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-testing-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-using-custom-monad-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-structuring-apis-*/*.cabal"' >> cabal.project ; fi
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-using-free-client-*/*.cabal\"\\n' >> cabal.project ; fi" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-using-custom-monad-*/*.cabal"' >> cabal.project ; fi
- "echo 'constraints: foundation >=0.0.14' >> cabal.project" if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-using-free-client-*/*.cabal"' >> cabal.project ; fi
- "echo 'constraints: memory <0.14.12 || >0.14.12' >> cabal.project" - |
- "echo 'allow-newer: servant-quickcheck:servant' >> cabal.project" echo "constraints: foundation >=0.0.14" >> cabal.project
- "echo 'allow-newer: servant-quickcheck:servant-client' >> cabal.project" echo "constraints: memory <0.14.12 || >0.14.12" >> cabal.project
- "echo 'allow-newer: servant-quickcheck:servant-server' >> cabal.project" echo "allow-newer: servant-quickcheck:servant" >> cabal.project
- "echo 'allow-newer: servant-quickcheck:hspec' >> cabal.project" echo "allow-newer: servant-quickcheck:servant-client" >> cabal.project
- "echo 'allow-newer: servant-quickcheck:http-client' >> cabal.project" echo "allow-newer: servant-quickcheck:servant-server" >> cabal.project
- "echo 'optimization: False' >> cabal.project " echo "allow-newer: servant-quickcheck:hspec" >> cabal.project
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project" echo "allow-newer: servant-quickcheck:http-client" >> cabal.project
- touch cabal.project.local echo "allow-newer: http-media" >> cabal.project
echo "optimization: False" >> cabal.project
echo "write-ghc-environment-files: always" >> cabal.project
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-db-sqlite-simple|cookbook-file-upload|cookbook-generic|cookbook-https|cookbook-pagination|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-machines|servant-pipes|servant-server|tutorial)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-db-sqlite-simple|cookbook-file-upload|cookbook-generic|cookbook-https|cookbook-pagination|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-machines|servant-pipes|servant-server|tutorial)$' | 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
- echo -en 'travis_fold:end:unpack\\r' - echo -en 'travis_fold:end:unpack\\r'
# Building with tests and benchmarks...
- echo Building with tests and benchmarks... && echo -en 'travis_fold:start:build-everything\\r' - echo 'Building with tests and benchmarks...' && echo -en 'travis_fold:start:build-everything\\r'
# build & run tests, build benchmarks # build & run tests, build benchmarks
- ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} all - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
- echo -en 'travis_fold:end:build-everything\\r' - echo -en 'travis_fold:end:build-everything\\r'
- if [ "x$TEST" = "x--enable-tests" ]; then ${CABAL} new-test -w ${HC} ${TEST} ${BENCH} all; fi # Testing...
- ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
- echo Haddock... && echo -en 'travis_fold:start:haddock\\r' # haddock...
# haddock - echo 'haddock...' && echo -en 'travis_fold:start:haddock\\r'
- ${CABAL} new-haddock -w ${HC} ${TEST} ${BENCH} all - ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
- echo -en 'travis_fold:end:haddock\\r' - echo -en 'travis_fold:end:haddock\\r'
# Constraint sets
- rm -rf cabal.project.local
# Constraint set http-media-0.8
- echo 'Constraint set http-media-0.8' && echo -en 'travis_fold:start:constraint-sets-http-media-0.8\\r'
- ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks --constraint='http-media ==0.8.*' all | color_cabal_output
- echo -en 'travis_fold:end:constraint-sets-http-media-0.8\\r'
# Constraint set http-media-0.7
- echo 'Constraint set http-media-0.7' && echo -en 'travis_fold:start:constraint-sets-http-media-0.7\\r'
- ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks --constraint='http-media ==0.7.*' all | color_cabal_output
- echo -en 'travis_fold:end:constraint-sets-http-media-0.7\\r'
# REGENDATA ["--config=cabal.haskell-ci","--output=.travis.yml","cabal.project"] # REGENDATA ["--config=cabal.haskell-ci","--output=.travis.yml","cabal.project"]
# EOF # EOF

View file

@ -1,5 +1,5 @@
folds: all-but-test folds: all-but-test
branches: master branches: master release-0.16
jobs-selection: any jobs-selection: any
-- We have inplace packages (servant-js) so we skip installing dependencies in a separate step -- We have inplace packages (servant-js) so we skip installing dependencies in a separate step
@ -14,3 +14,9 @@ cabal-check: False
-- ghc-options: -j2 -- ghc-options: -j2
jobs: :2 jobs: :2
constraint-set http-media-0.8
constraints: http-media ==0.8.*
constraint-set http-media-0.7
constraints: http-media ==0.7.*

View file

@ -51,3 +51,5 @@ allow-newer:
servant-quickcheck:servant, servant-quickcheck:servant-client, servant-quickcheck:servant-server, servant-quickcheck:servant, servant-quickcheck:servant-client, servant-quickcheck:servant-server,
servant-quickcheck:hspec, servant-quickcheck:hspec,
servant-quickcheck:http-client servant-quickcheck:http-client
allow-newer: http-media

View file

@ -1,6 +1,7 @@
cabal-version: >=1.10 cabal-version: >=1.10
name: servant-client-core name: servant-client-core
version: 0.16 version: 0.16
x-revision: 1
synopsis: Core functionality and class for client function generation for servant APIs synopsis: Core functionality and class for client function generation for servant APIs
category: Servant, Web category: Servant, Web
@ -77,7 +78,7 @@ library
, base64-bytestring >= 1.0.0.1 && < 1.1 , base64-bytestring >= 1.0.0.1 && < 1.1
, exceptions >= 0.10.0 && < 0.11 , exceptions >= 0.10.0 && < 0.11
, free >= 5.1 && < 5.2 , free >= 5.1 && < 5.2
, http-media >= 0.7.1.3 && < 0.8 , http-media >= 0.7.1.3 && < 0.9
, http-types >= 0.12.2 && < 0.13 , http-types >= 0.12.2 && < 0.13
, network-uri >= 2.6.1.0 && < 2.7 , network-uri >= 2.6.1.0 && < 2.7
, safe >= 0.3.17 && < 0.4 , safe >= 0.3.17 && < 0.4
@ -105,7 +106,7 @@ test-suite spec
build-depends: build-depends:
deepseq >= 1.4.2.0 && < 1.5 deepseq >= 1.4.2.0 && < 1.5
, hspec >= 2.6.0 && < 2.8 , hspec >= 2.6.0 && < 2.8
, QuickCheck >= 2.12.6.1 && < 2.13 , QuickCheck >= 2.12.6.1 && < 2.14
build-tool-depends: build-tool-depends:
hspec-discover:hspec-discover >= 2.6.0 && <2.8 hspec-discover:hspec-discover >= 2.6.0 && <2.8

View file

@ -45,7 +45,7 @@ library
, exceptions >=0.8 && <0.11 , exceptions >=0.8 && <0.11
, ghcjs-base >=0.2.0.0 && <0.3.0.0 , ghcjs-base >=0.2.0.0 && <0.3.0.0
, ghcjs-prim >=0.1.0.0 && <0.2.0.0 , ghcjs-prim >=0.1.0.0 && <0.2.0.0
, http-media >=0.6.2 && <0.8 , http-media >=0.6.2 && <0.9
, http-types >=0.12 && <0.13 , http-types >=0.12 && <0.13
, monad-control >=1.0.0.4 && <1.1 , monad-control >=1.0.0.4 && <1.1
, mtl >=2.2.2 && <2.3 , mtl >=2.2.2 && <2.3

View file

@ -1,6 +1,7 @@
cabal-version: >=1.10 cabal-version: >=1.10
name: servant-client name: servant-client
version: 0.16 version: 0.16
x-revision: 1
synopsis: Automatic derivation of querying functions for servant synopsis: Automatic derivation of querying functions for servant
category: Servant, Web category: Servant, Web
@ -69,7 +70,7 @@ library
build-depends: build-depends:
base-compat >= 0.10.5 && < 0.11 base-compat >= 0.10.5 && < 0.11
, http-client >= 0.5.13.1 && < 0.7 , http-client >= 0.5.13.1 && < 0.7
, http-media >= 0.7.1.3 && < 0.8 , http-media >= 0.7.1.3 && < 0.9
, http-types >= 0.12.2 && < 0.13 , http-types >= 0.12.2 && < 0.13
, exceptions >= 0.10.0 && < 0.11 , exceptions >= 0.10.0 && < 0.11
, kan-extensions >= 5.2 && < 5.3 , kan-extensions >= 5.2 && < 5.3
@ -118,7 +119,7 @@ test-suite spec
, hspec >= 2.6.0 && < 2.8 , hspec >= 2.6.0 && < 2.8
, HUnit >= 1.6.0.0 && < 1.7 , HUnit >= 1.6.0.0 && < 1.7
, network >= 2.8.0.0 && < 3.1 , network >= 2.8.0.0 && < 3.1
, QuickCheck >= 2.12.6.1 && < 2.13 , QuickCheck >= 2.12.6.1 && < 2.14
, servant == 0.16.* , servant == 0.16.*
, servant-server == 0.16.* , servant-server == 0.16.*
, tdigest >= 0.2 && < 0.3 , tdigest >= 0.2 && < 0.3

View file

@ -1,7 +1,7 @@
cabal-version: >=1.10 cabal-version: >=1.10
name: servant-docs name: servant-docs
version: 0.11.3 version: 0.11.3
x-revision: 1 x-revision: 2
synopsis: generate API docs for your servant webservice synopsis: generate API docs for your servant webservice
category: Servant, Web category: Servant, Web
@ -63,7 +63,7 @@ library
, case-insensitive >= 1.2.0.11 && < 1.3 , case-insensitive >= 1.2.0.11 && < 1.3
, control-monad-omega >= 0.3.1 && < 0.4 , control-monad-omega >= 0.3.1 && < 0.4
, hashable >= 1.2.7.0 && < 1.3 , hashable >= 1.2.7.0 && < 1.3
, http-media >= 0.7.1.3 && < 0.8 , http-media >= 0.7.1.3 && < 0.9
, http-types >= 0.12.2 && < 0.13 , http-types >= 0.12.2 && < 0.13
, lens >= 4.17 && < 4.18 , lens >= 4.17 && < 4.18
, string-conversions >= 0.4.0.1 && < 0.5 , string-conversions >= 0.4.0.1 && < 0.5

View file

@ -1,6 +1,7 @@
cabal-version: >=1.10 cabal-version: >=1.10
name: servant-http-streams name: servant-http-streams
version: 0.16 version: 0.16
x-revision: 1
synopsis: Automatic derivation of querying functions for servant synopsis: Automatic derivation of querying functions for servant
category: Servant, Web category: Servant, Web
@ -67,7 +68,7 @@ library
base-compat >= 0.10.5 && < 0.11 base-compat >= 0.10.5 && < 0.11
, case-insensitive , case-insensitive
, http-streams >= 0.8.6.1 && < 0.9 , http-streams >= 0.8.6.1 && < 0.9
, http-media >= 0.7.1.3 && < 0.8 , http-media >= 0.7.1.3 && < 0.9
, io-streams >= 1.5.0.1 && < 1.6 , io-streams >= 1.5.0.1 && < 1.6
, http-types >= 0.12.2 && < 0.13 , http-types >= 0.12.2 && < 0.13
, http-common >= 0.8.2.0 && < 0.9 , http-common >= 0.8.2.0 && < 0.9
@ -119,7 +120,7 @@ test-suite spec
, hspec >= 2.6.0 && < 2.8 , hspec >= 2.6.0 && < 2.8
, HUnit >= 1.6.0.0 && < 1.7 , HUnit >= 1.6.0.0 && < 1.7
, network >= 2.8.0.0 && < 3.1 , network >= 2.8.0.0 && < 3.1
, QuickCheck >= 2.12.6.1 && < 2.13 , QuickCheck >= 2.12.6.1 && < 2.14
, servant == 0.16.* , servant == 0.16.*
, servant-server == 0.16.* , servant-server == 0.16.*
, tdigest >= 0.2 && < 0.3 , tdigest >= 0.2 && < 0.3

View file

@ -1,6 +1,7 @@
cabal-version: >=1.10 cabal-version: >=1.10
name: servant-server name: servant-server
version: 0.16 version: 0.16
x-revision: 1
synopsis: A family of combinators for defining webservices APIs and serving them synopsis: A family of combinators for defining webservices APIs and serving them
category: Servant, Web category: Servant, Web
@ -88,7 +89,7 @@ library
base-compat >= 0.10.5 && < 0.11 base-compat >= 0.10.5 && < 0.11
, base64-bytestring >= 1.0.0.1 && < 1.1 , base64-bytestring >= 1.0.0.1 && < 1.1
, exceptions >= 0.10.0 && < 0.11 , exceptions >= 0.10.0 && < 0.11
, http-media >= 0.7.1.3 && < 0.8 , http-media >= 0.7.1.3 && < 0.9
, http-types >= 0.12.2 && < 0.13 , http-types >= 0.12.2 && < 0.13
, network-uri >= 2.6.1.0 && < 2.8 , network-uri >= 2.6.1.0 && < 2.8
, monad-control >= 1.0.2.3 && < 1.1 , monad-control >= 1.0.2.3 && < 1.1
@ -165,7 +166,7 @@ test-suite spec
, directory >= 1.3.0.0 && < 1.4 , directory >= 1.3.0.0 && < 1.4
, hspec >= 2.6.0 && < 2.8 , hspec >= 2.6.0 && < 2.8
, hspec-wai >= 0.9.0 && < 0.10 , hspec-wai >= 0.9.0 && < 0.10
, QuickCheck >= 2.12.6.1 && < 2.13 , QuickCheck >= 2.12.6.1 && < 2.14
, should-not-typecheck >= 2.1.0 && < 2.2 , should-not-typecheck >= 2.1.0 && < 2.2
, temporary >= 1.3 && < 1.4 , temporary >= 1.3 && < 1.4
, wai-extra >= 3.0.24.3 && < 3.1 , wai-extra >= 3.0.24.3 && < 3.1

View file

@ -1,6 +1,7 @@
cabal-version: >=1.10 cabal-version: >=1.10
name: servant name: servant
version: 0.16 version: 0.16
x-revision: 1
synopsis: A family of combinators for defining webservices APIs synopsis: A family of combinators for defining webservices APIs
category: Servant, Web category: Servant, Web
@ -110,11 +111,11 @@ library
, bifunctors >= 5.5.3 && < 5.6 , bifunctors >= 5.5.3 && < 5.6
, case-insensitive >= 1.2.0.11 && < 1.3 , case-insensitive >= 1.2.0.11 && < 1.3
, deepseq >= 1.4.2.0 && < 1.5 , deepseq >= 1.4.2.0 && < 1.5
, http-media >= 0.7.1.3 && < 0.8 , http-media >= 0.7.1.3 && < 0.9
, http-types >= 0.12.2 && < 0.13 , http-types >= 0.12.2 && < 0.13
, mmorph >= 1.1.2 && < 1.2 , mmorph >= 1.1.2 && < 1.2
, network-uri >= 2.6.1.0 && < 2.7 , network-uri >= 2.6.1.0 && < 2.7
, QuickCheck >= 2.12.6.1 && <2.13 , QuickCheck >= 2.12.6.1 && < 2.14
, string-conversions >= 0.4.0.1 && < 0.5 , string-conversions >= 0.4.0.1 && < 0.5
, tagged >= 0.8.6 && < 0.9 , tagged >= 0.8.6 && < 0.9
, vault >= 0.3.1.2 && < 0.4 , vault >= 0.3.1.2 && < 0.4
@ -161,6 +162,7 @@ test-suite spec
, base-compat , base-compat
, aeson , aeson
, bytestring , bytestring
, http-media
, mtl , mtl
, servant , servant
, string-conversions , string-conversions
@ -170,7 +172,7 @@ test-suite spec
-- Additonal dependencies -- Additonal dependencies
build-depends: build-depends:
hspec >= 2.6.0 && < 2.8 hspec >= 2.6.0 && < 2.8
, QuickCheck >= 2.12.6.1 && < 2.13 , QuickCheck >= 2.12.6.1 && < 2.14
, quickcheck-instances >= 0.3.19 && < 0.4 , quickcheck-instances >= 0.3.19 && < 0.4
build-tool-depends: build-tool-depends:

View file

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses #-}
@ -20,7 +21,7 @@ import Data.Either
import Data.Function import Data.Function
(on) (on)
import Data.List import Data.List
(maximumBy) (sortBy)
import qualified Data.List.NonEmpty as NE import qualified Data.List.NonEmpty as NE
import Data.Maybe import Data.Maybe
(fromJust, isJust, isNothing) (fromJust, isJust, isNothing)
@ -134,17 +135,29 @@ spec = describe "Servant.API.ContentTypes" $ do
== Just ("application/json;charset=utf-8", encode x) == Just ("application/json;charset=utf-8", encode x)
it "respects the Accept spec ordering" $ do it "respects the Accept spec ordering" $ do
let highest a b c = maximumBy (compare `on` snd) let highest a b c = last $ sortBy (compare `on` snd)
-- when qualities are same, http-media-0.8 picks first; 0.7 last.
#if MIN_VERSION_http_media(0,8,0)
[ ("text/plain;charset=utf-8", c)
, ("application/json;charset=utf-8", b)
, ("application/octet-stream", a)
]
#else
[ ("application/octet-stream", a) [ ("application/octet-stream", a)
, ("application/json;charset=utf-8", b) , ("application/json;charset=utf-8", b)
, ("text/plain;charset=utf-8", c) , ("text/plain;charset=utf-8", c)
] ]
#endif
let acceptH a b c = addToAccept (Proxy :: Proxy OctetStream) a $ let acceptH a b c = addToAccept (Proxy :: Proxy OctetStream) a $
addToAccept (Proxy :: Proxy JSON) b $ addToAccept (Proxy :: Proxy JSON) b $
addToAccept (Proxy :: Proxy PlainText ) c "" addToAccept (Proxy :: Proxy PlainText ) c $
""
let val a b c i = handleAcceptH (Proxy :: Proxy '[OctetStream, JSON, PlainText]) let val a b c i = handleAcceptH (Proxy :: Proxy '[OctetStream, JSON, PlainText])
(acceptH a b c) (i :: Int) (acceptH a b c) (i :: Int)
property $ \a b c i -> fst (fromJust $ val a b c i) == fst (highest a b c) property $ \a b c i ->
let acc = acceptH a b c
in counterexample (show acc) $
fst (fromJust $ val a b c i) === fst (highest a b c)
describe "handleCTypeH" $ do describe "handleCTypeH" $ do