Use new-build based .travis.yml

This commit is contained in:
Oleg Grenrus 2017-11-08 11:39:45 +02:00
parent 3571f543fd
commit 026d4b8bb4

View File

@ -1,38 +1,95 @@
# This Travis job script has been generated by a script via
#
# make_travis_yml_2.hs '--branch' 'master' '-o' '.travis.yml' 'servant-quickcheck.cabal'
#
# For more information, see https://github.com/hvr/multi-ghc-travis
#
language: c
sudo: false
language: c
git:
submodules: false # whether to recursively clone submodules
env:
- STACK_YAML=stack.yaml
- STACK_YAML=stack-lts-7.yaml
- STACK_YAML=stack-lts-6.yaml
- STACK_YAML=stack-lts-9.yaml
addons:
apt:
packages: libgmp-dev
install:
# stack
- mkdir -p ~/.local/bin
- export PATH=~/.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'
- stack --version
script:
- stack setup --no-terminal
- stack build --ghc-options=-Werror --no-terminal
- stack test --ghc-options=-Werror --no-terminal --coverage
- stack haddock --no-terminal
after_script:
# SHC only has a build for 8.0.1, not above
- if [ "$STACK_YAML" == stack-lts-7.yaml ]
- travis_retry curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.4.0/shc-linux-x64-8.0.1.tar.bz2 | tar -xj
- ./shc servant-quickcheck spec
branches:
only:
- master
cache:
directories:
- $HOME/.stack
- $HOME/.cabal/packages
- $HOME/.cabal/store
before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
# remove files that are regenerated by 'cabal update'
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
matrix:
include:
- compiler: "ghc-7.10.3"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}
- compiler: "ghc-8.0.2"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
- compiler: "ghc-8.2.1"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
before_install:
- HC=${CC}
- HCPKG=${HC/ghc/ghc-pkg}
- unset CC
- PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
install:
- cabal --version
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
- BENCH=${BENCH---enable-benchmarks}
- TEST=${TEST---enable-tests}
- HADDOCK=${HADDOCK-true}
- INSTALLED=${INSTALLED-true}
- travis_retry cabal update -v
- sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
- rm -fv cabal.project.local
- "echo 'packages: .' > cabal.project"
- if [ -f "./configure.ac" ]; then
(cd "."; autoreconf -i);
fi
- rm -f cabal.project.freeze
- cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
- rm -rf "."/.ghc.environment.* "."/dist
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# 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:
# test that source-distributions can be generated
- (cd "."; cabal sdist)
- mv "."/dist/servant-quickcheck-*.tar.gz ${DISTDIR}/
- cd ${DISTDIR}
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
- "printf 'packages: servant-quickcheck-*/*.cabal\n' > cabal.project"
# this builds all libraries and executables (without tests/benchmarks)
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
# Build with installed constraints for packages in global-db
- if $INSTALLED; then
echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh;
else echo "Not building with installed constraints"; fi
# build & run tests, build benchmarks
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
# haddock
- rm -rf ./dist-newstyle
- if $HADDOCK; then cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all; else echo "Skipping haddock generation";fi
# REGENDATA ["--branch","master","-o",".travis.yml","servant-quickcheck.cabal"]
# EOF