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
#
# version: 0.2.1
# version: 0.3.20190413
#
language: c
dist: xenial
git:
submodules: false # whether to recursively clone submodules
# whether to recursively clone submodules
submodules: false
branches:
only:
- master
- release-0.16
cache:
directories:
- $HOME/.cabal/packages
- $HOME/.cabal/store
before_cache:
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
# 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.tar
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
- rm -rfv $CABALHOME/packages/head.hackage
matrix:
include:
- compiler: "ghc-8.6.4"
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.4], sources: [hvr-ghc]}}
- compiler: "ghc-8.4.4"
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}}
- compiler: "ghc-8.2.2"
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}}
- compiler: "ghc-8.0.2"
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}}
- compiler: ghc-8.6.4
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.4","cabal-install-2.4"]}}
- compiler: ghc-8.4.4
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}
- compiler: ghc-8.2.2
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}
- compiler: ghc-8.0.2
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}
before_install:
- HC=/opt/ghc/bin/${CC}
- HCPKG=${HC/ghc/ghc-pkg}
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
- HCPKG="$HC-pkg"
- unset CC
- CABAL=/opt/ghc/bin/cabal
- CABALHOME=$HOME/.cabal
- 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/') ))
- 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:
- ${CABAL} --version
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
- TEST=--enable-tests
- BENCH=--enable-benchmarks
- GHCHEAD=${GHCHEAD-false}
- travis_retry ${CABAL} update -v
- sed -i.bak 's/^jobs:/-- jobs:/' $CABALHOME/config
- rm -fv cabal.project cabal.project.local
- "sed -i.bak 's/-- ghc-options:.*/ghc-options: -j2/' $CABALHOME/config"
- grep -Ev -- '^\s*--' $CABALHOME/config | grep -Ev '^\s*$'
- rm -f cabal.project
- rm -f $CABALHOME/config
- |
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
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
- "printf 'packages: \"servant\"\\n' >> cabal.project"
- "printf 'packages: \"servant-client\"\\n' >> cabal.project"
- "printf 'packages: \"servant-client-core\"\\n' >> cabal.project"
- "printf 'packages: \"servant-http-streams\"\\n' >> cabal.project"
- "printf 'packages: \"servant-docs\"\\n' >> cabal.project"
- "printf 'packages: \"servant-foreign\"\\n' >> cabal.project"
- "printf 'packages: \"servant-server\"\\n' >> cabal.project"
- "printf 'packages: \"doc/tutorial\"\\n' >> cabal.project"
- "printf 'packages: \"servant-machines\"\\n' >> cabal.project"
- "printf 'packages: \"servant-conduit\"\\n' >> cabal.project"
- "printf 'packages: \"servant-pipes\"\\n' >> cabal.project"
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"doc/cookbook/basic-auth\"\\n' >> cabal.project ; fi"
- "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 printf 'packages: \"doc/cookbook/basic-streaming\"\\n' >> 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 printf 'packages: \"doc/cookbook/db-sqlite-simple\"\\n' >> 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 printf 'packages: \"doc/cookbook/generic\"\\n' >> 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 printf 'packages: \"doc/cookbook/pagination\"\\n' >> 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 printf 'packages: \"doc/cookbook/structuring-apis\"\\n' >> 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 printf 'packages: \"doc/cookbook/using-free-client\"\\n' >> cabal.project ; fi"
- "echo 'constraints: foundation >=0.0.14' >> cabal.project"
- "echo 'constraints: memory <0.14.12 || >0.14.12' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:servant' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:servant-client' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:servant-server' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:hspec' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:http-client' >> cabal.project"
- "echo 'optimization: False' >> cabal.project "
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
- touch cabal.project.local
- |
echo 'packages: "servant"' >> cabal.project
echo 'packages: "servant-client"' >> cabal.project
echo 'packages: "servant-client-core"' >> cabal.project
echo 'packages: "servant-http-streams"' >> cabal.project
echo 'packages: "servant-docs"' >> cabal.project
echo 'packages: "servant-foreign"' >> cabal.project
echo 'packages: "servant-server"' >> cabal.project
echo 'packages: "doc/tutorial"' >> cabal.project
echo 'packages: "servant-machines"' >> cabal.project
echo 'packages: "servant-conduit"' >> cabal.project
echo 'packages: "servant-pipes"' >> cabal.project
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 echo 'packages: "doc/cookbook/curl-mock"' >> 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 echo 'packages: "doc/cookbook/db-postgres-pool"' >> 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 echo 'packages: "doc/cookbook/file-upload"' >> 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 echo 'packages: "doc/cookbook/https"' >> 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 echo 'packages: "doc/cookbook/testing"' >> 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 echo 'packages: "doc/cookbook/using-custom-monad"' >> cabal.project ; fi
if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "doc/cookbook/using-free-client"' >> cabal.project ; fi
- |
echo "constraints: foundation >=0.0.14" >> cabal.project
echo "constraints: memory <0.14.12 || >0.14.12" >> cabal.project
echo "allow-newer: servant-quickcheck:servant" >> cabal.project
echo "allow-newer: servant-quickcheck:servant-client" >> cabal.project
echo "allow-newer: servant-quickcheck:servant-server" >> cabal.project
echo "allow-newer: servant-quickcheck:hspec" >> cabal.project
echo "allow-newer: servant-quickcheck:http-client" >> cabal.project
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"
- cat cabal.project || 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/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
- rm -f cabal.project.freeze
- 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
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# 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.
- ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
- rm cabal.project.freeze
script:
# test that source-distributions can be generated
- echo Packaging... && echo -en 'travis_fold:start:sdist\\r'
- ${CABAL} new-sdist all
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# Packaging...
- echo 'Packaging...' && echo -en 'travis_fold:start:sdist\\r'
- ${CABAL} v2-sdist all | color_cabal_output
- 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}/
- cd ${DISTDIR} || false
- 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
- "printf 'packages: \"servant-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"servant-client-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"servant-client-core-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"servant-http-streams-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"servant-docs-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"servant-foreign-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"servant-server-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"tutorial-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"servant-machines-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"servant-conduit-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"servant-pipes-*/*.cabal\"\\n' >> cabal.project"
- "if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then printf 'packages: \"cookbook-basic-auth-*/*.cabal\"\\n' >> cabal.project ; fi"
- "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 printf 'packages: \"cookbook-basic-streaming-*/*.cabal\"\\n' >> 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 printf 'packages: \"cookbook-db-sqlite-simple-*/*.cabal\"\\n' >> 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 printf 'packages: \"cookbook-generic-*/*.cabal\"\\n' >> 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 printf 'packages: \"cookbook-pagination-*/*.cabal\"\\n' >> 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 printf 'packages: \"cookbook-structuring-apis-*/*.cabal\"\\n' >> 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 printf 'packages: \"cookbook-using-free-client-*/*.cabal\"\\n' >> cabal.project ; fi"
- "echo 'constraints: foundation >=0.0.14' >> cabal.project"
- "echo 'constraints: memory <0.14.12 || >0.14.12' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:servant' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:servant-client' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:servant-server' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:hspec' >> cabal.project"
- "echo 'allow-newer: servant-quickcheck:http-client' >> cabal.project"
- "echo 'optimization: False' >> cabal.project "
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
- touch cabal.project.local
- |
echo 'packages: "servant-*/*.cabal"' >> cabal.project
echo 'packages: "servant-client-*/*.cabal"' >> cabal.project
echo 'packages: "servant-client-core-*/*.cabal"' >> cabal.project
echo 'packages: "servant-http-streams-*/*.cabal"' >> cabal.project
echo 'packages: "servant-docs-*/*.cabal"' >> cabal.project
echo 'packages: "servant-foreign-*/*.cabal"' >> cabal.project
echo 'packages: "servant-server-*/*.cabal"' >> cabal.project
echo 'packages: "tutorial-*/*.cabal"' >> cabal.project
echo 'packages: "servant-machines-*/*.cabal"' >> cabal.project
echo 'packages: "servant-conduit-*/*.cabal"' >> cabal.project
echo 'packages: "servant-pipes-*/*.cabal"' >> cabal.project
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 echo 'packages: "cookbook-curl-mock-*/*.cabal"' >> 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 echo 'packages: "cookbook-db-postgres-pool-*/*.cabal"' >> 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 echo 'packages: "cookbook-file-upload-*/*.cabal"' >> 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 echo 'packages: "cookbook-https-*/*.cabal"' >> 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 echo 'packages: "cookbook-testing-*/*.cabal"' >> 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 echo 'packages: "cookbook-using-custom-monad-*/*.cabal"' >> cabal.project ; fi
if [ $HCNUMVER -eq 80404 ] || [ $HCNUMVER -eq 80604 ] ; then echo 'packages: "cookbook-using-free-client-*/*.cabal"' >> cabal.project ; fi
- |
echo "constraints: foundation >=0.0.14" >> cabal.project
echo "constraints: memory <0.14.12 || >0.14.12" >> cabal.project
echo "allow-newer: servant-quickcheck:servant" >> cabal.project
echo "allow-newer: servant-quickcheck:servant-client" >> cabal.project
echo "allow-newer: servant-quickcheck:servant-server" >> cabal.project
echo "allow-newer: servant-quickcheck:hspec" >> cabal.project
echo "allow-newer: servant-quickcheck:http-client" >> cabal.project
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"
- cat cabal.project || true
- cat cabal.project.local || true
- echo -en 'travis_fold:end:unpack\\r'
- echo Building with tests and benchmarks... && echo -en 'travis_fold:start:build-everything\\r'
# Building with tests and benchmarks...
- echo 'Building with tests and benchmarks...' && echo -en 'travis_fold:start:build-everything\\r'
# 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'
- if [ "x$TEST" = "x--enable-tests" ]; then ${CABAL} new-test -w ${HC} ${TEST} ${BENCH} all; fi
- echo Haddock... && echo -en 'travis_fold:start:haddock\\r'
# haddock
- ${CABAL} new-haddock -w ${HC} ${TEST} ${BENCH} all
# Testing...
- ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
# haddock...
- echo 'haddock...' && echo -en 'travis_fold:start:haddock\\r'
- ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
- 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"]
# EOF

View file

@ -1,5 +1,5 @@
folds: all-but-test
branches: master
branches: master release-0.16
jobs-selection: any
-- 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
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:hspec,
servant-quickcheck:http-client
allow-newer: http-media

View file

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

View file

@ -45,7 +45,7 @@ library
, exceptions >=0.8 && <0.11
, ghcjs-base >=0.2.0.0 && <0.3.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
, monad-control >=1.0.0.4 && <1.1
, mtl >=2.2.2 && <2.3

View file

@ -1,6 +1,7 @@
cabal-version: >=1.10
name: servant-client
version: 0.16
x-revision: 1
synopsis: Automatic derivation of querying functions for servant
category: Servant, Web
@ -69,7 +70,7 @@ library
build-depends:
base-compat >= 0.10.5 && < 0.11
, 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
, exceptions >= 0.10.0 && < 0.11
, kan-extensions >= 5.2 && < 5.3
@ -118,7 +119,7 @@ test-suite spec
, hspec >= 2.6.0 && < 2.8
, HUnit >= 1.6.0.0 && < 1.7
, 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-server == 0.16.*
, tdigest >= 0.2 && < 0.3

View file

@ -1,7 +1,7 @@
cabal-version: >=1.10
name: servant-docs
version: 0.11.3
x-revision: 1
x-revision: 2
synopsis: generate API docs for your servant webservice
category: Servant, Web
@ -63,7 +63,7 @@ library
, case-insensitive >= 1.2.0.11 && < 1.3
, control-monad-omega >= 0.3.1 && < 0.4
, 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
, lens >= 4.17 && < 4.18
, string-conversions >= 0.4.0.1 && < 0.5

View file

@ -1,6 +1,7 @@
cabal-version: >=1.10
name: servant-http-streams
version: 0.16
x-revision: 1
synopsis: Automatic derivation of querying functions for servant
category: Servant, Web
@ -67,7 +68,7 @@ library
base-compat >= 0.10.5 && < 0.11
, case-insensitive
, 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
, http-types >= 0.12.2 && < 0.13
, http-common >= 0.8.2.0 && < 0.9
@ -119,7 +120,7 @@ test-suite spec
, hspec >= 2.6.0 && < 2.8
, HUnit >= 1.6.0.0 && < 1.7
, 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-server == 0.16.*
, tdigest >= 0.2 && < 0.3

View file

@ -1,6 +1,7 @@
cabal-version: >=1.10
name: servant-server
version: 0.16
x-revision: 1
synopsis: A family of combinators for defining webservices APIs and serving them
category: Servant, Web
@ -88,7 +89,7 @@ library
base-compat >= 0.10.5 && < 0.11
, base64-bytestring >= 1.0.0.1 && < 1.1
, 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
, network-uri >= 2.6.1.0 && < 2.8
, monad-control >= 1.0.2.3 && < 1.1
@ -165,7 +166,7 @@ test-suite spec
, directory >= 1.3.0.0 && < 1.4
, hspec >= 2.6.0 && < 2.8
, 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
, temporary >= 1.3 && < 1.4
, wai-extra >= 3.0.24.3 && < 3.1

View file

@ -1,6 +1,7 @@
cabal-version: >=1.10
name: servant
version: 0.16
x-revision: 1
synopsis: A family of combinators for defining webservices APIs
category: Servant, Web
@ -110,11 +111,11 @@ library
, bifunctors >= 5.5.3 && < 5.6
, case-insensitive >= 1.2.0.11 && < 1.3
, 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
, mmorph >= 1.1.2 && < 1.2
, 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
, tagged >= 0.8.6 && < 0.9
, vault >= 0.3.1.2 && < 0.4
@ -161,6 +162,7 @@ test-suite spec
, base-compat
, aeson
, bytestring
, http-media
, mtl
, servant
, string-conversions
@ -170,7 +172,7 @@ test-suite spec
-- Additonal dependencies
build-depends:
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
build-tool-depends:

View file

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE MultiParamTypeClasses #-}
@ -20,7 +21,7 @@ import Data.Either
import Data.Function
(on)
import Data.List
(maximumBy)
(sortBy)
import qualified Data.List.NonEmpty as NE
import Data.Maybe
(fromJust, isJust, isNothing)
@ -134,17 +135,29 @@ spec = describe "Servant.API.ContentTypes" $ do
== Just ("application/json;charset=utf-8", encode x)
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/json;charset=utf-8", b)
, ("text/plain;charset=utf-8", c)
]
#endif
let acceptH a b c = addToAccept (Proxy :: Proxy OctetStream) a $
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])
(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