Skip to content

Commit

Permalink
Allow newver versions of dependencies, regenerate .travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed Jun 12, 2020
1 parent 6b31cd0 commit ad35247
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 26 deletions.
58 changes: 45 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
#
# haskell-ci '--ghc-head' '--osx=8.4.4' 'cabal.project'
#
# To regenerate the script (for example after adjusting tested-with) run
#
# haskell-ci regenerate
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.9.20200325
# version: 0.10.1
#
version: ~> 1.0
language: c
Expand Down Expand Up @@ -34,37 +38,37 @@ jobs:
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.1","cabal-install-3.2"]}}
os: linux
- compiler: ghc-8.8.3
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2"]}}
os: linux
- compiler: ghc-8.6.5
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}}
os: linux
- compiler: ghc-8.4.4
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}}
os: linux
- compiler: ghc-8.2.2
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}}
os: linux
- compiler: ghc-8.0.2
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}}
os: linux
- compiler: ghc-7.10.3
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.10.3","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.10.3","cabal-install-3.2"]}}
os: linux
- compiler: ghc-7.8.4
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.8.4","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.8.4","cabal-install-3.2"]}}
os: linux
- compiler: ghc-7.6.3
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.6.3","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.6.3","cabal-install-3.2"]}}
os: linux
- compiler: ghc-7.4.2
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.4.2","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.4.2","cabal-install-3.2"]}}
os: linux
- compiler: ghc-head
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-head","cabal-install-head"]}}
os: linux
- compiler: ghc-8.4.4
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.0"]}}
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}}
os: osx
allow_failures:
- compiler: ghc-head
Expand All @@ -79,7 +83,7 @@ before_install:
- CABALHOME=$HOME/.cabal
- export PATH="$CABALHOME/bin:$PATH"
- TOP=$(pwd)
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then curl https://haskell.futurice.com/haskell-on-macos.py | python3 - --make-dirs --install-dir=$HOME/.ghc-install --cabal-alias=head install cabal-install-head ${TRAVIS_COMPILER}; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then curl https://haskell.futurice.com/haskell-on-macos.py | python3 - --make-dirs --install-dir=$HOME/.ghc-install --cabal-alias=3.2.0.0 install cabal-install-3.2.0.0 ${TRAVIS_COMPILER}; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then HC=$HOME/.ghc-install/ghc/bin/$TRAVIS_COMPILER; WITHCOMPILER="-w $HC"; HCPKG=${HC/ghc/ghc-pkg}; CABAL=$HOME/.ghc-install/ghc/bin/cabal; fi
- "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
- echo $HCNUMVER
Expand Down Expand Up @@ -137,6 +141,20 @@ install:
echo "packages: hackage-root-tool" >> cabal.project
echo "packages: hackage-repo-tool" >> cabal.project
echo "packages: hackage-security-HTTP" >> cabal.project
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-security' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-security-http-client' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package example-client' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-security-curl' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-root-tool' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-repo-tool' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-security-HTTP' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- |
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(example-client|hackage-repo-tool|hackage-root-tool|hackage-security|hackage-security-HTTP|hackage-security-curl|hackage-security-http-client)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true
Expand Down Expand Up @@ -180,6 +198,20 @@ script:
echo "packages: ${PKGDIR_hackage_root_tool}" >> cabal.project
echo "packages: ${PKGDIR_hackage_repo_tool}" >> cabal.project
echo "packages: ${PKGDIR_hackage_security_HTTP}" >> cabal.project
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-security' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-security-http-client' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package example-client' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-security-curl' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-root-tool' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-repo-tool' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package hackage-security-HTTP' >> cabal.project ; fi
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"
- |
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(example-client|hackage-repo-tool|hackage-root-tool|hackage-security|hackage-security-HTTP|hackage-security-curl|hackage-security-http-client)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true
Expand All @@ -206,5 +238,5 @@ script:
- rm -f cabal.project.local
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all

# REGENDATA ("0.9.20200325",["--ghc-head","--osx=8.4.4","cabal.project"])
# REGENDATA ("0.10.1",["--ghc-head","--osx=8.4.4","cabal.project"])
# EOF
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ library
build-depends: base >= 4.5 && < 4.15,
bytestring >= 0.9,
data-default-class >= 0.0,
http-client >= 0.4 && < 0.7,
http-client >= 0.4 && < 0.8,
http-types >= 0.8,
hackage-security >= 0.5 && < 0.7
hs-source-dirs: src
Expand Down
10 changes: 5 additions & 5 deletions hackage-security/hackage-security.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ library
bytestring >= 0.9 && < 0.11,
Cabal >= 1.14 && < 1.26
|| >= 2.0 && < 2.6
|| >= 3.0 && < 3.4,
|| >= 3.0 && < 3.5,
containers >= 0.4 && < 0.7,
ed25519 >= 0.0 && < 0.1,
filepath >= 1.2 && < 1.5,
Expand All @@ -127,7 +127,7 @@ library
-- functionality, 0.5.0 changes type of serialise
tar >= 0.5 && < 0.6,
template-haskell >= 2.7 && < 2.17,
time >= 1.2 && < 1.10,
time >= 1.2 && < 1.11,
transformers >= 0.3 && < 0.6,
zlib >= 0.5 && < 0.7,
-- whatever versions are bundled with ghc:
Expand Down Expand Up @@ -258,11 +258,11 @@ test-suite TestSuite
zlib

-- dependencies exclusive to test-suite
build-depends: tasty == 1.2.*,
build-depends: tasty == 1.2.* || ==1.3.*,
tasty-hunit == 0.10.*,
tasty-quickcheck == 0.10.*,
QuickCheck >= 2.11 && <2.14,
aeson == 1.4.*,
QuickCheck >= 2.11 && <2.15,
aeson == 1.4.* || ==1.5.*,
vector == 0.12.*,
unordered-containers >=0.2.8.0 && <0.3,
temporary >= 1.2 && < 1.4
Expand Down
26 changes: 19 additions & 7 deletions hackage-security/tests/TestSuite/JSON.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@ import qualified Data.Vector as V
import qualified Data.HashMap.Strict as HM

prop_aeson_canonical, prop_roundtrip_canonical, prop_roundtrip_pretty, prop_canonical_pretty
:: JSValue -> Bool
:: JSValue -> Property

prop_roundtrip_canonical jsval =
parseCanonicalJSON (renderCanonicalJSON jsval) == Right (canonicalise jsval)
parseCanonicalJSON (renderCanonicalJSON jsval) === Right (canonicalise jsval)

prop_roundtrip_pretty jsval =
parseCanonicalJSON (BS.pack (prettyCanonicalJSON jsval)) == Right jsval
parseCanonicalJSON (BS.pack (prettyCanonicalJSON jsval)) === Right jsval

prop_canonical_pretty jsval =
parseCanonicalJSON (renderCanonicalJSON jsval) ==
parseCanonicalJSON (renderCanonicalJSON jsval) ===
fmap canonicalise (parseCanonicalJSON (BS.pack (prettyCanonicalJSON jsval)))

prop_aeson_canonical jsval =
eitherDecode (renderCanonicalJSON jsval) == Right (toAeson (canonicalise jsval))
counterexample (BS.unpack $ renderCanonicalJSON jsval) $
eitherDecode (renderCanonicalJSON jsval) === Right (toAeson (canonicalise jsval))

canonicalise :: JSValue -> JSValue
canonicalise v@JSNull = v
Expand All @@ -55,9 +56,9 @@ instance Arbitrary JSValue where
[ (1, pure JSNull)
, (1, JSBool <$> arbitrary)
, (2, JSNum <$> arbitrary)
, (2, JSString . getASCIIString <$> arbitrary)
, (2, JSString . getCanonicalString <$> arbitrary)
, (3, JSArray <$> resize (sz `div` 2) arbitrary)
, (3, JSObject . mapFirst getASCIIString . noDupFields <$> resize (sz `div` 2) arbitrary)
, (3, JSObject . mapFirst getCanonicalString . noDupFields <$> resize (sz `div` 2) arbitrary)
]
where
noDupFields = nubBy (\(x,_) (y,_) -> x==y)
Expand Down Expand Up @@ -92,3 +93,14 @@ instance Arbitrary Int54 where
lowerbound = (-999999999999999)
shrink = shrinkIntegral

newtype CanonicalString = CanonicalString { getCanonicalString :: String }
deriving (Eq, Show)

-- ASCII and not control character
instance Arbitrary CanonicalString where
arbitrary = fmap CanonicalString (listOf (chooseEnum ('\32', '\127')))

shrink (CanonicalString str) =
map (CanonicalString . filter isCanonical) (shrink str)
where
isCanonical c = c >= '\32' && c <= '\127'

0 comments on commit ad35247

Please sign in to comment.