forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
86 lines (84 loc) · 3.16 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
sudo: false
matrix:
fast_finish: true
# Note: Workaround travis-ci/travis-ci#4681
# Exclude default job which lacks our included environment variables.
exclude:
- os: linux
- env:
include:
- os: linux
dist: xenial
env: TOOL=clang-format
addons:
apt:
sources:
- llvm-toolchain-xenial-8
packages:
- clang-format-8
compiler: clang
- os: linux
env: TOOL=doxygen
addons:
apt:
packages:
- doxygen
- doxygen-doc
- doxygen-latex
- doxygen-gui
- graphviz
- cmake
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_API_TOKEN # Set in travis-ci.org dashboard
local_dir: doc/html
on:
branch: dev
script: |
if [[ $TOOL == "doxygen" ]]; then
cat > CMakeLists.txt <<\EOF
add_subdirectory(doc)
EOF
# This is required because of differences between doxygen and github
# markdown syntax for code blocks. The committed code should use
# the github flavour and we generate the doxygen one on the fly.
git grep -l '^```[a-zA-Z]' | xargs sed -i .old -e 's|```\([a-zA-Z][a-zA-Z]*\)|\n```{.\1}\n|g;s|[.]bash|.sh|g;s|```|~~~~~~~|g'
find . -name "*.old" -delete
cmake .
make doc
elif [[ $TOOL == "clang-format" ]]; then
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
BASE_COMMIT=$(git rev-parse $TRAVIS_BRANCH)
echo "Running clang-format-8 against branch $TRAVIS_BRANCH, with hash $BASE_COMMIT"
COMMIT_FILES=$(git diff --name-only $BASE_COMMIT | grep -ivE 'LinkDef|Utilities/PCG/')
RESULT_OUTPUT="$(git-clang-format-8 --commit $BASE_COMMIT --diff --binary `which clang-format-8` $COMMIT_FILES)"
for x in $COMMIT_FILES; do
case $x in
*.h|*.cxx)
# We remove the header from the diff as it contains +++ then
# we only select the added lines to check for the long ones.
# We do not need to check for the lines which have been removed
# and we do not want to check for the lines which were not changed
# to avoid extra work.
# 120 characters are allowed, meaning the error should start with 122,
# to allow for the starting + at the end of the line.
git diff $x | tail -n +5 | grep -e '^+' | grep '.\{122,\}' && { echo "Line longer than 120 chars in $x." && exit 1; } || true ;;
*.hxx|*.cc|*.hpp) echo "$x uses non-allowed extension." && exit 1 ;;
*) ;;
esac
done
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
fi
fi