git.iko.soy/servant-quickcheck
on master help sign in
Support servant-0.16 and http-media-0.8
commita5cdf78d82492d0a048c97642355aa84e29c5188 authorOleg Grenrus <oleg.grenrus@iki.fi> dateTue 16 Apr 2019, 22:19 (8 years ago) parent638580b
3 files changed+97−81
.travis.yml+89−63 servant-quickcheck.cabal+6−6 test/Servant/QuickCheck/InternalSpec.hs+2−12
.travis.yml+89−63
@@ -4,21 +4,20 @@
44#
55# For more information, see https://github.com/haskell-CI/haskell-ci
66#
7+# version: 0.3.20190413
8+#
79language: c
810dist: xenial
9−
1011git:
11− submodules: false # whether to recursively clone submodules
12−
12+ # whether to recursively clone submodules
13+ submodules: false
1314branches:
1415 only:
1516 - master
16−
1717cache:
1818 directories:
1919 - $HOME/.cabal/packages
2020 - $HOME/.cabal/store
21−
2221before_cache:
2322 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
2423 # remove files that are regenerated by 'cabal update'
@@ -27,95 +26,122 @@ before_cache:
2726 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
2827 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
2928 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
30−
3129 - rm -rfv $CABALHOME/packages/head.hackage
32−
3330matrix:
3431 include:
35− - compiler: "ghc-8.6.3"
36− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.3], sources: [hvr-ghc]}}
37− - compiler: "ghc-8.4.4"
38− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}}
39− - compiler: "ghc-8.2.2"
40− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}}
41− - compiler: "ghc-8.0.2"
42− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}}
43− - compiler: "ghc-7.10.3"
44− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.10.3], sources: [hvr-ghc]}}
45−
32+ - compiler: ghc-8.6.3
33+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.3","cabal-install-2.4"]}}
34+ - compiler: ghc-8.4.4
35+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}
36+ - compiler: ghc-8.2.2
37+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}
38+ - compiler: ghc-8.0.2
39+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}
40+ - compiler: ghc-7.10.3
41+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-2.4"]}}
4642before_install:
47− - HC=/opt/ghc/bin/${CC}
48− - HCVER=$(echo "$TRAVIS_COMPILER" | sed 's/ghc-//')
49− - echo $HCVER
50− - HCPKG=${HC/ghc/ghc-pkg}
43+ - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
44+ - HCPKG="$HC-pkg"
5145 - unset CC
5246 - CABAL=/opt/ghc/bin/cabal
5347 - CABALHOME=$HOME/.cabal
5448 - export PATH="$CABALHOME/bin:$PATH"
55− - ROOTDIR=$(pwd)
49+ - TOP=$(pwd)
5650 - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
5751 - echo $HCNUMVER
58−
52+ - CABAL="$CABAL -vnormal+nowrap+markoutput"
53+ - set -o pipefail
54+ - |
55+ echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
56+ echo 'BEGIN { state = "output"; }' >> .colorful.awk
57+ echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
58+ echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
59+ echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
60+ echo ' if (state == "cabal") {' >> .colorful.awk
61+ echo ' print blue($0)' >> .colorful.awk
62+ echo ' } else {' >> .colorful.awk
63+ echo ' print $0' >> .colorful.awk
64+ echo ' }' >> .colorful.awk
65+ echo '}' >> .colorful.awk
66+ - cat .colorful.awk
67+ - |
68+ color_cabal_output () {
69+ awk -f $TOP/.colorful.awk
70+ }
71+ - echo text | color_cabal_output
5972install:
6073 - ${CABAL} --version
6174 - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
6275 - TEST=--enable-tests
6376 - BENCH=--enable-benchmarks
6477 - GHCHEAD=${GHCHEAD-false}
65− - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export CABALHOME=$APPDATA/cabal; else export CABALHOME=$HOME/.cabal; fi
66− - travis_retry ${CABAL} update -v
67− - sed -i.bak 's/^jobs:/-- jobs:/' $CABALHOME/config
68− - rm -fv cabal.project cabal.project.local
69− - grep -Ev -- '^\s*--' $CABALHOME/config | grep -Ev '^\s*$'
70− - rm -f cabal.project
78+ - rm -f $CABALHOME/config
79+ - |
80+ echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
81+ echo "remote-build-reporting: anonymous" >> $CABALHOME/config
82+ echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
83+ echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
84+ echo "world-file: $CABALHOME/world" >> $CABALHOME/config
85+ echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
86+ echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
87+ echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
88+ echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
89+ echo "install-dirs user" >> $CABALHOME/config
90+ echo " prefix: $CABALHOME" >> $CABALHOME/config
91+ echo "repository hackage.haskell.org" >> $CABALHOME/config
92+ echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
93+ - cat $CABALHOME/config
94+ - rm -fv cabal.project cabal.project.local cabal.project.freeze
95+ - travis_retry ${CABAL} v2-update -v
96+ # Generate cabal.project
97+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
7198 - touch cabal.project
72− - "printf 'packages: \".\"\\n' >> cabal.project"
73− - "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
74− - touch cabal.project.local
99+ - |
100+ echo 'packages: "."' >> cabal.project
101+ - |
102+ echo "write-ghc-environment-files: always" >> cabal.project
75103 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(servant-quickcheck)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
76104 - cat cabal.project || true
77105 - cat cabal.project.local || true
78106 - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
79− - rm -f cabal.project.freeze
80− - ${CABAL} new-freeze -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dry
81− - "cat \"cabal.project.freeze\" | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
82− - rm "cabal.project.freeze"
83− - ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
84− - ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
85− - rm -rf .ghc.environment.* "."/dist
86− - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
87−
88−# Here starts the actual work to be performed for the package under test;
89−# any command which exits with a non-zero exit code causes the build to fail.
107+ - ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output
108+ - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
109+ - rm cabal.project.freeze
110+ - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
111+ - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
90112script:
91− # test that source-distributions can be generated
92− - ${CABAL} new-sdist all
113+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
114+ # Packaging...
115+ - ${CABAL} v2-sdist all | color_cabal_output
116+ # Unpacking...
93117 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
94118 - cd ${DISTDIR} || false
95119 - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
96− - rm -f cabal.project
120+ # Generate cabal.project
121+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
97122 - touch cabal.project
98− - "printf 'packages: \"servant-quickcheck-*/*.cabal\"\\n' >> cabal.project"
99− - "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
100− - touch cabal.project.local
123+ - |
124+ echo 'packages: "servant-quickcheck-*/*.cabal"' >> cabal.project
125+ - |
126+ echo "write-ghc-environment-files: always" >> cabal.project
101127 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(servant-quickcheck)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
102128 - cat cabal.project || true
103129 - cat cabal.project.local || true
130+ # Building...
104131 # this builds all libraries and executables (without tests/benchmarks)
105− - ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all
106−
132+ - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output
133+ # Building with tests and benchmarks...
107134 # build & run tests, build benchmarks
108− - ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} all
109− - if [ "x$TEST" = "x--enable-tests" ]; then ${CABAL} new-test -w ${HC} ${TEST} ${BENCH} all; fi
110−
111− # cabal check
112− - (cd servant-quickcheck-* && ${CABAL} check)
113−
114− # haddock
115− - ${CABAL} new-haddock -w ${HC} ${TEST} ${BENCH} all
116−
117− # Build without installed constraints for packages in global-db
118− - rm -f cabal.project.local; ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all;
135+ - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
136+ # Testing...
137+ - ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
138+ # cabal check...
139+ - (cd servant-quickcheck-* && ${CABAL} -vnormal check)
140+ # haddock...
141+ - ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
142+ # Building without installed constraints for packages in global-db...
143+ - rm -f cabal.project.local
144+ - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output
119145
120146# REGENDATA ["--branches","master","-o",".travis.yml","servant-quickcheck.cabal"]
121147# EOF
servant-quickcheck.cabal+6−6
@@ -1,5 +1,5 @@
11name: servant-quickcheck
2−version: 0.0.7.3
2+version: 0.0.7.4
33synopsis: QuickCheck entire APIs
44description:
55 This packages provides QuickCheck properties that are tested across an entire
@@ -43,15 +43,15 @@ library
4343 , data-default-class >=0.0 && <0.2
4444 , hspec >=2.5.6 && <2.8
4545 , http-client >=0.4.30 && <0.7
46− , http-media >=0.6 && <0.8
46+ , http-media >=0.6 && <0.9
4747 , http-types >=0.8 && <0.13
4848 , mtl >=2.1 && <2.3
4949 , pretty >=1.1 && <1.2
5050 , process >=1.2 && <1.7
51− , QuickCheck >=2.7 && <2.13
52− , servant >=0.13 && <0.15
53− , servant-client >=0.13 && <0.15
54− , servant-server >=0.13 && <0.15
51+ , QuickCheck >=2.7 && <2.14
52+ , servant >=0.16 && <0.17
53+ , servant-client >=0.16 && <0.17
54+ , servant-server >=0.16 && <0.17
5555 , split >=0.2 && <0.3
5656 , string-conversions >=0.3 && <0.5
5757 , temporary >=1.2 && <1.4
test/Servant/QuickCheck/InternalSpec.hs+2−12
@@ -23,12 +23,7 @@ import Test.QuickCheck.Gen (generate, unGen)
2323import Test.QuickCheck.Random (mkQCGen)
2424
2525
26−#if MIN_VERSION_servant(0,8,0)
27−import Servant.API.Internal.Test.ComprehensiveAPI (comprehensiveAPIWithoutRaw)
28−#else
29−import Servant.API.Internal.Test.ComprehensiveAPI (ComprehensiveAPI,
30− comprehensiveAPI)
31−#endif
26+import Servant.Test.ComprehensiveAPI (comprehensiveAPIWithoutStreamingOrRaw)
3227
3328import Servant.QuickCheck
3429import Servant.QuickCheck.Internal (genRequest, runGenRequest,
@@ -154,7 +149,7 @@ isComprehensiveSpec :: Spec
154149isComprehensiveSpec = describe "HasGenRequest" $ do
155150
156151 it "has instances for all 'servant' combinators" $ do
157− let _g = genRequest comprehensiveAPIWithoutRaw
152+ let _g = genRequest comprehensiveAPIWithoutStreamingOrRaw
158153 True `shouldBe` True -- This is a type-level check
159154
160155deepPathSpec :: Spec
@@ -374,8 +369,3 @@ noOfTestCases = 20000
374369#else
375370noOfTestCases = 1000
376371#endif
377−
378−#if !MIN_VERSION_servant(0,8,0)
379−comprehensiveAPIWithoutRaw :: Proxy ComprehensiveAPI
380−comprehensiveAPIWithoutRaw = comprehensiveAPI
381−#endif