Newer
Older
Vassil Vassilev
committed
sudo: false
language: cpp
addons: &addons
apt:
packages: timeout
sources: &sources
Vassil Vassilev
committed
cache:
apt: true
ccache: true
Vassil Vassilev
committed
# Do not build our sync branch.
branches:
only:
- master
matrix:
# Abort all builds on a single failing matrix entry.
fast_finish: true
exclude:
# Note: Workaround travis-ci/travis-ci#4681
# Exclude default job which lacks our included environment variables.
- os: linux
Vassil Vassilev
committed
include:
# There seems to be a hard limit to how many machines a Travis build will
# across all platforms. By interleaving OS X, the hope is to get in the
# queue faster while not blocking Linux builds from occuring.
- os: linux
Vassil Vassilev
committed
addons:
apt:
sources: *sources
packages: ['clang-format-3.9']
Vassil Vassilev
committed
compiler: clang
- os: linux
env: TOOL=clang-tidy
addons:
apt:
sources: *sources
packages: ['clang-3.9', 'clang-tidy-3.9', 'libstdc++-6-dev']
compiler: clang
allow_failures:
# clang-tidy is still experimental
- env: TOOL=clang-tidy
if [[ $TOOL == 'clang-tidy' ]]; then
export BUILD_DEPS="${TRAVIS_BUILD_DIR}/deps"
mkdir ${BUILD_DEPS} && cd ${BUILD_DEPS}
CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.0-Linux-x86_64.tar.gz"
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
export PATH=${BUILD_DEPS}/cmake/bin:${PATH}
# Go to the Root directory
cd -
Vassil Vassilev
committed
script:
- echo "Copying and generating header files." && echo -en "travis_fold:start:install.headers"
- |
# We need to put in place all relevant headers before running clang-tidy.
if [[ $TOOL == 'clang-tidy' ]]; then
mkdir ../build
cd ../build
export CC=clang-3.9
export CXX=clang++-3.9
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -Dall=On -Dtesting=On -Dx11=Off ../root
# We need to prebuild a minimal set of targets which are responsible for header copy
# or generation.
make -j4 move_headers intrinsics_gen ClangCommentCommandList ClangCommentCommandInfo \
ClangCommentHTMLNamedCharacterReferences ClangCommentHTMLTagsProperties \
ClangCommentNodes ClangAttrImpl ClangStmtNodes ClangAttrClasses \
ClangAttrDump ClangCommentHTMLTags ClangDeclNodes ClangAttrVisitor \
ClangDiagnosticCommon ClangARMNeon ClangDiagnosticIndexName \
ClangDiagnosticParse ClangDiagnosticComment ClangDiagnosticFrontend \
ClangDiagnosticGroups ClangDiagnosticSerialization ClangDiagnosticLex \
ClangDiagnosticSema ClangAttrList ClangAttrHasAttributeImpl \
ClangDiagnosticAST ClangDiagnosticDriver ClangDiagnosticAnalysis \
ClangDriverOptions ClangAttrParserStringSwitches ClangAttrParsedAttrList \
ClangAttrTemplateInstantiate ClangAttrSpellingListIndex \
ClangAttrParsedAttrImpl ClangAttrParsedAttrKinds
Vassil Vassilev
committed
ln -s $PWD/compile_commands.json $PWD/../root/
fi
- echo -en 'travis_fold:end:install.headers\\r'
Vassil Vassilev
committed
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
if [[ $TOOL == 'clang-format' ]]; then
BASE_COMMIT=$(git rev-parse $TRAVIS_BRANCH)
echo "Running clang-format-3.9 against branch $TRAVIS_BRANCH, with hash $BASE_COMMIT"
COMMIT_FILES=$(git diff --name-only $BASE_COMMIT | grep -i -v LinkDef)
RESULT_OUTPUT="$(git-clang-format-3.9 --commit $BASE_COMMIT --diff --binary `which clang-format-3.9` $COMMIT_FILES)"
Vassil Vassilev
committed
if [ "$RESULT_OUTPUT" == "no modified files to format" ] \
|| [ "$RESULT_OUTPUT" == "clang-format did not modify any files" ] ; then
echo "clang-format passed."
exit 0
else
echo "clang-format failed."
echo "To reproduce it locally please run"
echo -e "\tgit checkout $TRAVIS_BRANCH"
echo -e "\tgit-clang-format --commit $BASE_COMMIT --diff --binary $(which clang-format)"
echo "$RESULT_OUTPUT"
exit 1
fi
elif [[ $TOOL == 'clang-tidy' ]]; then
echo "Running clang-tidy-3.9 only against the changes in branch $TRAVIS_BRANCH."
cd ../root/
# Workaround for travis issue: travis-ci/travis-ci#6069
git remote set-branches --add origin master
git fetch
Vassil Vassilev
committed
RESULT_OUTPUT="$(git diff -U0 origin/master | clang-tidy-diff-3.9.py -p1 -clang-tidy-binary $(which clang-tidy-3.9) -checks=-*,clang-analyzer-*)"
if [[ $? -eq 0 ]]; then
Vassil Vassilev
committed
echo "clang-tidy passed."
exit 0
else
echo "To reproduce it locally please run"
echo -e "\tgit checkout $TRAVIS_BRANCH"
echo -e "Command: git diff -U0 $TRAVIS_BRANCH..origin/master | clang-tidy-diff.py -p1 -clang-tidy-binary \$(which clang-tidy) -checks=-*,clang-analyzer-*"
echo "$RESULT_OUTPUT"
exit 1
fi
Vassil Vassilev
committed
fi
elif [[ "$TRAVIS_EVENT_TYPE" = "cron" ]] && [[ $TOOL == 'clang-tidy' ]]; then
# We need to ignore our vendor drops.
FILES_REGEX='^.*root\/(?!interpreter\/|core\/clib)'
echo "Running clang-tidy-3.9 against branch $TRAVIS_BRANCH."
echo "run-clang-tidy-3.9.py -j4 -clang-tidy-binary $(which clang-tidy-3.9) -checks=-*,clang-analyzer-* $FILES_REGEX"
run-clang-tidy-3.9.py -j4 -clang-tidy-binary $(which clang-tidy-3.9) -checks=-*,clang-analyzer-* $FILES_REGEX
Vassil Vassilev
committed
fi
on_failure:
-|
echo "Showing current directory contents"
ls -la