Skip to content

Commit

Permalink
Update stack script
Browse files Browse the repository at this point in the history
  • Loading branch information
psibi committed Jan 31, 2018
1 parent a13db8c commit 472a09a
Showing 1 changed file with 139 additions and 155 deletions.
294 changes: 139 additions & 155 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,162 +1,146 @@
sudo: false
language: c
cache:
directories:
- "$HOME/.ghc"
- "$HOME/.cabal"
- "$HOME/.stack"
# See https://github.com/harendra-kumar/packcheck for all parameters and their
# explanation.
env:
global:
- PACKCHECK="./packcheck.sh"
# The commit id of packcheck.sh to use from
# https://github.com/harendra-kumar/packcheck. Used only when the script
# does not exist in the package repo at the path specified by "PACKCHECK"
- PACKCHECK_COMMIT="da9d6da3d18d6250c06617817f0879324c75c224"
- GHC_OPTIONS="-Werror"
# ------------------------------------------------------------------------
# Builds that need stack
# ------------------------------------------------------------------------
- STACKVER="1.6.3"
- STACK_UPGRADE="y"
# ------------------------------------------------------------------------
# Common parameters: Normally you would not need to customize these params
# ------------------------------------------------------------------------
- CABAL_REINIT_CONFIG=y
- CABAL_CHECK_RELAX=y
- CABAL_NO_SANDBOX=y
- CABAL_HACKAGE_MIRROR=hackage.haskell.org:http://hackage.fpcomplete.com
- TEST_INSTALL=y
- PATH=/bin:/usr/bin
- LC_ALL=C.UTF-8

notifications:
email: false

# This matrix has total 11 builds enabled, 4 builds each (3 last major compiler
# versions and head) for stack and cabal, 2 OSX builds (stack and cabal for
# latest compiler version), and one hlint build. You may want to comment out
# some of the builds to be lighter on the CI infrastructure.
#
# We pre-install the cabal-install package to not incur the penalty of building
# it the first time in cached builds or every time in uncached builds.
matrix:
include:
- env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7 RUN_TESTS=--run-tests
compiler: ": #GHC 7.10.3"
addons:
apt:
packages:
- cabal-install-1.22
- ghc-7.10.3
- happy-1.19.5
- alex-3.1.7
sources:
- hvr-ghc
- env: BUILD=cabal GHCVER=8.0.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 RUN_TESTS=--run-tests
compiler: ": #GHC 8.0.2"
addons:
apt:
packages:
- cabal-install-1.24
- ghc-8.0.2
- happy-1.19.5
- alex-3.1.7
sources:
- hvr-ghc
- env: BUILD=cabal GHCVER=8.2.2 CABALVER=2.0 HAPPYVER=1.19.5 ALEXVER=3.1.7 RUN_TESTS=--run-tests
compiler: ": #GHC 8.2.2"
addons:
apt:
packages:
- cabal-install-2.0
- ghc-8.2.2
- happy-1.19.5
- alex-3.1.7
sources:
- hvr-ghc
- env: BUILD=stack ARGS="--resolver lts-10.2"
compiler: ": #stack 8.2.2"
addons:
apt:
packages:
- libgmp-dev
- env: BUILD=stack ARGS="--resolver lts-10.2"
compiler: ": #stack 8.2.2 osx"
os: osx
- env: BUILD=stack ARGS=""
compiler: ": #stack default"
addons:
apt:
packages:
- libgmp-dev
- env: BUILD=stack ARGS=""
compiler: ": #stack default osx"

# --------------------------------------------------------------------------
# (Linux) stack builds
# --------------------------------------------------------------------------

- env: BUILD=stack CABALVER=1.22 GHCVER=7.10.3 RESOLVER=lts-6
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}

- env: BUILD=stack CABALVER=1.24 GHCVER=8.0.2 RESOLVER=lts-9
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}}

- env: BUILD=stack CABALVER=2.0 GHCVER=8.2.2 RESOLVER=lts-10
addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}

# Nightly
- env: BUILD=stack RESOLVER=nightly

# --------------------------------------------------------------------------
# (Linux) cabal builds require pre-installed cabal-install and ghc
# --------------------------------------------------------------------------

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

- env: BUILD=cabal CABALVER=1.24 GHCVER=8.0.2
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}}

- env: BUILD=cabal CABALVER=2.0 GHCVER=8.2.2
addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}

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

# --------------------------------------------------------------------------
# OS X builds
# --------------------------------------------------------------------------

# GHC 8.2.2/cabal build via stack
- env: BUILD=cabal RESOLVER=lts-10
os: osx
- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7 RUN_TESTS=--run-tests
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 nightly"
compiler: ": #stack nightly"
addons:
apt:
packages:
- libgmp-dev
- env: BUILD=stack ARGS="--resolver nightly"
compiler: ": #stack nightly osx"

# GHC 8.2.2/stack
- env: BUILD=stack RESOLVER=lts-10
os: osx

# --------------------------------------------------------------------------
# Lint
# --------------------------------------------------------------------------

- env: BUILD=stack RESOLVER=lts-10 HLINT_COMMANDS="hlint lint ."

# --------------------------------------------------------------------------
# Build and send coverage report to coveralls.io using hpc-coveralls
# --------------------------------------------------------------------------

# Note COVERALLS (hpc-coveralls) works only with cabal build.
# For this to succeed you have to add your porject to coveralls.io first
#- env: BUILD=cabal CABALVER=2.0 GHCVER=8.2.2 COVERALLS_OPTIONS="--coverage-mode=StrictlyFullLines --exclude-dir=test test"
# addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}

# --------------------------------------------------------------------------
# Builds that are allowed to fail
# --------------------------------------------------------------------------

allow_failures:
- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7 RUN_TESTS=--run-tests
- 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
- |
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)
stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
;;
cabal)
cabal --version
travis_retry cabal update
# Get the list of packages from the stack.yaml file
PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
;;
esac
set +ex
- env: BUILD=stack RESOLVER=nightly
- env: BUILD=cabal CABALVER=head GHCVER=head
- env: BUILD=stack RESOLVER=lts-10 HLINT_COMMANDS="hlint lint ."

# ------------------------------------------------------------------------
# Settings beyond this point are advanced and normally not tweaked
# ------------------------------------------------------------------------

language: generic
sudo: false
cache:
directories:
- $HOME/.cabal
- $HOME/.ghc
- $HOME/.local
- $HOME/.stack
install: true

script:
- |
set -ex
case "$BUILD" in
stack)
stack --no-terminal $ARGS test --bench --no-run-benchmarks
;;
cabal)
cabal install --enable-tests $RUN_TESTS --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
ORIGDIR=$(pwd)
for dir in $PACKAGES
do
cd $dir
cabal check || [ "$CABALVER" == "1.16" ]
cabal sdist
PKGVER=$(cabal info . | awk '{print $2;exit}')
SRC_TGZ=$PKGVER.tar.gz
cd dist
tar zxfv "$SRC_TGZ"
cd "$PKGVER"
cabal configure --enable-tests
cabal build
cd $ORIGDIR
done
;;
esac
set +ex
- |
# When GHCVER or CABALVER env variables are specified, modify the path to
# find the binaries installed from hvr-ghc repo
add_path() { eval "test -n \"\$$1\"" && eval "PATH=/opt/$2/\"\$$1\"/bin:$PATH"; true; }
# Emit the value of the var specified as arg only when the build is cabal
cabal_env() { test "$BUILD" = cabal && echo $1; }
# If a custom stack-yaml is specified, replace the default with that
if test -e "$STACK_YAML"; then rm -f stack.yaml && ln -sv $STACK_YAML stack.yaml; else true; fi
unset STACK_YAML
# Get packcheck if needed
CURL=$(which curl)
PACKCHECK_URL=https://raw.githubusercontent.com/harendra-kumar/packcheck/${PACKCHECK_COMMIT}/packcheck.sh
if test ! -e "$PACKCHECK"; then $CURL -sL -o "$PACKCHECK" $PACKCHECK_URL; fi;
chmod +x $PACKCHECK
add_path GHCVER ghc
add_path CABALVER cabal
# In addition to PACKCHECK envvars hpc-coveralls needs TRAVIS,
# TRAVIS_JOB_ID variables set by the travis CI environment.
- bash -c "$PACKCHECK $BUILD"

0 comments on commit 472a09a

Please sign in to comment.