| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 set -ex | 3 set -ex |
| 4 | 4 |
| 5 setup_env() { | 5 setup_env() { |
| 6 # Travis sets CC/CXX to the system toolchain, so our .travis.yml | 6 # Travis sets CC/CXX to the system toolchain, so our .travis.yml |
| 7 # exports USE_{CC,CXX} for this script to use. | 7 # exports USE_{CC,CXX} for this script to use. |
| 8 if [ -n "$USE_CC" ]; then | 8 if [ -n "$USE_CC" ]; then |
| 9 export CC=$USE_CC | 9 export CC=$USE_CC |
| 10 fi | 10 fi |
| 11 if [ -n "$USE_CXX" ]; then | 11 if [ -n "$USE_CXX" ]; then |
| 12 export CXX=$USE_CXX | 12 export CXX=$USE_CXX |
| 13 fi | 13 fi |
| 14 # Use -jN for faster builds. Travis build machines under Docker | 14 # Use -jN for faster builds. Travis build machines under Docker |
| 15 # have a lot of cores, but are memory-limited, so the kernel | 15 # have a lot of cores, but are memory-limited, so the kernel |
| 16 # will OOM if we try to use them all, so use at most 4. | 16 # will OOM if we try to use them all, so use at most 4. |
| 17 # See https://github.com/travis-ci/travis-ci/issues/1972 | 17 # See https://github.com/travis-ci/travis-ci/issues/1972 |
| 18 export NCPUS=$(getconf _NPROCESSORS_ONLN) | 18 export NCPUS=$(getconf _NPROCESSORS_ONLN) |
| 19 export JOBS=$(( $NCPUS < 4 ? $NCPUS : 4 )) | 19 export JOBS=$(( $NCPUS < 4 ? $NCPUS : 4 )) |
| 20 } | 20 } |
| 21 | 21 |
| 22 # We have to do this by hand rather than use the coverity addon because of |
| 23 # matrix explosion: https://github.com/travis-ci/travis-ci/issues/1975 |
| 24 coverity_scan() { |
| 25 if [ "${TRAVIS_JOB_NUMBER##*.}" != "1" ] || \ |
| 26 [ -n "${TRAVIS_TAG}" ] || \ |
| 27 [ "${TRAVIS_PULL_REQUEST}" = "true" ] |
| 28 then |
| 29 echo "Skipping coverity scan." |
| 30 return |
| 31 fi |
| 32 |
| 33 export COVERITY_SCAN_PROJECT_NAME="${TRAVIS_REPO_SLUG}" |
| 34 export COVERITY_SCAN_NOTIFICATION_EMAIL="google-breakpad-dev@googlegroups.com" |
| 35 export COVERITY_SCAN_BUILD_COMMAND="build" |
| 36 export COVERITY_SCAN_BUILD_COMMAND_PREPEND="git clean -q -x -d -f; git checkou
t -f" |
| 37 export COVERITY_SCAN_BRANCH_PATTERN="master" |
| 38 |
| 39 curl -s "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" |
bash || : |
| 40 } |
| 41 |
| 22 # Do an in-tree build and make sure tests pass. | 42 # Do an in-tree build and make sure tests pass. |
| 23 build() { | 43 build() { |
| 24 ./configure | 44 ./configure |
| 25 make -j${JOBS} check VERBOSE=1 | 45 make -j${JOBS} check VERBOSE=1 |
| 26 make distclean | 46 make distclean |
| 27 } | 47 } |
| 28 | 48 |
| 29 # Do an out-of-tree build and make sure we can create a release tarball. | 49 # Do an out-of-tree build and make sure we can create a release tarball. |
| 30 build_out_of_tree() { | 50 build_out_of_tree() { |
| 31 mkdir -p build/native | 51 mkdir -p build/native |
| 32 cd build/native | 52 cd build/native |
| 33 ../../configure | 53 ../../configure |
| 34 make -j${JOBS} distcheck VERBOSE=1 | 54 make -j${JOBS} distcheck VERBOSE=1 |
| 35 } | 55 } |
| 36 | 56 |
| 37 main() { | 57 main() { |
| 38 setup_env | 58 setup_env |
| 39 build | 59 build |
| 40 build_out_of_tree | 60 build_out_of_tree |
| 61 |
| 62 # Do scans last as they like to dirty the tree and some tests |
| 63 # expect a clean tree (like code style checks). |
| 64 coverity_scan |
| 41 } | 65 } |
| 42 | 66 |
| 43 main "$@" | 67 main "$@" |
| OLD | NEW |