New .travis.yml using stack instead of cabal-meta.
This commit is contained in:
parent
9d0ee44c06
commit
01b277b11e
107
.travis.yml
107
.travis.yml
@ -1,8 +1,11 @@
|
|||||||
|
# Travis file upgraded to stack at 2015-31-12 using template from
|
||||||
|
# <http://docs.haskellstack.org/en/stable/travis_ci.html>.
|
||||||
|
#
|
||||||
# Travis file initially created at 2015-05-31 using template from
|
# Travis file initially created at 2015-05-31 using template from
|
||||||
# <https://github.com/hvr/multi-ghc-travis/commit/c9c87d36c450d7f9cb3183dcaf1f77b60f916f28>
|
# <https://github.com/hvr/multi-ghc-travis/commit/c9c87d36c450d7f9cb3183dcaf1f77b60f916f28>
|
||||||
# and taking the idea of using cabal-meta from yesodweb/yesod.
|
# and taking the idea of using cabal-meta from yesodweb/yesod.
|
||||||
|
|
||||||
# NB: don't set `language: haskell` here
|
sudo: false
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- redis-server
|
- redis-server
|
||||||
@ -10,55 +13,69 @@ services:
|
|||||||
addons:
|
addons:
|
||||||
postgresql: "9.3"
|
postgresql: "9.3"
|
||||||
|
|
||||||
# The following enables several GHC versions to be tested; often it's enough to test only against the last release in a major GHC version. Feel free to omit lines listings versions you don't need/want testing for.
|
cache:
|
||||||
env:
|
directories:
|
||||||
#- CABALVER=1.16 GHCVER=6.12.3
|
- $HOME/.stack
|
||||||
#- CABALVER=1.16 GHCVER=7.0.1
|
|
||||||
#- CABALVER=1.16 GHCVER=7.0.2
|
matrix:
|
||||||
#- CABALVER=1.16 GHCVER=7.0.3
|
include:
|
||||||
#- CABALVER=1.16 GHCVER=7.0.4
|
- env: GHCVER=7.8.4 RESOLVER=lts-2.22 EXTRADEPS="hedis-0.6.6" STACKARGS="--flag serversession-backend-redis:old-locale"
|
||||||
#- CABALVER=1.16 GHCVER=7.2.1
|
addons:
|
||||||
#- CABALVER=1.16 GHCVER=7.2.2
|
apt:
|
||||||
#- CABALVER=1.16 GHCVER=7.4.1
|
sources:
|
||||||
#- CABALVER=1.16 GHCVER=7.4.2
|
- hvr-ghc
|
||||||
#- CABALVER=1.16 GHCVER=7.6.1
|
packages:
|
||||||
#- CABALVER=1.16 GHCVER=7.6.2
|
- ghc-7.8.4
|
||||||
#- CABALVER=1.18 GHCVER=7.6.3
|
- env: GHCVER=7.10.2 RESOLVER=lts-3.4 EXTRADEPS="" STACKARGS=""
|
||||||
#- CABALVER=1.18 GHCVER=7.8.1 # see note about Alex/Happy for GHC >= 7.8
|
addons:
|
||||||
#- CABALVER=1.18 GHCVER=7.8.2
|
apt:
|
||||||
#- CABALVER=1.18 GHCVER=7.8.3
|
sources:
|
||||||
#- CABALVER=1.18 GHCVER=7.8.4
|
- hvr-ghc
|
||||||
- CABALVER=1.20 GHCVER=7.8.4
|
packages:
|
||||||
- CABALVER=1.22 GHCVER=7.10.1
|
- ghc-7.10.2
|
||||||
#- CABALVER=1.22 GHCVER=7.10.2
|
- env: GHCVER=7.10.2 RESOLVER=lts-3.20 EXTRADEPS="" STACKARGS=""
|
||||||
#- CABALVER=head GHCVER=head # see section about GHC HEAD snapshots
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- hvr-ghc
|
||||||
|
packages:
|
||||||
|
- ghc-7.10.2
|
||||||
|
- env: GHCVER=head RESOLVER=nightly EXTRADEPS="" STACKARGS=""
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- hvr-ghc
|
||||||
|
packages:
|
||||||
|
- ghc-head
|
||||||
|
allow_failures:
|
||||||
|
- env: GHCVER=head RESOLVER=nightly EXTRADEPS="" STACKARGS=""
|
||||||
|
|
||||||
# Note: the distinction between `before_install` and `install` is not important.
|
|
||||||
before_install:
|
before_install:
|
||||||
- travis_retry sudo add-apt-repository -y ppa:hvr/ghc
|
# Download and unpack the stack executable
|
||||||
- travis_retry sudo apt-get update
|
- mkdir -p ~/.local/bin
|
||||||
- travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER # see note about happy/alex
|
- export PATH=$HOME/.local/bin:$PATH
|
||||||
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.cabal/bin:$PATH
|
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
|
||||||
|
- export PATH=/opt/ghc/$GHCVER/bin:$PATH
|
||||||
|
- export RUNSTACK="stack --no-terminal --skip-ghc-check --resolver=$RESOLVER"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- cabal --version
|
- $RUNSTACK --version
|
||||||
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
|
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
|
||||||
- travis_retry cabal update
|
- $RUNSTACK install alex happy
|
||||||
- cabal install cabal-src cabal-meta alex happy
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- psql -c "CREATE USER test WITH PASSWORD 'test';" -U postgres
|
- psql -c "CREATE USER test WITH PASSWORD 'test';" -U postgres
|
||||||
- psql -c "CREATE DATABASE test;" -U postgres
|
- psql -c "CREATE DATABASE test;" -U postgres
|
||||||
- psql -c "GRANT ALL PRIVILEGES ON DATABASE test TO test;" -U postgres
|
- psql -c "GRANT ALL PRIVILEGES ON DATABASE test TO test;" -U postgres
|
||||||
|
- for dep in $EXTRADEPS; do echo " - $dep" >> stack.yaml; done
|
||||||
|
|
||||||
# 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.
|
|
||||||
script:
|
script:
|
||||||
- cabal-meta install --enable-tests --enable-benchmarks --force-reinstalls
|
- $RUNSTACK test $STACKARGS serversession
|
||||||
- serversession/dist/build/tests/tests
|
- $RUNSTACK test $STACKARGS serversession-backend-acid-state
|
||||||
- serversession-backend-acid-state/dist/build/tests/tests
|
- du -hcs serversession-backend-acid-state/state; rm -Rfv serversession-backend-acid-state/state
|
||||||
- du -hcs state; rm -Rfv state
|
- $RUNSTACK test $STACKARGS serversession-backend-persistent --test-arguments='"--skip=100 MiB"'
|
||||||
- serversession-backend-persistent/dist/build/tests/tests --skip=100\ MiB
|
- du -hcs serversession-backend-persistent/test.db*; rm -Rfv serversession-backend-persistent/test.db*
|
||||||
- du -hcs test.db*; rm -Rfv test.db*
|
- psql -c 'SELECT COUNT(*) FROM "persistent_session";' -U test test; psql -c 'DROP DATABASE test;' -U postgres
|
||||||
- psql -c 'SELECT COUNT(*) FROM "persistent_session";' -U test test; psql -c 'DROP DATABASE test;' -U postgres
|
- $RUNSTACK test $STACKARGS serversession-backend-redis
|
||||||
- serversession-backend-redis/dist/build/tests/tests
|
- redis-cli FLUSHALL
|
||||||
- redis-cli FLUSHALL
|
- $RUNSTACK test $STACKARGS --no-run-tests # Make sure everything else builds
|
||||||
|
|||||||
@ -23,7 +23,7 @@ library
|
|||||||
, cereal >= 0.4
|
, cereal >= 0.4
|
||||||
, path-pieces
|
, path-pieces
|
||||||
, persistent >= 2.1 && < 2.3
|
, persistent >= 2.1 && < 2.3
|
||||||
, tagged >= 0.8
|
, tagged >= 0.7
|
||||||
, text
|
, text
|
||||||
, time
|
, time
|
||||||
, transformers
|
, transformers
|
||||||
|
|||||||
@ -13,6 +13,10 @@ homepage: https://github.com/yesodweb/serversession
|
|||||||
description: API docs and the README are available at <http://www.stackage.org/package/serversession-backend-redis>
|
description: API docs and the README are available at <http://www.stackage.org/package/serversession-backend-redis>
|
||||||
extra-source-files: README.md
|
extra-source-files: README.md
|
||||||
|
|
||||||
|
flag old-locale
|
||||||
|
description: Use time-1.4 and old-locale (GHC 7.8).
|
||||||
|
default: False
|
||||||
|
|
||||||
library
|
library
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
build-depends:
|
build-depends:
|
||||||
@ -20,17 +24,22 @@ library
|
|||||||
, bytestring
|
, bytestring
|
||||||
, hedis == 0.6.*
|
, hedis == 0.6.*
|
||||||
, path-pieces
|
, path-pieces
|
||||||
, tagged >= 0.8
|
, tagged >= 0.7
|
||||||
, text
|
, text
|
||||||
, time >= 1.5
|
, time >= 1.4
|
||||||
, transformers
|
, transformers
|
||||||
, unordered-containers
|
, unordered-containers
|
||||||
|
|
||||||
, serversession == 1.0.*
|
, serversession == 1.0.*
|
||||||
|
if flag(old-locale)
|
||||||
|
build-depends: time == 1.4.*, old-locale
|
||||||
|
else
|
||||||
|
build-depends: time >= 1.5
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
Web.ServerSession.Backend.Redis
|
Web.ServerSession.Backend.Redis
|
||||||
Web.ServerSession.Backend.Redis.Internal
|
Web.ServerSession.Backend.Redis.Internal
|
||||||
extensions:
|
extensions:
|
||||||
|
CPP
|
||||||
DeriveDataTypeable
|
DeriveDataTypeable
|
||||||
FlexibleContexts
|
FlexibleContexts
|
||||||
OverloadedStrings
|
OverloadedStrings
|
||||||
|
|||||||
@ -47,6 +47,11 @@ import qualified Data.Text.Encoding as TE
|
|||||||
import qualified Data.Time.Clock as TI
|
import qualified Data.Time.Clock as TI
|
||||||
import qualified Data.Time.Format as TI
|
import qualified Data.Time.Format as TI
|
||||||
|
|
||||||
|
#if MIN_VERSION_time(1,5,0)
|
||||||
|
import Data.Time.Format (defaultTimeLocale)
|
||||||
|
#else
|
||||||
|
import System.Locale (defaultTimeLocale)
|
||||||
|
#endif
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
@ -184,13 +189,19 @@ printSession Session {..} =
|
|||||||
-- | Parse 'UTCTime' from a 'ByteString' stored on Redis. Uses
|
-- | Parse 'UTCTime' from a 'ByteString' stored on Redis. Uses
|
||||||
-- 'error' on parse error.
|
-- 'error' on parse error.
|
||||||
parseUTCTime :: ByteString -> TI.UTCTime
|
parseUTCTime :: ByteString -> TI.UTCTime
|
||||||
parseUTCTime = TI.parseTimeOrError True TI.defaultTimeLocale timeFormat . B8.unpack
|
#if MIN_VERSION_time(1,5,0)
|
||||||
|
parseUTCTime = TI.parseTimeOrError True defaultTimeLocale timeFormat . B8.unpack
|
||||||
|
#else
|
||||||
|
parseUTCTime =
|
||||||
|
fromMaybe (error "Web.ServerSession.Backend.Redis.Internal.parseUTCTime") .
|
||||||
|
TI.parseTime defaultTimeLocale timeFormat . B8.unpack
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
-- | Convert a 'UTCTime' into a 'ByteString' to be stored on
|
-- | Convert a 'UTCTime' into a 'ByteString' to be stored on
|
||||||
-- Redis.
|
-- Redis.
|
||||||
printUTCTime :: TI.UTCTime -> ByteString
|
printUTCTime :: TI.UTCTime -> ByteString
|
||||||
printUTCTime = B8.pack . TI.formatTime TI.defaultTimeLocale timeFormat
|
printUTCTime = B8.pack . TI.formatTime defaultTimeLocale timeFormat
|
||||||
|
|
||||||
|
|
||||||
-- | Time format used when storing 'UTCTime'.
|
-- | Time format used when storing 'UTCTime'.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user