forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
171 lines (151 loc) · 6.2 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
sudo: false
language: cpp
addons: &addons
apt:
packages: timeout
sources: &sources
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
cache:
apt: true
ccache: true
# directories:
# - $BUILD_DEPS
# Do not build our sync branch.
branches:
only:
- master
- Travis*
# Without the top-level env, no job will be allowed to fail.
env:
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
- env:
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
env: TOOL=clang-format
addons:
apt:
sources: *sources
packages: ['clang-format-3.9']
compiler: clang
- os: linux
env: TOOL=clang-tidy-analyzer
addons:
apt:
sources: *sources
packages: ['clang-3.9', 'clang-tidy-3.9', 'libstdc++-6-dev']
compiler: clang
- os: linux
env: TOOL=clang-tidy-modernize
addons:
apt:
sources: *sources
packages: ['clang-3.9', 'clang-tidy-3.9', 'libstdc++-6-dev']
compiler: clang
allow_failures:
# clang-tidy-modernize is still experimental
- env: TOOL=clang-tidy-modernize
# a lot of code doesn't follow clang-format yet
- env: TOOL=clang-format
install:
- |
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 -
fi
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 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
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
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
on_failure:
-|
echo "Showing current directory contents"
ls -la