on master help sign in
Merge pull request #840 from haskell-servant/release-0.11-travis-new-build
8973cf5Oleg Grenrus
.gitignore+1
@@ -1,4 +1,5 @@
1**/*/dist
1**/*/dist
2+.ghc.environment.*
2dist-newstyle
3dist-newstyle
3/bin
4/bin
4/lib
5/lib
.travis.yml+104−22
@@ -1,31 +1,113 @@
1+# This Travis job script has been generated by a script via
2+#
3+# make_travis_yml_2.hs '-o' '.travis.yml' 'cabal.project'
4+#
5+# For more information, see https://github.com/hvr/multi-ghc-travis
6+#
7+language: c
1sudo: false
8sudo: false
2−dist: trusty
3
9
4−language: c
10+git:
11+ submodules: false # whether to recursively clone submodules
12+
13+cache:
14+ directories:
15+ - $HOME/.cabal/packages
16+ - $HOME/.cabal/store
17+
18+before_cache:
19+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
20+ # remove files that are regenerated by 'cabal update'
21+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
22+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
23+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
24+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
25+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
5
26
6−env:
27+matrix:
7− - STACK_YAML=stack-ghc-7.8.4.yaml
28+ include:
8− - STACK_YAML=stack-ghc-7.10.3.yaml
29+ - compiler: "ghc-7.8.4"
9− - STACK_YAML=stack.yaml
30+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
10− - STACK_YAML=stack-ghc-8.2.1.yaml
31+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.4], sources: [hvr-ghc]}}
32+ - compiler: "ghc-7.10.3"
33+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
34+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}
35+ - compiler: "ghc-8.0.2"
36+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
37+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
38+ - compiler: "ghc-8.2.1"
39+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
40+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
11
41
12−addons:
42+before_install:
13− apt:
43+ - HC=${CC}
14− packages:
44+ - HCPKG=${HC/ghc/ghc-pkg}
15− - libgmp-dev
45+ - unset CC
46+ - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
16
47
17install:
48install:
18− - mkdir -p ~/.local/bin
49+ - cabal --version
19− - export PATH=$HOME/.local/bin:$PATH
50+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
20− - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
51+ - BENCH=${BENCH---enable-benchmarks}
21− - stack --version
52+ - TEST=${TEST---enable-tests}
22− - stack setup --no-terminal
53+ - HADDOCK=${HADDOCK-true}
23− - (cd $HOME/.local/bin && wget https://zalora-public.s3.amazonaws.com/tinc && chmod +x tinc)
54+ - INSTALLED=${INSTALLED-true}
55+ - travis_retry cabal update -v
56+ - sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
57+ - rm -fv cabal.project.local
58+ - if [ -f "servant/configure.ac" ]; then
59+ (cd "servant"; autoreconf -i);
60+ fi
61+ - if [ -f "servant-client/configure.ac" ]; then
62+ (cd "servant-client"; autoreconf -i);
63+ fi
64+ - if [ -f "servant-docs/configure.ac" ]; then
65+ (cd "servant-docs"; autoreconf -i);
66+ fi
67+ - if [ -f "servant-foreign/configure.ac" ]; then
68+ (cd "servant-foreign"; autoreconf -i);
69+ fi
70+ - if [ -f "servant-server/configure.ac" ]; then
71+ (cd "servant-server"; autoreconf -i);
72+ fi
73+ - if [ -f "doc/tutorial/configure.ac" ]; then
74+ (cd "doc/tutorial"; autoreconf -i);
75+ fi
76+ - rm -f cabal.project.freeze
77+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 servant-server servant-client
78+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 servant-server servant-client
79+ - rm -rf "servant"/.ghc.environment.* "servant-client"/.ghc.environment.* "servant-docs"/.ghc.environment.* "servant-foreign"/.ghc.environment.* "servant-server"/.ghc.environment.* "doc/tutorial"/.ghc.environment.* "servant"/dist "servant-client"/dist "servant-docs"/dist "servant-foreign"/dist "servant-server"/dist "doc/tutorial"/dist
80+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
24
81
82+# Here starts the actual work to be performed for the package under test;
83+# any command which exits with a non-zero exit code causes the build to fail.
25script:
84script:
26− - if [ "$TRAVIS_EVENT_TYPE" = "cron" ] ; then ./scripts/ci-cron.sh ; else stack test --ghc-options=-Werror --no-terminal ; fi
85+ # test that source-distributions can be generated
86+ - (cd "servant"; cabal sdist)
87+ - (cd "servant-client"; cabal sdist)
88+ - (cd "servant-docs"; cabal sdist)
89+ - (cd "servant-foreign"; cabal sdist)
90+ - (cd "servant-server"; cabal sdist)
91+ - (cd "doc/tutorial"; cabal sdist)
92+ - mv "servant"/dist/servant-*.tar.gz "servant-client"/dist/servant-client-*.tar.gz "servant-docs"/dist/servant-docs-*.tar.gz "servant-foreign"/dist/servant-foreign-*.tar.gz "servant-server"/dist/servant-server-*.tar.gz "doc/tutorial"/dist/tutorial-*.tar.gz ${DISTDIR}/
93+ - cd ${DISTDIR}
94+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
95+ - "printf 'packages: servant-*/*.cabal servant-client-*/*.cabal servant-docs-*/*.cabal servant-foreign-*/*.cabal servant-server-*/*.cabal tutorial-*/*.cabal\n' > cabal.project"
96+ # this builds all libraries and executables (without tests/benchmarks)
97+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
27
98
28−cache:
99+ # Build with installed constraints for packages in global-db
29− directories:
100+ - if $INSTALLED; then
30− - $HOME/.tinc/cache
101+ echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh;
31− - $HOME/.stack
102+ else echo "Not building with installed constraints"; fi
103+
104+ # build & run tests, build benchmarks
105+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
106+ - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
107+
108+ # haddock
109+ - rm -rf ./dist-newstyle
110+ - if $HADDOCK; then cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all; else echo "Skipping haddock generation";fi
111+
112+# REGENDATA ["-o",".travis.yml","cabal.project"]
113+# EOF
cabal.project+1−2
@@ -1,5 +1,4 @@
1−packages:
1+packages: servant/
2− servant/
3 servant-client/
2 servant-client/
4 servant-docs/
3 servant-docs/
5 servant-foreign/
4 servant-foreign/
doc/tutorial/tutorial.cabal+12−1
@@ -8,6 +8,14 @@ author: Servant Contributors
8maintainer: haskell-servant-maintainers@googlegroups.com
8maintainer: haskell-servant-maintainers@googlegroups.com
9build-type: Simple
9build-type: Simple
10cabal-version: >=1.10
10cabal-version: >=1.10
11+tested-with:
12+ GHC==7.8.4
13+ GHC==7.10.3
14+ GHC==8.0.2
15+ GHC==8.2.1
16+extra-source-files:
17+ static/index.html
18+ static/ui.js
11
19
12library
20library
13 exposed-modules: ApiType
21 exposed-modules: ApiType
@@ -37,7 +45,8 @@ library
37 , string-conversions
45 , string-conversions
38 , bytestring
46 , bytestring
39 , attoparsec
47 , attoparsec
40− , mtl
48+ , mtl >=2.1 && <2.3
49+ , mtl-compat
41 , random
50 , random
42 , js-jquery
51 , js-jquery
43 , wai
52 , wai
@@ -56,6 +65,8 @@ test-suite spec
56 hs-source-dirs: test
65 hs-source-dirs: test
57 main-is: Spec.hs
66 main-is: Spec.hs
58 other-modules: JavascriptSpec
67 other-modules: JavascriptSpec
68+ build-tool-depends:
69+ hspec-discover:hspec-discover
59 build-depends: base == 4.*
70 build-depends: base == 4.*
60 , tutorial
71 , tutorial
61 , hspec
72 , hspec
servant-client/servant-client.cabal+7−1
@@ -17,7 +17,11 @@ copyright: 2014-2016 Zalora South East Asia Pte Ltd, Servant Contribut
17category: Servant Web
17category: Servant Web
18build-type: Simple
18build-type: Simple
19cabal-version: >=1.10
19cabal-version: >=1.10
20−tested-with: GHC >= 7.8
20+tested-with:
21+ GHC==7.8.4
22+ GHC==7.10.3
23+ GHC==8.0.2
24+ GHC==8.2.1
21homepage: http://haskell-servant.readthedocs.org/
25homepage: http://haskell-servant.readthedocs.org/
22Bug-reports: http://github.com/haskell-servant/servant/issues
26Bug-reports: http://github.com/haskell-servant/servant/issues
23extra-source-files:
27extra-source-files:
@@ -77,6 +81,8 @@ test-suite spec
77 default-language: Haskell2010
81 default-language: Haskell2010
78 hs-source-dirs: test
82 hs-source-dirs: test
79 main-is: Spec.hs
83 main-is: Spec.hs
84+ build-tool-depends:
85+ hspec-discover:hspec-discover
80 other-modules:
86 other-modules:
81 Servant.ClientSpec
87 Servant.ClientSpec
82 , Servant.Common.BaseUrlSpec
88 , Servant.Common.BaseUrlSpec
servant-docs/servant-docs.cabal+7−1
@@ -15,7 +15,11 @@ copyright: 2014-2016 Zalora South East Asia Pte Ltd, Servant Contribut
15category: Servant Web
15category: Servant Web
16build-type: Simple
16build-type: Simple
17cabal-version: >=1.10
17cabal-version: >=1.10
18−tested-with: GHC >= 7.8
18+tested-with:
19+ GHC==7.8.4
20+ GHC==7.10.3
21+ GHC==8.0.2
22+ GHC==8.2.1
19homepage: http://haskell-servant.readthedocs.org/
23homepage: http://haskell-servant.readthedocs.org/
20Bug-reports: http://github.com/haskell-servant/servant/issues
24Bug-reports: http://github.com/haskell-servant/servant/issues
21extra-source-files:
25extra-source-files:
@@ -75,6 +79,8 @@ test-suite spec
75 type: exitcode-stdio-1.0
79 type: exitcode-stdio-1.0
76 main-is: Spec.hs
80 main-is: Spec.hs
77 other-modules: Servant.DocsSpec
81 other-modules: Servant.DocsSpec
82+ build-tool-depends:
83+ hspec-discover:hspec-discover
78 hs-source-dirs: test
84 hs-source-dirs: test
79 ghc-options: -Wall
85 ghc-options: -Wall
80 build-depends:
86 build-depends:
servant-foreign/servant-foreign.cabal+8
@@ -22,6 +22,12 @@ extra-source-files:
22 CHANGELOG.md
22 CHANGELOG.md
23 README.md
23 README.md
24bug-reports: http://github.com/haskell-servant/servant/issues
24bug-reports: http://github.com/haskell-servant/servant/issues
25+tested-with:
26+ GHC==7.8.4
27+ GHC==7.10.3
28+ GHC==8.0.2
29+ GHC==8.2.1
30+
25source-repository head
31source-repository head
26 type: git
32 type: git
27 location: http://github.com/haskell-servant/servant.git
33 location: http://github.com/haskell-servant/servant.git
@@ -65,6 +71,8 @@ test-suite spec
65 include-dirs: include
71 include-dirs: include
66 main-is: Spec.hs
72 main-is: Spec.hs
67 other-modules: Servant.ForeignSpec
73 other-modules: Servant.ForeignSpec
74+ build-tool-depends:
75+ hspec-discover:hspec-discover
68 build-depends: base
76 build-depends: base
69 , hspec >= 2.1.8
77 , hspec >= 2.1.8
70 , servant
78 , servant
servant-server/servant-server.cabal+8−3
@@ -1,6 +1,5 @@
1name: servant-server
1name: servant-server
2−version: 0.11
2+version: 0.11.0.1
3−x-revision: 2
4synopsis: A family of combinators for defining webservices APIs and serving them
3synopsis: A family of combinators for defining webservices APIs and serving them
5description:
4description:
6 A family of combinators for defining webservices APIs and serving them
5 A family of combinators for defining webservices APIs and serving them
@@ -22,7 +21,11 @@ copyright: 2014-2016 Zalora South East Asia Pte Ltd, Servant Contribut
22category: Servant Web
21category: Servant Web
23build-type: Custom
22build-type: Custom
24cabal-version: >=1.10
23cabal-version: >=1.10
25−tested-with: GHC >= 7.8
24+tested-with:
25+ GHC==7.8.4
26+ GHC==7.10.3
27+ GHC==8.0.2
28+ GHC==8.2.1
26extra-source-files:
29extra-source-files:
27 include/*.h
30 include/*.h
28 CHANGELOG.md
31 CHANGELOG.md
@@ -121,6 +124,8 @@ test-suite spec
121 Servant.Server.UsingContextSpec.TestCombinators
124 Servant.Server.UsingContextSpec.TestCombinators
122 Servant.ServerSpec
125 Servant.ServerSpec
123 Servant.Utils.StaticFilesSpec
126 Servant.Utils.StaticFilesSpec
127+ build-tool-depends:
128+ hspec-discover:hspec-discover
124 build-depends:
129 build-depends:
125 base == 4.*
130 base == 4.*
126 , base-compat
131 , base-compat
servant-server/test/Servant/ServerSpec.hs+11−2
@@ -28,7 +28,11 @@ import Network.HTTP.Types (Status (..), hAccept, hContentType,
28 methodDelete, methodGet,
28 methodDelete, methodGet,
29 methodHead, methodPatch,
29 methodHead, methodPatch,
30 methodPost, methodPut, ok200,
30 methodPost, methodPut, ok200,
31+#if MIN_VERSION_http_types(0,10,0)
32+ imATeapot418,
33+#else
31 imATeaPot418,
34 imATeaPot418,
35+#endif
32 parseQuery)
36 parseQuery)
33import Network.Wai (Application, Request, requestHeaders, pathInfo,
37import Network.Wai (Application, Request, requestHeaders, pathInfo,
34 queryString, rawQueryString,
38 queryString, rawQueryString,
@@ -65,6 +69,11 @@ import Servant.Server.Experimental.Auth
65import Servant.Server.Internal.Context
69import Servant.Server.Internal.Context
66 (NamedContext(..))
70 (NamedContext(..))
67
71
72+#if !MIN_VERSION_http_types(0,10,0)
73+imATeapot418 :: Status
74+imATeapot418 = imATeaPot418
75+#endif
76+
68-- * comprehensive api test
77-- * comprehensive api test
69
78
70-- This declaration simply checks that all instances are in place.
79-- This declaration simply checks that all instances are in place.
@@ -657,7 +666,7 @@ basicAuthApi = Proxy
657basicAuthServer :: Server BasicAuthAPI
666basicAuthServer :: Server BasicAuthAPI
658basicAuthServer =
667basicAuthServer =
659 const (return jerry) :<|>
668 const (return jerry) :<|>
660− (Tagged $ \ _ respond -> respond $ responseLBS imATeaPot418 [] "")
669+ (Tagged $ \ _ respond -> respond $ responseLBS imATeapot418 [] "")
661
670
662basicAuthContext :: Context '[ BasicAuthCheck () ]
671basicAuthContext :: Context '[ BasicAuthCheck () ]
663basicAuthContext =
672basicAuthContext =
@@ -702,7 +711,7 @@ genAuthApi = Proxy
702
711
703genAuthServer :: Server GenAuthAPI
712genAuthServer :: Server GenAuthAPI
704genAuthServer = const (return tweety)
713genAuthServer = const (return tweety)
705− :<|> (Tagged $ \ _ respond -> respond $ responseLBS imATeaPot418 [] "")
714+ :<|> (Tagged $ \ _ respond -> respond $ responseLBS imATeapot418 [] "")
706
715
707type instance AuthServerData (AuthProtect "auth") = ()
716type instance AuthServerData (AuthProtect "auth") = ()
708
717
servant/servant.cabal+7−1
@@ -18,7 +18,11 @@ copyright: 2014-2016 Zalora South East Asia Pte Ltd, Servant Contribut
18category: Servant Web
18category: Servant Web
19build-type: Custom
19build-type: Custom
20cabal-version: >=1.10
20cabal-version: >=1.10
21−tested-with: GHC >= 7.8
21+tested-with:
22+ GHC==7.8.4
23+ GHC==7.10.3
24+ GHC==8.0.2
25+ GHC==8.2.1
22extra-source-files:
26extra-source-files:
23 include/*.h
27 include/*.h
24 CHANGELOG.md
28 CHANGELOG.md
@@ -118,6 +122,8 @@ test-suite spec
118 Servant.API.ResponseHeadersSpec
122 Servant.API.ResponseHeadersSpec
119 Servant.Utils.LinksSpec
123 Servant.Utils.LinksSpec
120 Servant.Utils.EnterSpec
124 Servant.Utils.EnterSpec
125+ build-tool-depends:
126+ hspec-discover:hspec-discover
121 build-depends:
127 build-depends:
122 base == 4.*
128 base == 4.*
123 , base-compat
129 , base-compat