diff --git a/.travis.yml b/.travis.yml index 4cccaebd8..84ac0d87f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,19 +14,99 @@ services: matrix: include: - - env: ARGS="--resolver lts-9 --stack-yaml stack_lts-10.yaml" - - env: ARGS="--resolver lts-11 --stack-yaml stack_lts-12.yaml" - - env: ARGS="--resolver lts-12 --stack-yaml stack_lts-12.yaml" - - env: ARGS="--resolver lts-13" + - env: BUILD=cabal GHCVER=8.2.2 CABALVER=2.0 HAPPYVER=1.19.5 ALEXVER=3.1.7 + compiler: ": #GHC 8.2.2" + addons: {postgresql: "9.6", apt: {packages: [cabal-install-2.0,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.4.1 CABALVER=2.0 HAPPYVER=1.19.5 ALEXVER=3.1.7 + compiler: ": #GHC 8.4.1" + addons: {postgresql: "9.6", apt: {packages: [cabal-install-2.0,ghc-8.4.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.4.4 CABALVER=2.0 HAPPYVER=1.19.5 ALEXVER=3.1.7 + compiler: ": #GHC 8.4.4" + addons: {postgresql: "9.6", apt: {packages: [cabal-install-2.0,ghc-8.4.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.6.4 CABALVER=2.0 HAPPYVER=1.19.5 ALEXVER=3.1.7 + compiler: ": #GHC 8.6.4" + addons: {postgresql: "9.6", apt: {packages: [cabal-install-2.0,ghc-8.6.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + + # Build with the newest GHC and cabal-install. This is an accepted failure, + # see below. + - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7 + compiler: ": #GHC HEAD" + addons: {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + + - env: BUILD=stack ARGS="--resolver lts-9 --stack-yaml stack_lts-10.yaml" + - env: BUILD=stack ARGS="--resolver lts-11 --stack-yaml stack_lts-12.yaml" + - env: BUILD=stack ARGS="--resolver lts-12 --stack-yaml stack_lts-12.yaml" + - env: BUILD=stack ARGS="--resolver lts-13" + # Nightly builds are allowed to fail + - env: BUILD=stack ARGS="--resolver nightly" + compiler: ": #stack nightly" + addons: {apt: {packages: [libgmp-dev]}} + + allow_failures: + - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7 + - env: BUILD=stack ARGS="--resolver nightly" before_install: +# Using compiler above sets CC to an invalid value, so unset it +- unset CC + +# We want to always allow newer versions of packages when building on GHC HEAD +- CABALARGS="" +- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi + # Download and unpack the stack executable +- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:/opt/alex/$ALEXVER/bin:/opt/happy/$HAPPYVER/bin:$HOME/.cabal/bin:$PATH - mkdir -p ~/.local/bin -- export PATH=$HOME/.local/bin:$PATH -- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' +- | + if [ `uname` = "Darwin" ] + then + travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin + else + travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' + fi + + # Use the more reliable S3 mirror of Hackage + mkdir -p $HOME/.cabal + echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config + echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config + + if [ "$CABALVER" != "1.16" ] + then + echo 'jobs: $ncpus' >> $HOME/.cabal/config + fi + +install: +- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" +- if [ -f configure.ac ]; then autoreconf -i; fi +- | + set -ex + case "$BUILD" in + stack) + # Build the dependencies + stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies + ;; + cabal) + cabal --version + travis_retry cabal update + # travis_retry cabal update + + # Get the list of packages from the stack.yaml file. Note that + # this will also implicitly run hpack as necessary to generate + # the .cabal files needed by cabal-install. + # PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@') + + # cabal new-build does not require the list of packages because it is + # specified in the cabal.project file + cabal new-build all --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS + ;; + esac + set +ex + script: travis/run.sh cache: directories: - $HOME/.stack + - $HOME/.ghc + - $HOME/.cabal diff --git a/cabal.project b/cabal.project index 5757588bc..24a5ff777 100644 --- a/cabal.project +++ b/cabal.project @@ -8,3 +8,4 @@ packages: persistent-postgresql persistent-redis persistent-qq + diff --git a/persistent-qq/.gitignore b/persistent-qq/.gitignore index 30fb2ee82..e69de29bb 100644 --- a/persistent-qq/.gitignore +++ b/persistent-qq/.gitignore @@ -1 +0,0 @@ -persistent-qq.cabal diff --git a/persistent-qq/package.yaml b/persistent-qq/package.yaml deleted file mode 100644 index 259cf7fe3..000000000 --- a/persistent-qq/package.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: persistent-qq -version: 2.9.1 -synopsis: Provides a quasi-quoter for raw SQL for persistent -description: Please see README and API docs at . -category: Database, Yesod -author: Michael Snoyman -maintainer: Michael Snoyman -license: MIT -github: yesodweb/persistent - -extra-source-files: -- ChangeLog.md -- README.md - -dependencies: -- base >= 4.9 && < 5 -- persistent >= 2.10 -- haskell-src-meta -- mtl -- template-haskell -- text - -library: - ghc-options: -Wall - source-dirs: src - -tests: - specs: - main: Spec.hs - source-dirs: test - ghc-options: -Wall - other-modules: - - PersistentTestModels - - PersistTestPetCollarType - - PersistTestPetType - dependencies: - - base - - persistent-qq - - persistent-sqlite - - persistent-template - - aeson - - fast-logger - - hspec - - HUnit - - monad-logger - - resourcet - - unliftio - diff --git a/persistent-qq/persistent-qq.cabal b/persistent-qq/persistent-qq.cabal new file mode 100644 index 000000000..11fd9256c --- /dev/null +++ b/persistent-qq/persistent-qq.cabal @@ -0,0 +1,73 @@ +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.31.1. +-- +-- see: https://github.com/sol/hpack +-- +-- hash: bef2b585278826bc60fe813d4918833dc06cec43f2a8e4567190448ccfdee163 + +name: persistent-qq +version: 2.9.1 +synopsis: Provides a quasi-quoter for raw SQL for persistent +description: Please see README and API docs at . +category: Database, Yesod +homepage: https://github.com/yesodweb/persistent#readme +bug-reports: https://github.com/yesodweb/persistent/issues +author: Michael Snoyman +maintainer: Michael Snoyman +license: MIT +license-file: LICENSE +build-type: Simple +extra-source-files: + ChangeLog.md + README.md + +source-repository head + type: git + location: https://github.com/yesodweb/persistent + +library + exposed-modules: + Database.Persist.Sql.Raw.QQ + other-modules: + Paths_persistent_qq + hs-source-dirs: + src + ghc-options: -Wall + build-depends: + base >=4.9 && <5 + , haskell-src-meta + , mtl + , persistent >=2.10 + , template-haskell + , text + default-language: Haskell2010 + +test-suite specs + type: exitcode-stdio-1.0 + main-is: Spec.hs + other-modules: + PersistentTestModels + PersistTestPetCollarType + PersistTestPetType + hs-source-dirs: + test + ghc-options: -Wall + build-depends: + HUnit + , aeson + , base + , fast-logger + , haskell-src-meta + , hspec + , monad-logger + , mtl + , persistent >=2.10 + , persistent-qq + , persistent-sqlite + , persistent-template + , resourcet + , template-haskell + , text + , unliftio + default-language: Haskell2010 diff --git a/persistent-sqlite/persistent-sqlite.cabal b/persistent-sqlite/persistent-sqlite.cabal index 627375838..c79a9d321 100644 --- a/persistent-sqlite/persistent-sqlite.cabal +++ b/persistent-sqlite/persistent-sqlite.cabal @@ -38,7 +38,7 @@ flag json1 library build-depends: base >= 4.9 && < 5 - , persistent >= 2.9 && < 3 + , persistent >= 2.10 && < 3 , aeson >= 1.0 , bytestring >= 0.10 , conduit >= 1.2.12 diff --git a/travis/run.sh b/travis/run.sh index 2eff76d65..27acc17f8 100755 --- a/travis/run.sh +++ b/travis/run.sh @@ -4,4 +4,13 @@ set -euxo pipefail psql -c 'create database persistent;' -U postgres mysql -e 'create database persistent;' -exec stack $ARGS --no-terminal test --bench --no-run-benchmarks + +case "$BUILD" in +stack) + exec stack --no-terminal $ARGS test --bench --no-run-benchmarks + ;; +cabal) + cabal new-test all + ;; +esac +set +ex