Skip to content

Commit

Permalink
Merge pull request commercialhaskell#1404 from phadej/travis-multiple
Browse files Browse the repository at this point in the history
Build on travis with stack too
  • Loading branch information
borsboom committed Nov 24, 2015
2 parents 4f2d1ed + a780bef commit 5c4d9ef
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 42 deletions.
12 changes: 12 additions & 0 deletions .travis-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@

set -eux

case "$BUILD" in
stack)
mkdir -p ~/.local/bin;
if [ `uname` = "Darwin" ]; then
curl -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
else
curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
fi
stack --no-terminal setup;;
cabal)
mkdir -p $HOME/.cabal
cat > $HOME/.cabal/config <<EOF
remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/
remote-repo-cache: $HOME/.cabal/packages
jobs: \$ncpus
EOF
;;
esac
111 changes: 69 additions & 42 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,64 +7,91 @@
# sane build environment. In CI, we want to make our life more difficult, so we
# use cabal without any Stackage snapshots.
#
language: c
sudo: false

cache:
directories:
- $HOME/.ghc
- $HOME/.cabal
- $HOME/.stack

addons:
apt:
sources:
- hvr-ghc
packages:
- cabal-install-1.18
- cabal-install-1.22
- cabal-install-head
- ghc-7.8.4
- ghc-7.10.1
- ghc-7.10.2
- ghc-head
matrix:
include:
- env: BUILD=cabal CABALVER=1.18 GHCVER=7.8.4
compiler: ": #GHC 7.8.4"
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}

env:
- CABALVER=1.18 GHCVER=7.8.4
- CABALVER=1.22 GHCVER=7.10.1
- CABALVER=1.22 GHCVER=7.10.2
- CABALVER=head GHCVER=head # see section about GHC HEAD snapshots
- env: BUILD=cabal CABALVER=1.22 GHCVER=7.10.1
compiler: ": #GHC 7.10.1"
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}}

- env: BUILD=cabal CABALVER=1.22 GHCVER=7.10.2
compiler: ": #GHC 7.10.2"
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}

- env: BUILD=cabal CABALVER=1.22 GHCVER=7.10.3
compiler: ": #GHC 7.10.3"
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}

- env: BUILD=stack GHCVER=7.8.4 STACK_YAML=stack-7.8.yaml
compiler: ": #stack 7.8.4"
addons: {apt: {packages: [cabal-install-head,ghc-7.8.4], sources: [hvr-ghc]}}

- env: BUILD=stack GHCVER=7.10.2 STACK_YAML=stack.yaml
compiler: ": #stack 7.10.2"
addons: {apt: {packages: [cabal-install-head,ghc-7.10.2], sources: [hvr-ghc]}}

- env: BUILD=cabal CABALVER=head GHCVER=head
compiler: ": #GHC head"
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}

- env: BUILD=stack STACK_YAML=stack.yaml
compiler: ": #stack 7.10.2 osx"
os: osx

matrix:
allow_failures:
- env: CABALVER=head GHCVER=head
- env: BUILD=cabal CABALVER=head GHCVER=head

# Note: the distinction between `before_install` and `install` is not important.
# - in before_install we install build tools
# - in install we install (haskell) dependencies
before_install:
- export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
- unset CC
- case "$BUILD" in
stack)
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:$PATH;;
cabal)
export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH;;
esac
- ./.travis-setup.sh

install:
- cabal --version
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- travis_retry cabal update
- cabal install --only-dependencies --constraint="ignore +without-pcre" --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0
- case "$BUILD" in
stack)
stack --no-terminal test --only-dependencies;;
cabal)
cabal --version;
travis_retry cabal update;
cabal install --only-dependencies --constraint="ignore +without-pcre" --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0;;
esac

script:
- if [ -f configure.ac ]; then autoreconf -i; fi
- cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror" # -v2 provides useful information for debugging
- cabal build # this builds all libraries and executables (including tests/benchmarks)
- cabal test
- cabal check
- cabal sdist # tests that a source-distribution can be generated

- cabal copy
- cd test/integration
# Takes too long for now
# - stack setup
# - stack test
- cd ../..

# Check that the resulting source distribution can be built & installed.
# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
# `cabal install --force-reinstalls dist/*-*.tar.gz`
- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
- case "$BUILD" in
stack)
stack --no-terminal test;;
cabal)
cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror";
cabal build;
cabal test;
cabal check;
cabal sdist;
cabal copy;
cd test/integration;
true stack setup;
true stack test;
cd ../..;
SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
(cd dist && cabal install --force-reinstalls "$SRC_TGZ");;
esac

0 comments on commit 5c4d9ef

Please sign in to comment.