diff --git a/.travis.yml b/.travis.yml index ae7674a07eb34..f2f0d293c4ac6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,8 @@ addons: &addons cache: apt: true ccache: true -# directories: -# - $BUILD_DEPS + directories: + - $BUILD_DEPS # Do not build our sync branch. @@ -81,93 +81,95 @@ install: fi script: -- cmake .. -- 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 googletest - ln -s $PWD/compile_commands.json $PWD/../root/ - fi -- echo -en 'travis_fold:end:install.headers\\r' - -- | - 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)" - - 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 - CLANG_TIDY_CHECKS='-*' - if [[ $TOOL == clang-tidy-analyzer ]]; then - CLANG_TIDY_CHECKS+='clang-analyzer-*,-clang-analyzer-alpha*' - elif [[ $TOOL == clang-tidy-modernize ]]; then - CLANG_TIDY_CHECKS+='modernize*' - fi + - cmake .. + - ninja test + - ninja build + - ninja install + - 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 googletest + ln -s $PWD/compile_commands.json $PWD/../root/ + fi + - echo -en 'travis_fold:end:install.headers\\r' - 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 - RESULT_OUTPUT="$(git diff -U0 origin/master | clang-tidy-diff-3.9.py -p1 -clang-tidy-binary $(which clang-tidy-3.9) \ - -checks=$CLANG_TIDY_CHECKS)" - if [[ $? -eq 0 ]]; then - echo "$TOOL 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_TIDY_CHECKS" - echo "$RESULT_OUTPUT" - exit 1 + - | + 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)" + + 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 + CLANG_TIDY_CHECKS='-*' + if [[ $TOOL == clang-tidy-analyzer ]]; then + CLANG_TIDY_CHECKS+='clang-analyzer-*,-clang-analyzer-alpha*' + elif [[ $TOOL == clang-tidy-modernize ]]; then + CLANG_TIDY_CHECKS+='modernize*' + fi + + 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 + RESULT_OUTPUT="$(git diff -U0 origin/master | clang-tidy-diff-3.9.py -p1 -clang-tidy-binary $(which clang-tidy-3.9) \ + -checks=$CLANG_TIDY_CHECKS)" + if [[ $? -eq 0 ]]; then + echo "$TOOL 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_TIDY_CHECKS" + echo "$RESULT_OUTPUT" + exit 1 + fi fi - fi - elif [[ "$TRAVIS_EVENT_TYPE" = "cron" ]] && [[ $TOOL == 'clang-tidy' ]]; then - # We need to ignore our vendor drops. - FILES_REGEX='^.*root\/(?!interpreter\/|core\/clib)' + 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 - fi + 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 + fi on_failure: -| echo "Showing current directory contents" ls -la -