diff options
-rw-r--r-- | .travis.yml | 26 | ||||
-rwxr-xr-x | scripts/travis-build.sh | 32 | ||||
-rwxr-xr-x | scripts/travis-checkout.sh | 24 |
3 files changed, 82 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..34691284 --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/scripts/travis-build.sh b/scripts/travis-build.sh new file mode 100755 index 00000000..d41f7ed0 --- /dev/null +++ b/scripts/travis-build.sh @@ -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 "$@" diff --git a/scripts/travis-checkout.sh b/scripts/travis-checkout.sh new file mode 100755 index 00000000..f46e510d --- /dev/null +++ b/scripts/travis-checkout.sh @@ -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 "$@" |