From 98a12c328bd5d22df8efcea0c421bd15651c64b2 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Wed, 17 Jan 2018 21:43:00 +0200 Subject: [PATCH] Reinstate cookbook testing to CI --- .travis.yml | 61 +++++++++++-------- cabal.make-travis-yml | 7 +++ cabal.project | 11 +--- doc/cookbook/basic-auth/basic-auth.cabal | 3 +- .../db-postgres-pool/db-postgres-pool.cabal | 4 +- .../db-sqlite-simple/db-sqlite-simple.cabal | 4 +- doc/cookbook/file-upload/file-upload.cabal | 6 +- doc/cookbook/https/https.cabal | 3 +- .../jwt-and-basic-auth.cabal | 13 ++-- .../structuring-apis/structuring-apis.cabal | 3 +- .../using-custom-monad.cabal | 5 +- 11 files changed, 66 insertions(+), 54 deletions(-) diff --git a/.travis.yml b/.travis.yml index 98a6a951..daa85310 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,7 +69,7 @@ install: - rm -fv cabal.project cabal.project.local - "if [ $HCNUMVER -ge 70800 ]; then sed -i.bak 's/-- ghc-options:.*/ghc-options: -j2/' ${HOME}/.cabal/config; fi" - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' - - "printf 'packages: \"servant\" \"servant-client\" \"servant-client-core\" \"servant-docs\" \"servant-foreign\" \"servant-server\" \"doc/tutorial\"\\n' > cabal.project" + - "printf 'packages: \"servant\" \"servant-client\" \"servant-client-core\" \"servant-docs\" \"servant-foreign\" \"servant-server\" \"doc/tutorial\" \"doc/cookbook/db-postgres-pool\" \"doc/cookbook/jwt-and-basic-auth\" \"doc/cookbook/db-sqlite-simple\" \"doc/cookbook/basic-auth\" \"doc/cookbook/https\" \"doc/cookbook/structuring-apis\" \"doc/cookbook/using-custom-monad\" \"doc/cookbook/file-upload\"\\n' > cabal.project" - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project" - "echo 'allow-newer: servant-js:servant-foreign' >> cabal.project" - cat cabal.project @@ -94,8 +94,32 @@ install: - if [ -f "doc/tutorial/configure.ac" ]; then (cd "doc/tutorial" && autoreconf -i); fi + - if [ -f "doc/cookbook/db-postgres-pool/configure.ac" ]; then + (cd "doc/cookbook/db-postgres-pool" && autoreconf -i); + fi + - if [ -f "doc/cookbook/jwt-and-basic-auth/configure.ac" ]; then + (cd "doc/cookbook/jwt-and-basic-auth" && autoreconf -i); + fi + - if [ -f "doc/cookbook/db-sqlite-simple/configure.ac" ]; then + (cd "doc/cookbook/db-sqlite-simple" && autoreconf -i); + fi + - if [ -f "doc/cookbook/basic-auth/configure.ac" ]; then + (cd "doc/cookbook/basic-auth" && autoreconf -i); + fi + - if [ -f "doc/cookbook/https/configure.ac" ]; then + (cd "doc/cookbook/https" && 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/file-upload/configure.ac" ]; then + (cd "doc/cookbook/file-upload" && autoreconf -i); + fi - rm -f cabal.project.freeze - - rm -rf "servant"/.ghc.environment.* "servant-client"/.ghc.environment.* "servant-client-core"/.ghc.environment.* "servant-docs"/.ghc.environment.* "servant-foreign"/.ghc.environment.* "servant-server"/.ghc.environment.* "doc/tutorial"/.ghc.environment.* "servant"/dist "servant-client"/dist "servant-client-core"/dist "servant-docs"/dist "servant-foreign"/dist "servant-server"/dist "doc/tutorial"/dist + - rm -rf "servant"/.ghc.environment.* "servant-client"/.ghc.environment.* "servant-client-core"/.ghc.environment.* "servant-docs"/.ghc.environment.* "servant-foreign"/.ghc.environment.* "servant-server"/.ghc.environment.* "doc/tutorial"/.ghc.environment.* "doc/cookbook/db-postgres-pool"/.ghc.environment.* "doc/cookbook/jwt-and-basic-auth"/.ghc.environment.* "doc/cookbook/db-sqlite-simple"/.ghc.environment.* "doc/cookbook/basic-auth"/.ghc.environment.* "doc/cookbook/https"/.ghc.environment.* "doc/cookbook/structuring-apis"/.ghc.environment.* "doc/cookbook/using-custom-monad"/.ghc.environment.* "doc/cookbook/file-upload"/.ghc.environment.* "servant"/dist "servant-client"/dist "servant-client-core"/dist "servant-docs"/dist "servant-foreign"/dist "servant-server"/dist "doc/tutorial"/dist "doc/cookbook/db-postgres-pool"/dist "doc/cookbook/jwt-and-basic-auth"/dist "doc/cookbook/db-sqlite-simple"/dist "doc/cookbook/basic-auth"/dist "doc/cookbook/https"/dist "doc/cookbook/structuring-apis"/dist "doc/cookbook/using-custom-monad"/dist "doc/cookbook/file-upload"/dist - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) # Here starts the actual work to be performed for the package under test; @@ -110,43 +134,32 @@ script: - (cd "servant-foreign" && cabal sdist) - (cd "servant-server" && cabal sdist) - (cd "doc/tutorial" && cabal sdist) + - (cd "doc/cookbook/db-postgres-pool" && cabal sdist) + - (cd "doc/cookbook/jwt-and-basic-auth" && cabal sdist) + - (cd "doc/cookbook/db-sqlite-simple" && cabal sdist) + - (cd "doc/cookbook/basic-auth" && cabal sdist) + - (cd "doc/cookbook/https" && cabal sdist) + - (cd "doc/cookbook/structuring-apis" && cabal sdist) + - (cd "doc/cookbook/using-custom-monad" && cabal sdist) + - (cd "doc/cookbook/file-upload" && cabal sdist) - echo -en 'travis_fold:end:sdist\\r' - echo Unpacking... && echo -en 'travis_fold:start:unpack\\r' - - mv "servant"/dist/servant-*.tar.gz "servant-client"/dist/servant-client-*.tar.gz "servant-client-core"/dist/servant-client-core-*.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}/ + - mv "servant"/dist/servant-*.tar.gz "servant-client"/dist/servant-client-*.tar.gz "servant-client-core"/dist/servant-client-core-*.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 "doc/cookbook/db-postgres-pool"/dist/cookbook-db-postgres-pool-*.tar.gz "doc/cookbook/jwt-and-basic-auth"/dist/cookbook-jwt-and-basic-auth-*.tar.gz "doc/cookbook/db-sqlite-simple"/dist/cookbook-db-sqlite-simple-*.tar.gz "doc/cookbook/basic-auth"/dist/cookbook-basic-auth-*.tar.gz "doc/cookbook/https"/dist/cookbook-https-*.tar.gz "doc/cookbook/structuring-apis"/dist/cookbook-structuring-apis-*.tar.gz "doc/cookbook/using-custom-monad"/dist/cookbook-using-custom-monad-*.tar.gz "doc/cookbook/file-upload"/dist/cookbook-file-upload-*.tar.gz ${DISTDIR}/ - cd ${DISTDIR} || false - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; - - "printf 'packages: servant-*/*.cabal servant-client-*/*.cabal servant-client-core-*/*.cabal servant-docs-*/*.cabal servant-foreign-*/*.cabal servant-server-*/*.cabal tutorial-*/*.cabal\\n' > cabal.project" + - "printf 'packages: servant-*/*.cabal servant-client-*/*.cabal servant-client-core-*/*.cabal servant-docs-*/*.cabal servant-foreign-*/*.cabal servant-server-*/*.cabal tutorial-*/*.cabal cookbook-db-postgres-pool-*/*.cabal cookbook-jwt-and-basic-auth-*/*.cabal cookbook-db-sqlite-simple-*/*.cabal cookbook-basic-auth-*/*.cabal cookbook-https-*/*.cabal cookbook-structuring-apis-*/*.cabal cookbook-using-custom-monad-*/*.cabal cookbook-file-upload-*/*.cabal\\n' > cabal.project" - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project" - "echo 'allow-newer: servant-js:servant-foreign' >> cabal.project" - cat cabal.project - echo -en 'travis_fold:end:unpack\\r' - - echo Building... && echo -en 'travis_fold:start:build\\r' - # this builds all libraries and executables (without tests/benchmarks) - - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all - - echo -en 'travis_fold:end:build\\r' - - echo Building with installed constraints for package in global-db... && echo -en 'travis_fold:start:build-installed\\r' - # Build with installed constraints for packages in global-db - - if $INSTALLED; then 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; else echo "Not building with installed constraints"; fi - - echo -en 'travis_fold:end:build-installed\\r' - 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 new-build -w ${HC} ${TEST} ${BENCH} all --max-backjumps=20000 - 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 cabal check... && echo -en 'travis_fold:start:check\\r' - # cabal check - - (cd servant-* && cabal check) - - (cd servant-client-* && cabal check) - - (cd servant-client-core-* && cabal check) - - (cd servant-docs-* && cabal check) - - (cd servant-foreign-* && cabal check) - - (cd servant-server-* && cabal check) - - (cd tutorial-* && cabal check) - - - echo -en 'travis_fold:end:check\\r' - echo Haddock... && echo -en 'travis_fold:start:haddock\\r' # haddock - rm -rf ./dist-newstyle diff --git a/cabal.make-travis-yml b/cabal.make-travis-yml index 827c363d..6c0982cb 100644 --- a/cabal.make-travis-yml +++ b/cabal.make-travis-yml @@ -4,5 +4,12 @@ branches: master release-0.12 -- We have inplace packages (servant-js) so we skip installing dependencies in a separate step install-dependencies-step: False +-- this speed-ups the build a little, but we have to check these for release +no-tests-no-benchmarks: False +build-with-installed-step: False + +-- Don't run cabal check, as cookbook examples won't pass it +cabal-check: False + -- ghc-options: -j2 jobs: :2 diff --git a/cabal.project b/cabal.project index bfeccc73..6a27e420 100644 --- a/cabal.project +++ b/cabal.project @@ -5,18 +5,11 @@ packages: servant/ servant-foreign/ servant-server/ doc/tutorial/ - doc/cookbook/basic-auth/ - doc/cookbook/db-postgres-pool/ - doc/cookbook/using-custom-monad/ - doc/cookbook/db-sqlite-simple/ - doc/cookbook/jwt-and-basic-auth/ - doc/cookbook/file-upload/ - doc/cookbook/structuring-apis/ - doc/cookbook/https/ + doc/cookbook/*/*.cabal allow-newer: servant-js:servant-foreign constraints: -- see https://github.com/haskell-infra/hackage-trustees/issues/119 foundation >=0.0.14, - memory <0.14.2 && >0.14.2 + memory <0.14.12 || >0.14.12 diff --git a/doc/cookbook/basic-auth/basic-auth.cabal b/doc/cookbook/basic-auth/basic-auth.cabal index 9d788a30..fd6613ab 100644 --- a/doc/cookbook/basic-auth/basic-auth.cabal +++ b/doc/cookbook/basic-auth/basic-auth.cabal @@ -8,10 +8,9 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com build-type: Simple cabal-version: >=1.10 +tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2 executable cookbook-basic-auth - if impl(ghc < 7.10.1) - buildable: False main-is: BasicAuth.lhs build-depends: base == 4.* , text >= 1.2 diff --git a/doc/cookbook/db-postgres-pool/db-postgres-pool.cabal b/doc/cookbook/db-postgres-pool/db-postgres-pool.cabal index fc05a40f..405db5f4 100644 --- a/doc/cookbook/db-postgres-pool/db-postgres-pool.cabal +++ b/doc/cookbook/db-postgres-pool/db-postgres-pool.cabal @@ -8,10 +8,9 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com build-type: Simple cabal-version: >=1.10 +tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2 executable cookbook-db-postgres-pool - if impl(ghc < 7.10.1) - buildable: False main-is: PostgresPool.lhs build-depends: base == 4.* , bytestring >= 0.10 @@ -27,6 +26,7 @@ executable cookbook-db-postgres-pool , http-client >= 0.5 , postgresql-simple >= 0.5 , resource-pool >= 0.2 + , transformers default-language: Haskell2010 ghc-options: -Wall -pgmL markdown-unlit build-tool-depends: markdown-unlit:markdown-unlit diff --git a/doc/cookbook/db-sqlite-simple/db-sqlite-simple.cabal b/doc/cookbook/db-sqlite-simple/db-sqlite-simple.cabal index 47553df0..5dfb31d5 100644 --- a/doc/cookbook/db-sqlite-simple/db-sqlite-simple.cabal +++ b/doc/cookbook/db-sqlite-simple/db-sqlite-simple.cabal @@ -8,10 +8,9 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com build-type: Simple cabal-version: >=1.10 +tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2 executable cookbook-db-sqlite-simple - if impl(ghc < 7.10.1) - buildable: False main-is: DBConnection.lhs build-depends: base == 4.* , text >= 1.2 @@ -25,6 +24,7 @@ executable cookbook-db-sqlite-simple , markdown-unlit >= 0.4 , http-client >= 0.5 , sqlite-simple >= 0.4 + , transformers default-language: Haskell2010 ghc-options: -Wall -pgmL markdown-unlit build-tool-depends: markdown-unlit:markdown-unlit diff --git a/doc/cookbook/file-upload/file-upload.cabal b/doc/cookbook/file-upload/file-upload.cabal index 56ecdf28..66b346a4 100644 --- a/doc/cookbook/file-upload/file-upload.cabal +++ b/doc/cookbook/file-upload/file-upload.cabal @@ -8,19 +8,19 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com build-type: Simple cabal-version: >=1.10 +tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2 executable cookbook-file-upload - if impl(ghc < 7.10.1) - buildable: False main-is: FileUpload.lhs build-depends: base == 4.* , text >= 1.2 - , mtl >= 2.2 + , mtl >= 2.1 , network >= 2.6 , bytestring >= 0.10 , servant , servant-server , servant-multipart + , transformers , warp >= 3.2 , wai >= 3.2 , markdown-unlit >= 0.4 diff --git a/doc/cookbook/https/https.cabal b/doc/cookbook/https/https.cabal index a13e6def..bec9273c 100644 --- a/doc/cookbook/https/https.cabal +++ b/doc/cookbook/https/https.cabal @@ -8,10 +8,9 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com build-type: Simple cabal-version: >=1.10 +tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2 executable cookbook-https - if impl(ghc < 7.10.1) - buildable: False main-is: Https.lhs build-depends: base == 4.* , servant diff --git a/doc/cookbook/jwt-and-basic-auth/jwt-and-basic-auth.cabal b/doc/cookbook/jwt-and-basic-auth/jwt-and-basic-auth.cabal index 18f398a3..fd10dcba 100644 --- a/doc/cookbook/jwt-and-basic-auth/jwt-and-basic-auth.cabal +++ b/doc/cookbook/jwt-and-basic-auth/jwt-and-basic-auth.cabal @@ -11,10 +11,12 @@ maintainer: haskell-servant-maintainers@googlegroups.com category: Servant build-type: Simple cabal-version: >=1.10 +tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2 executable cookbook-jwt-and-basic-auth - if impl(ghc < 7.10.1) - buildable: False + if !impl(ghc >= 7.10) + buildable: False + main-is: JWTAndBasicAuth.lhs build-depends: base == 4.* , text >= 1.2 @@ -23,14 +25,15 @@ executable cookbook-jwt-and-basic-auth , servant , servant-client , servant-server - , servant-auth - , servant-auth-server + , servant-auth ==0.3.* + , servant-auth-server >= 0.3.1.0 , warp >= 3.2 , wai >= 3.2 , http-types >= 0.10 , markdown-unlit >= 0.4 , http-client >= 0.5 - , bytestring >= 0.10 + , bytestring >= 0.10.4 + , transformers default-language: Haskell2010 ghc-options: -Wall -pgmL markdown-unlit build-tool-depends: markdown-unlit:markdown-unlit diff --git a/doc/cookbook/structuring-apis/structuring-apis.cabal b/doc/cookbook/structuring-apis/structuring-apis.cabal index aa602bd0..b2a9985c 100644 --- a/doc/cookbook/structuring-apis/structuring-apis.cabal +++ b/doc/cookbook/structuring-apis/structuring-apis.cabal @@ -8,10 +8,9 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com build-type: Simple cabal-version: >=1.10 +tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2 executable cookbook-structuring-apis - if impl(ghc < 7.10.1) - buildable: False main-is: StructuringApis.lhs build-depends: base == 4.* , aeson >= 1.2 diff --git a/doc/cookbook/using-custom-monad/using-custom-monad.cabal b/doc/cookbook/using-custom-monad/using-custom-monad.cabal index 867bf671..216f1cf6 100644 --- a/doc/cookbook/using-custom-monad/using-custom-monad.cabal +++ b/doc/cookbook/using-custom-monad/using-custom-monad.cabal @@ -8,10 +8,9 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com build-type: Simple cabal-version: >=1.10 +tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2 executable cookbook-using-custom-monad - if impl(ghc < 7.10.1) - buildable: False main-is: UsingCustomMonad.lhs build-depends: base == 4.* , aeson >= 1.2 @@ -23,7 +22,7 @@ executable cookbook-using-custom-monad , http-client >= 0.5 , markdown-unlit >= 0.4 , stm >= 2.4 - , transformers >= 0.4 + , transformers >= 0.3 default-language: Haskell2010 ghc-options: -Wall -pgmL markdown-unlit build-tool-depends: markdown-unlit:markdown-unlit