Split travis-ci.sh

* travis-ci.sh: Split into travis-build.sh, travis-install.sh,
and travis-success.sh files.
* .travis.yml (before_install, after_success, git): New mappings.
(script): Change to travis-build.sh.
(addons, install): Remove.
(env): Remove matrix.
(matrix): Replace exclude list with include list.
This commit is contained in:
Дмитрий Левин 2016-06-18 22:53:25 +00:00
parent b0c51131a3
commit cb7409c87a
5 changed files with 99 additions and 75 deletions

View File

@ -2,38 +2,40 @@ language: c
dist: trusty
script: ./travis-ci.sh
before_install: ./travis-install.sh
script: ./travis-build.sh
after_success: ./travis-success.sh
sudo: required
compiler:
- gcc
- clang-3.6
- musl-gcc
addons:
apt:
packages:
- gcc-multilib
- lcov
install:
- pip install --user codecov
git:
depth: 2147483647
env:
global:
- SLEEP_A_BIT="sleep 0.2"
- VERBOSE="1"
matrix:
- TARGET=x86_64
- TARGET=x32
- TARGET=x86
matrix:
exclude:
include:
- compiler: gcc
env:
- TARGET=x86_64
- COVERAGE=true
- compiler: gcc
env:
- TARGET=x32
- compiler: gcc
env:
- TARGET=x86
- compiler: clang-3.6
env: TARGET=x32
env:
- TARGET=x86_64
- compiler: musl-gcc
env: TARGET=x32
- compiler: musl-gcc
env: TARGET=x86
env:
- TARGET=x86_64
- compiler: clang-3.6
env:
- TARGET=x86

32
travis-build.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh -ex
case "$CC" in
gcc)
ENABLE_GCC_WERROR=--enable-gcc-Werror
;;
clang-*)
# clang -mx32 fails with the following error:
# clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
export st_cv_mx32_runtime=no
;;
esac
case "${TARGET-}" in
x32)
CC="$CC -mx32"
;;
x86)
CC="$CC -m32"
export DISTCHECK_CONFIGURE_FLAGS='--build=i686-pc-linux-gnu'
;;
esac
$CC --version
export CC_FOR_BUILD="$CC"
./git-set-file-times
./bootstrap
./configure --enable-maintainer-mode ${ENABLE_GCC_WERROR-} ${DISTCHECK_CONFIGURE_FLAGS-}
j=-j`getconf _NPROCESSORS_ONLN 2> /dev/null` || j=
make -k $j distcheck VERBOSE=${VERBOSE-}

View File

@ -1,52 +0,0 @@
#!/bin/sh -ex
case "$CC" in
gcc)
ENABLE_GCC_WERROR=--enable-gcc-Werror
;;
clang-*)
sudo apt-get -qq update
sudo apt-get -qq --no-install-suggests --no-install-recommends install -y \
"$CC"
# clang -mx32 fails with the following error:
# clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
export st_cv_mx32_runtime=no
;;
musl-gcc)
sudo add-apt-repository ppa:bortis/musl -y
sudo apt-get -qq update
sudo apt-get -qq --no-install-suggests --no-install-recommends install -y \
musl-tools linux-musl-dev
;;
esac
case "${TARGET-}" in
x32)
CC="$CC -mx32"
;;
x86)
export DISTCHECK_CONFIGURE_FLAGS='--build=i686-pc-linux-gnu'
CC="$CC -m32"
;;
esac
export CC_FOR_BUILD="$CC"
$CC --version
git fetch --unshallow
./git-set-file-times
./bootstrap
./configure --enable-maintainer-mode ${ENABLE_GCC_WERROR-} ${DISTCHECK_CONFIGURE_FLAGS-}
j=-j`getconf _NPROCESSORS_ONLN 2> /dev/null` || j=
make -k $j distcheck VERBOSE=${VERBOSE-}
if [ "$CC:${TARGET-}" = 'gcc:x86_64' ]; then
set -- strace-*.tar.xz
tar -xf "$1"
dir="${1%.tar.xz}"
cd "$dir"
./configure --enable-code-coverage ${ENABLE_GCC_WERROR-} ${DISTCHECK_CONFIGURE_FLAGS-}
make -k $j
make -k $j check VERBOSE=${VERBOSE-}
codecov --gcov-args=-abcp ||:
fi

30
travis-install.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh -ex
updated=
apt_get_install()
{
[ -n "$updated" ] || {
sudo apt-get -qq update
updated=1
}
sudo apt-get -qq --no-install-suggests --no-install-recommends \
install -y "$@"
}
case "$CC" in
gcc)
apt_get_install gcc-multilib
;;
clang-*)
apt_get_install gcc-multilib "$CC"
;;
musl-gcc)
sudo add-apt-repository ppa:bortis/musl -y
apt_get_install gcc-multilib musl-tools linux-musl-dev
;;
esac
if [ "${COVERAGE-}" = true ]; then
apt_get_install lcov
pip install --user codecov
fi

12
travis-success.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh -ex
if [ "${COVERAGE-}" = true ]; then
set -- strace-*.tar.xz
tar -xf "$1"
dir="${1%.tar.xz}"
cd "$dir"
export CC_FOR_BUILD="$CC"
./configure --enable-code-coverage
make -k $j all check VERBOSE=${VERBOSE-}
codecov --gcov-args=-abcp ||:
fi