mirror of
https://github.com/ekmett/propagators.git
synced 2024-09-11 05:15:41 +03:00
mixed cabal/stack build on travis. add osx testing
This commit is contained in:
parent
f8bdaf4488
commit
2a4617e33b
89
.travis.yml
89
.travis.yml
@ -6,6 +6,7 @@ cache:
|
||||
directories:
|
||||
- $HOME/.cabsnap
|
||||
- $HOME/.cabal/packages
|
||||
- $HOME/.stack
|
||||
|
||||
before_cache:
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
|
||||
@ -13,32 +14,52 @@ before_cache:
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- env: CABALVER=1.22 GHCVER=7.10.2
|
||||
- env: CABALVER=1.22 GHCVER=7.10.1 BUILD=cabal
|
||||
compiler: ": #GHC 7.10.1"
|
||||
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
|
||||
|
||||
- env: CABALVER=1.22 GHCVER=7.10.2 BUILD=cabal
|
||||
compiler: ": #GHC 7.10.2"
|
||||
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
|
||||
|
||||
- env: BUILD=stack STACK_OPTIONS=--skip-ghc-check
|
||||
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
|
||||
|
||||
- env: BUILD=stack
|
||||
os: osx
|
||||
|
||||
|
||||
before_install:
|
||||
- unset CC
|
||||
- export HAPPYVER=1.19.5
|
||||
- export ALEXVER=3.1.4
|
||||
- export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$PATH
|
||||
|
||||
- case "$BUILD" in
|
||||
stack)
|
||||
export STACK_VERSION=0.1.3.0;
|
||||
export PATH=~/bin:$PATH;
|
||||
mkdir -p ~/bin;
|
||||
travis_retry curl -L https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-x86_64-$TRAVIS_OS_NAME.gz | gunzip > ~/bin/stack;
|
||||
chmod a+x ~/bin/stack;
|
||||
scripts/travis_long stack --no-terminal setup;;
|
||||
cabal)
|
||||
export HAPPYVER=1.19.5
|
||||
export ALEXVER=3.1.4
|
||||
export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$PATH;;
|
||||
esac
|
||||
install:
|
||||
- cabal --version
|
||||
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
|
||||
- if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
|
||||
- case "$BUILD" in
|
||||
stack)
|
||||
scripts/travis_long stack --no-terminal $STACK_OPTIONS build --only-snapshot -j2;;
|
||||
cabal)
|
||||
echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
|
||||
cabal --version;
|
||||
if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
|
||||
then
|
||||
zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
|
||||
$HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
|
||||
fi
|
||||
- travis_retry cabal update
|
||||
- "sed -i 's/^jobs:.*$/jobs: 2/' $HOME/.cabal/config"
|
||||
- cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
|
||||
- sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
|
||||
|
||||
# check whether current requested install-plan matches cached package-db snapshot
|
||||
- if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
|
||||
then
|
||||
fi;
|
||||
travis_retry cabal update;
|
||||
cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt;
|
||||
sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt;
|
||||
if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; then
|
||||
echo "cabal build-cache HIT";
|
||||
rm -rfv .ghc;
|
||||
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
|
||||
@ -49,31 +70,31 @@ install:
|
||||
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
|
||||
cabal install --only-dependencies --enable-tests --enable-benchmarks;
|
||||
if [ "$GHCVER" = "7.10.1" ]; then cabal install Cabal-1.22.4.0; fi;
|
||||
fi
|
||||
|
||||
# snapshot package-db on cache miss
|
||||
- if [ ! -d $HOME/.cabsnap ];
|
||||
then
|
||||
fi;
|
||||
if [ ! -d $HOME/.cabsnap ]; then
|
||||
echo "snapshotting package-db to build-cache";
|
||||
mkdir $HOME/.cabsnap;
|
||||
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
|
||||
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
|
||||
fi
|
||||
fi;;
|
||||
esac
|
||||
|
||||
# snapshot package-db on cache miss
|
||||
|
||||
# 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:
|
||||
- cabal configure --enable-tests -v2 # -v2 provides useful information for debugging
|
||||
- cabal build # this builds all libraries and executables (including tests)
|
||||
- cabal test
|
||||
- cabal bench || true # expected result: these will crash
|
||||
- cabal sdist || true # tests that a source-distribution can be generated
|
||||
|
||||
# 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)
|
||||
scripts/travis_long stack --no-terminal $STACK_OPTIONS build -j2;;
|
||||
cabal)
|
||||
cabal configure --enable-tests -v2;
|
||||
cabal build;
|
||||
cabal test;
|
||||
cabal bench || true;
|
||||
cabal sdist || true;
|
||||
SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && (cd dist && cabal install --force-reinstalls "$SRC_TGZ");;
|
||||
esac
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
|
17
scripts/travis_long
Executable file
17
scripts/travis_long
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
$* &
|
||||
pidA=$!
|
||||
minutes=0
|
||||
|
||||
while true; do sleep 60; ((minutes++)); echo -e "\033[0;32m$minutes minute(s) elapsed.\033[0m"; done &
|
||||
pidB=$!
|
||||
|
||||
wait $pidA
|
||||
exitCode=$?
|
||||
|
||||
echo -e "\033[0;32m$* finished.\033[0m"
|
||||
|
||||
kill -9 $pidB
|
||||
|
||||
exit $exitCode
|
1
stack.yaml
Normal file
1
stack.yaml
Normal file
@ -0,0 +1 @@
|
||||
resolver: nightly-2015-09-20
|
Loading…
Reference in New Issue
Block a user