Add travis CI config

This will let us setup travis-ci on the Breakpad GitHub mirror.

R=vapier@chromium.org, mark@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1873133003 .
This commit is contained in:
Ted Mielczarek 2016-04-12 14:55:52 -04:00
parent 205b5ac6ed
commit 0203b0cbdd
3 changed files with 82 additions and 0 deletions

26
.travis.yml Normal file
View File

@ -0,0 +1,26 @@
# Travis build integration.
# https://docs.travis-ci.com/
language: cpp
# TODO: add a clang build as well.
compiler:
- gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
# Travis sets CC/CXX to the system toolchain based on the `compiler`
# selection. If clang is added, this should move to be set inside the
# matrix.
env:
- USE_CC=gcc-4.8 USE_CXX=g++-4.8
before_install: ./scripts/travis-checkout.sh
script: ./scripts/travis-build.sh
# TODO: add mac support
os:
- linux
notifications:
email:
- google-breakpad-dev@googlegroups.com

32
scripts/travis-build.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
set -ex
setup_env() {
# Travis sets CC/CXX to the system toolchain, so our .travis.yml
# exports USE_{CC,CXX} for this script to use.
if [ -n "$USE_CC" ]; then
export CC=$USE_CC
fi
if [ -n "$USE_CXX" ]; then
export CXX=$USE_CXX
fi
# Use -jN for faster builds. Travis build machines under Docker
# have a lot of cores, but are memory-limited, so the kernel
# will OOM if we try to use them all, so use at most 4.
# See https://github.com/travis-ci/travis-ci/issues/1972
export NCPUS=$(getconf _NPROCESSORS_ONLN)
export JOBS=$(( $NCPUS < 4 ? $NCPUS : 4 ))
}
build() {
./configure
make -j${JOBS} check
}
main() {
setup_env
build
}
main "$@"

24
scripts/travis-checkout.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
set -ex
get_depot_tools() {
cd
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
PATH="$HOME/depot_tools:$PATH"
}
gclient_sync() {
# Rename the source dir to match what gclient expects.
srcdir=$(basename "$TRAVIS_BUILD_DIR")
cd "${TRAVIS_BUILD_DIR}"/..
mv "${srcdir}" src
gclient config --unmanaged https://github.com/google/breakpad.git
gclient sync
}
main() {
get_depot_tools
gclient_sync
}
main "$@"