forked from uf-mil/ros_alarms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
45 lines (45 loc) · 1.35 KB
/
Jenkinsfile
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
dockerNode(image: 'uf-mil:ros_alarms') {
stage("Checkout") {
checkout scm
sh '''
git submodule update --init --recursive
ln -s $PWD ~/catkin_ws/src/ros_alarms
git clone --recursive https://github.com/txros/txros ~/catkin_ws/src/txros
'''
}
stage("Build") {
sh '''
source /opt/ros/kinetic/setup.bash > /dev/null 2>&1
catkin_make -C ~/catkin_ws -B
'''
}
stage("Test") {
sh '''
source /opt/ros/kinetic/setup.bash > /dev/null 2>&1
source ~/catkin_ws/devel/setup.bash > /dev/null 2>&1
catkin_make -C ~/catkin_ws run_tests
catkin_test_results ~/catkin_ws/build/test_results --verbose
'''
}
stage("Format") {
sh '''
if [[ ! -z "$(python2.7 -m flake8 --max-line-length=120 --exclude=__init__.py .)" ]]; then
echo "The preceding Python following files are not formatted correctly"
exit 1
fi
'''
sh '''
source /opt/ros/kinetic/setup.bash > /dev/null 2>&1
wget -O ~/.clang-format https://raw.githubusercontent.com/uf-mil/installer/master/.clang-format
for FILE in $(find -regex ".*/.*\\.\\(c\\|cc\\|cpp\\|h\\|hpp\\)$"); do
if [ ! -z "$(clang-format-3.8 -style=file -output-replacements-xml $FILE | grep '<replacement ')" ]; then
FILES+=( "$FILE" )
fi
done
if (( ${#FILES[@]} > 0 )); then
echo "The C++ following files are not formatted correctly: ${FILES[@]}"
exit 1
fi
'''
}
}