travis-CI: switch to make_travis_yml_2 and apply skip_no_match_branch.

This commit is contained in:
Kei Hibino 2017-07-16 15:29:28 +09:00
parent 8fb4572d8e
commit 2472892bf1
7 changed files with 189 additions and 43 deletions

View File

@ -1,66 +1,88 @@
language: c
sudo: false
git:
submodules: false # whether to recursively clone submodules
cache:
directories:
- $HOME/.cabsnap
- $HOME/.cabal/packages
- $HOME/.stack
- $HOME/.cabal/store
before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.etag
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.cache
# 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:
- env: STACK_RESOLVER=lts-8.13
- env: STACK_RESOLVER=lts-8.22
addons: {apt: {packages: [libgmp-dev]}}
- env: STACK_RESOLVER=lts-7.20
- env: STACK_RESOLVER=lts-7.24
addons: {apt: {packages: [libgmp-dev]}}
- env: GHCVER=8.0.1 CABALVER=1.24 CABAL_JOBS=-j2
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
- env: GHCVER=7.6.3 CABALVER=1.16
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
- 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: STACK_RESOLVER=lts-6.29
addons: {apt: {packages: [libgmp-dev]}}
- env: GHCVER=7.10.3 CABALVER=1.22
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
- env: GHCVER=7.8.4 CABALVER=1.18 CABAL_JOBS=-j2
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
- 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: GHCVER=7.6.1 CABALVER=1.16
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.1], sources: [hvr-ghc]}}
- env: GHCVER=7.6.2 CABALVER=1.16
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.2], sources: [hvr-ghc]}}
- env: GHCVER=7.8.1 CABALVER=1.18 CABAL_JOBS=-j2
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.1], sources: [hvr-ghc]}}
- env: GHCVER=7.8.2 CABALVER=1.18 CABAL_JOBS=-j2
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.2], sources: [hvr-ghc]}}
- env: GHCVER=7.8.3 CABALVER=1.18 CABAL_JOBS=-j2
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.3], sources: [hvr-ghc]}}
## parallel is slower for 7.10.x ??
- env: GHCVER=7.10.1 CABALVER=1.22
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}}
- env: GHCVER=7.10.2 CABALVER=1.22
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.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]}}
- 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-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-7.8.4"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.4], sources: [hvr-ghc]}}
- compiler: "ghc-7.6.3"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.6.3], sources: [hvr-ghc]}}
- compiler: "ghc-7.4.1" # with Debian Wheezy
env: DEBIANVER=wheezy
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.4.1], sources: [hvr-ghc]}}
- compiler: "ghc-7.4.1"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.4.1], sources: [hvr-ghc]}}
- compiler: "ghc-7.4.2"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.4.2], sources: [hvr-ghc]}}
- compiler: "ghc-7.6.1"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.6.1], sources: [hvr-ghc]}}
- compiler: "ghc-7.6.2"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.6.2], sources: [hvr-ghc]}}
- compiler: "ghc-7.8.1"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.1], sources: [hvr-ghc]}}
- compiler: "ghc-7.8.2"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.2], sources: [hvr-ghc]}}
- compiler: "ghc-7.8.3"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.3], sources: [hvr-ghc]}}
- compiler: "ghc-7.10.1"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.1], sources: [hvr-ghc]}}
- compiler: "ghc-7.10.2"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.2], sources: [hvr-ghc]}}
- compiler: "ghc-8.0.1"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.1], sources: [hvr-ghc]}}
before_install:
## - 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 ;
export HC=${CC} ;
unset CC ;
export PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH ;
fi
install:
@ -68,7 +90,7 @@ install:
then
./travis-CI/stack/install.sh ;
else
./travis-CI/cabal-hvr-ghc/install.sh ;
./travis-CI/cabal-hvr-ghc-2/install.sh ;
fi
# Here starts the actual work to be performed for the package under test;
@ -78,6 +100,6 @@ script:
then
./travis-CI/stack/script.sh ;
else
./travis-CI/cabal-hvr-ghc/script.sh ;
./travis-CI/cabal-hvr-ghc-2/script.sh ;
fi
# EOF

View File

@ -0,0 +1,35 @@
#!/bin/sh
set -e
. ./travis-CI/sh-lib
. ./travis-CI/custom-cabal
. ./travis-CI/dirs.list
set -x
cabal --version
echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
BENCH=${BENCH---enable-benchmarks}
TEST=${TEST---enable-tests}
gen_custom_cabal_config
custom_retry cabal update -v
sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
install_package() {
rm -fv cabal.project.local
echo 'packages: .' > cabal.project
rm -f cabal.project.freeze
cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all
cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all
}
if [ x"$dirs" = x ]; then
install_package
else
for d in $dirs; do
( cd $d && install_package )
done
fi

View File

@ -0,0 +1,40 @@
#!/bin/sh
set -e
. ./travis-CI/dirs.list
set -x
script_build() {
PKGNAME="$1"
if [ -f configure.ac ]; then autoreconf -i; fi
rm -rf .ghc.environment.* dist/
cabal sdist # test that a source-distribution can be generated
cd dist/
SRCTAR=$(echo ${PKGNAME}-*.tar.gz)
SRC_BASENAME="${SRCTAR%.tar.gz}"
tar -xvf "./${SRC_BASENAME}.tar.gz"
cd "$SRC_BASENAME/"
## from here on, CWD is inside the extracted source-tarball
rm -fv cabal.project.local
echo 'packages: .' > cabal.project
# this builds all libraries and executables (without tests/benchmarks)
rm -f cabal.project.freeze
cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
# this builds all libraries and executables (including tests/benchmarks)
# - rm -rf ./dist-newstyle
# build & run tests
cabal new-build -w ${HC} ${TEST} ${BENCH} all
if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
}
if [ x"$dirs" = x ]; then
script_build $PKGNAME
else
for d in $dirs; do
( cd $d && script_build "$d" )
done
fi

View File

@ -20,3 +20,44 @@ build-summary: ${HOME}/.cabal/logs/build.log
remote-build-reporting: anonymous
EOF
}
skip_no_match_branch () {
set +x
cat <<EOF
STACK_RESOLVER: $STACK_RESOLVER
TRAVIS_BRANCH: $TRAVIS_BRANCH
EOF
case x"$STACK_RESOLVER" in
xlts-[678]*)
case x"$TRAVIS_BRANCH" in
xlts-*)
cat <<EOF
STACK_RESOLVER is LTS-[876] and TRAVIS_BRANCH is LTS-8.
EOF
;;
*)
cat <<EOF
Skipping. STACK_RESOLVER is LTS-[876] and TRAVIS_BRANCH is NOT LTS-8.
EOF
set -x
exit 0
;;
esac
;;
*)
case x"$TRAVIS_BRANCH" in
xlts-*)
cat <<EOF
Skipping. STACK_RESOLVER is not LTS-[876] and TRAVIS_BRANCH is LTS-8.
EOF
;;
*)
cat <<EOF
STACK_RESOLVER is not LTS-[876] and TRAVIS_BRANCH is NOT LTS-8.
EOF
;;
esac
;;
esac
set -x
}

View File

@ -6,6 +6,8 @@ set -e
set -x
skip_no_match_branch
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'

View File

@ -2,10 +2,13 @@
set -e
. ./travis-CI/sh-lib
. ./travis-CI/dirs.list
set -x
skip_no_match_branch
checkout_root=$(pwd)
install_package() {

View File

@ -2,10 +2,13 @@
set -e
. ./travis-CI/sh-lib
. ./travis-CI/dirs.list
set -x
skip_no_match_branch
script_build() {
STACK_YAML=stack-travis.yaml stack build
STACK_YAML=stack-travis.yaml stack test