Skip to content

Commit

Permalink
Matt/build with cabal (#900)
Browse files Browse the repository at this point in the history
* Fix version bound; revision on Hackage

* Add cabal to travis builds

* Use persistent-qq.cabal instead of package.yaml
  • Loading branch information
parsonsmatt authored May 3, 2019
1 parent fb29c8f commit 1e356ad
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 57 deletions.
92 changes: 86 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ packages:
persistent-postgresql
persistent-redis
persistent-qq

1 change: 0 additions & 1 deletion persistent-qq/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
persistent-qq.cabal
48 changes: 0 additions & 48 deletions persistent-qq/package.yaml

This file was deleted.

73 changes: 73 additions & 0 deletions persistent-qq/persistent-qq.cabal
Original file line number Diff line number Diff line change
@@ -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 <http://www.stackage.org/package/persistent>.
category: Database, Yesod
homepage: https://github.com/yesodweb/persistent#readme
bug-reports: https://github.com/yesodweb/persistent/issues
author: Michael Snoyman <[email protected]>
maintainer: Michael Snoyman <[email protected]>
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
2 changes: 1 addition & 1 deletion persistent-sqlite/persistent-sqlite.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion travis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1e356ad

Please sign in to comment.