mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2025-01-07 13:46:41 +03:00
add stack entries to travis-ci.
This commit is contained in:
parent
f631154ea0
commit
283431e244
111
.travis.yml
111
.travis.yml
@ -1,4 +1,4 @@
|
||||
# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
|
||||
|
||||
language: c
|
||||
sudo: false
|
||||
|
||||
@ -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,75 +14,79 @@ before_cache:
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- env: CABALVER=1.24 GHCVER=8.0.1
|
||||
compiler: ": #GHC 8.0.1"
|
||||
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
|
||||
- env: DEBIANVER=wheezy CABALVER=1.16 GHCVER=7.4.1
|
||||
compiler: ": Debian wheezy"
|
||||
# nightly for ghc 8.0.2
|
||||
- env: STACK_RESOLVER=nightly-2017-01-31
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
- env: STACK_RESOLVER=lts-7.18
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
- env: STACK_RESOLVER=lts-6.29
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
- env: DEBIANVER=wheezy GHCVER=7.4.1 CABALVER=1.16 NO_CABAL_CACHE=1
|
||||
addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.1], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.16 GHCVER=7.4.2
|
||||
compiler: ": #GHC 7.4.2"
|
||||
- env: GHCVER=7.4.1 CABALVER=1.16
|
||||
addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.1], sources: [hvr-ghc]}}
|
||||
- env: GHCVER=7.4.2 CABALVER=1.16
|
||||
addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}}
|
||||
- env: 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: 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.16 GHCVER=7.6.3
|
||||
compiler: ": #GHC 7.6.3"
|
||||
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.16 GHCVER=7.4.1
|
||||
compiler: ": #GHC 7.4.1"
|
||||
addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.1], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.16 GHCVER=7.6.1
|
||||
compiler: ": #GHC 7.6.1"
|
||||
- env: GHCVER=7.6.1 CABALVER=1.16
|
||||
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.1], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.16 GHCVER=7.6.2
|
||||
compiler: ": #GHC 7.6.2"
|
||||
- env: GHCVER=7.6.2 CABALVER=1.16
|
||||
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.2], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.18 GHCVER=7.8.1
|
||||
compiler: ": #GHC 7.8.1"
|
||||
- env: GHCVER=7.6.3 CABALVER=1.16
|
||||
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
|
||||
- env: GHCVER=7.8.1 CABALVER=1.18 CABAL_JOBS=-j
|
||||
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.1], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.18 GHCVER=7.8.2
|
||||
compiler: ": #GHC 7.8.2"
|
||||
- env: GHCVER=7.8.2 CABALVER=1.18 CABAL_JOBS=-j
|
||||
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.2], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.18 GHCVER=7.8.3
|
||||
compiler: ": #GHC 7.8.3"
|
||||
- env: GHCVER=7.8.3 CABALVER=1.18 CABAL_JOBS=-j
|
||||
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.3], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.22 GHCVER=7.10.1
|
||||
compiler: ": #GHC 7.10.1"
|
||||
- env: GHCVER=7.8.4 CABALVER=1.18 CABAL_JOBS=-j
|
||||
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
|
||||
- env: GHCVER=7.10.1 CABALVER=1.22 CABAL_JOBS=-j
|
||||
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.22 GHCVER=7.10.2
|
||||
compiler: ": #GHC 7.10.2"
|
||||
- env: GHCVER=7.10.2 CABALVER=1.22 CABAL_JOBS=-j
|
||||
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
|
||||
- env: GHCVER=7.10.3 CABALVER=1.22 CABAL_JOBS=-j
|
||||
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
|
||||
- env: GHCVER=8.0.1 CABALVER=1.24 CABAL_JOBS=-j
|
||||
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
|
||||
|
||||
before_install:
|
||||
- unset CC
|
||||
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
|
||||
- case "$DEBIANVER" in
|
||||
wheezy)
|
||||
export CABAL_CONSTRAINTS='--constraint=transformers==0.3.0.0 --constraint=containers==0.4.2.1 --constraint=bytestring==0.9.2.1 --constraint=text==0.11.2.0 --constraint=time==1.4 --constraint=dlist==0.5 --constraint=convertible==1.0.11.1 --constraint=HDBC==2.3.1.1' ;
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
## - cat /proc/cpuinfo
|
||||
- if [ x"$STACK_RESOLVER" != x ];
|
||||
then
|
||||
./travis-CI/stack/before-install.sh ;
|
||||
export PATH=$HOME/.local/bin:$PATH ;
|
||||
export STACK_YAML=stack-travis.yaml ;
|
||||
else
|
||||
export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH ;
|
||||
case "$DEBIANVER" in
|
||||
wheezy)
|
||||
export CABAL_CONSTRAINTS='--constraint=transformers==0.3.0.0 --constraint=containers==0.4.2.1 --constraint=bytestring==0.9.2.1 --constraint=text==0.11.2.0 --constraint=time==1.4 --constraint=dlist==0.5 --constraint=convertible==1.0.11.1 --constraint=HDBC==2.3.1.1' ;
|
||||
;;
|
||||
'')
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported DEBIANVER, $DEBIANVER" ;
|
||||
exit 1 ;
|
||||
;;
|
||||
esac ;
|
||||
fi
|
||||
|
||||
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 ];
|
||||
- if [ x"$STACK_RESOLVER" != x ];
|
||||
then
|
||||
zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
|
||||
$HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
|
||||
./travis-CI/stack/install.sh ;
|
||||
else
|
||||
./travis-CI/cabal-hvr-ghc/install.sh ;
|
||||
fi
|
||||
- travis_retry cabal update -v
|
||||
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
|
||||
- ./travis-CI/multi-ghc/install.sh
|
||||
|
||||
# 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:
|
||||
- ./travis-CI/multi-ghc/script.sh
|
||||
|
||||
- if [ x"$STACK_RESOLVER" != x ];
|
||||
then
|
||||
./travis-CI/stack/script.sh ;
|
||||
else
|
||||
./travis-CI/cabal-hvr-ghc/script.sh ;
|
||||
fi
|
||||
# EOF
|
||||
|
70
travis-CI/cabal-hvr-ghc/install.sh
Executable file
70
travis-CI/cabal-hvr-ghc/install.sh
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. ./travis-CI/sh-lib
|
||||
. ./travis-CI/dirs.list
|
||||
|
||||
set -x
|
||||
|
||||
cabal --version
|
||||
echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
|
||||
|
||||
## In package list cache hit case, cabal install may fail
|
||||
(
|
||||
cd $HOME/.cabal/packages/hackage.haskell.org/
|
||||
rm -f \
|
||||
00-index.tar.gz.etag \
|
||||
00-index.tar.gz \
|
||||
00-index.tar \
|
||||
00-index.cache
|
||||
)
|
||||
|
||||
custom_retry cabal update -v
|
||||
sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
|
||||
|
||||
install_package() {
|
||||
id="$1"
|
||||
|
||||
if [ x"$id" = x ]; then
|
||||
install_plan=installplan.txt
|
||||
else
|
||||
install_plan=installplan-${id}.txt
|
||||
fi
|
||||
|
||||
cabal install $CABAL_CONSTRAINTS --only-dependencies --enable-tests --enable-benchmarks --dry -v > ${install_plan}
|
||||
sed -i -e '1,/^Resolving /d' ${install_plan}; cat ${install_plan}
|
||||
|
||||
cabsnap_dir=$HOME/.cabsnap/s-${CABALVER}
|
||||
|
||||
# check whether current requested install-plan matches cached package-db snapshot
|
||||
if [ x"NO_CABAL_CACHE" = x ] && diff -u ${cabsnap_dir}/${install_plan} ${install_plan};
|
||||
then
|
||||
echo "cabal build-cache HIT";
|
||||
rm -rfv .ghc;
|
||||
cp -a ${cabsnap_dir}/ghc $HOME/.ghc;
|
||||
cp -a ${cabsnap_dir}/lib ${cabsnap_dir}/share ${cabsnap_dir}/bin $HOME/.cabal/;
|
||||
else
|
||||
echo "cabal build-cache MISS";
|
||||
rm -rf ${cabsnap_dir};
|
||||
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
|
||||
cabal install $CABAL_JOBS $CABAL_CONSTRAINTS --only-dependencies --enable-tests --enable-benchmarks;
|
||||
fi
|
||||
|
||||
# snapshot package-db on cache miss
|
||||
if [ ! -d ${cabsnap_dir} ];
|
||||
then
|
||||
echo "snapshotting package-db to build-cache";
|
||||
mkdir -p ${cabsnap_dir};
|
||||
cp -a $HOME/.ghc ${cabsnap_dir}/ghc;
|
||||
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin ${install_plan} ${cabsnap_dir}/;
|
||||
fi
|
||||
}
|
||||
|
||||
if [ x"$dirs" = x ]; then
|
||||
install_package ''
|
||||
else
|
||||
for d in $dirs; do
|
||||
( cd $d && install_package $( echo $d | sed 's@/@_@g' ) )
|
||||
done
|
||||
fi
|
30
travis-CI/cabal-hvr-ghc/script.sh
Executable file
30
travis-CI/cabal-hvr-ghc/script.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. ./travis-CI/dirs.list
|
||||
|
||||
set -x
|
||||
|
||||
script_build() {
|
||||
if [ -f configure.ac ]; then autoreconf -i; fi
|
||||
cabal configure $CABAL_CONSTRAINTS --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
|
||||
cabal build $CABAL_JOBS # this builds all libraries and executables (including tests/benchmarks)
|
||||
cabal test $CABAL_JOBS
|
||||
cabal check
|
||||
cabal sdist # 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")
|
||||
}
|
||||
|
||||
if [ x"$dirs" = x ]; then
|
||||
script_build
|
||||
else
|
||||
for d in $dirs; do
|
||||
( cd $d && script_build )
|
||||
done
|
||||
fi
|
11
travis-CI/dirs.list
Normal file
11
travis-CI/dirs.list
Normal file
@ -0,0 +1,11 @@
|
||||
dirs='
|
||||
names-th
|
||||
sql-words
|
||||
persistable-record
|
||||
relational-query
|
||||
relational-schemas
|
||||
HDBC-session
|
||||
relational-query-HDBC
|
||||
text-postgresql
|
||||
persistable-types-HDBC-pg
|
||||
'
|
12
travis-CI/sh-lib
Normal file
12
travis-CI/sh-lib
Normal file
@ -0,0 +1,12 @@
|
||||
## -*- sh -*-
|
||||
|
||||
custom_retry() {
|
||||
i=0
|
||||
until "$@" ; do
|
||||
if [ $i -ge 3 ]; then
|
||||
break;
|
||||
fi
|
||||
sleep 1
|
||||
i=$(expr $i + 1)
|
||||
done
|
||||
}
|
11
travis-CI/stack/before-install.sh
Executable file
11
travis-CI/stack/before-install.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. ./travis-CI/sh-lib
|
||||
|
||||
set -x
|
||||
|
||||
mkdir -p ~/.local/bin
|
||||
custom_retry curl -L https://www.stackage.org/stack/linux-x86_64 \
|
||||
| tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
|
27
travis-CI/stack/install.sh
Executable file
27
travis-CI/stack/install.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. ./travis-CI/dirs.list
|
||||
|
||||
set -x
|
||||
|
||||
checkout_root=$(pwd)
|
||||
|
||||
install_package() {
|
||||
sed "s/^resolver: .*/resolver: ${STACK_RESOLVER}/" \
|
||||
< $checkout_root/travis-CI/stack/template.yaml \
|
||||
> stack-travis.yaml
|
||||
## stack.yaml must be located the same directory which has *.cabal -- constraint of stack?
|
||||
|
||||
STACK_YAML=stack-travis.yaml stack setup
|
||||
STACK_YAML=stack-travis.yaml stack install --only-dependencies
|
||||
}
|
||||
|
||||
if [ x"$dirs" = x ]; then
|
||||
install_package
|
||||
else
|
||||
for d in $dirs; do
|
||||
( cd $d && install_package )
|
||||
done
|
||||
fi
|
20
travis-CI/stack/script.sh
Executable file
20
travis-CI/stack/script.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. ./travis-CI/dirs.list
|
||||
|
||||
set -x
|
||||
|
||||
script_build() {
|
||||
STACK_YAML=stack-travis.yaml stack build
|
||||
STACK_YAML=stack-travis.yaml stack test --coverage
|
||||
}
|
||||
|
||||
if [ x"$dirs" = x ]; then
|
||||
script_build
|
||||
else
|
||||
for d in $dirs; do
|
||||
( cd $d && script_build )
|
||||
done
|
||||
fi
|
11
travis-CI/stack/template.yaml
Normal file
11
travis-CI/stack/template.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
resolver: #foo
|
||||
|
||||
packages:
|
||||
- '.'
|
||||
|
||||
extra-deps: []
|
||||
flags: {}
|
||||
extra-package-dbs: []
|
||||
system-ghc: false
|
||||
install-ghc: true
|
||||
skip-ghc-check: true
|
Loading…
Reference in New Issue
Block a user