forked from uf-mil/mil_common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
46 lines (46 loc) · 1.41 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
46
dockerNode(image: 'uf-mil:mil_common') {
stage("Checkout") {
checkout scm
sh '''
source ~/.mil/milrc > /dev/null 2>&1
git submodule update --init --recursive
ln -s $PWD $CATKIN_DIR/src/mil_common
ln -s $MIL_CONFIG_DIR/bvtsdk $CATKIN_DIR/src/mil_common/drivers/mil_blueview_driver/bvtsdk
'''
}
stage("Build") {
sh '''
source ~/.mil/milrc > /dev/null 2>&1
catkin_make -C $CATKIN_DIR -B
'''
}
stage("Test") {
sh '''
source ~/.mil/milrc > /dev/null 2>&1
source $CATKIN_DIR/devel/setup.bash > /dev/null 2>&1
catkin_make -C $CATKIN_DIR run_tests
catkin_test_results $CATKIN_DIR/build/test_results --verbose
'''
}
stage("Format") {
sh '''
if [[ ! -z "$(python2.7 -m flake8 --ignore E731 --max-line-length=120 --exclude=__init__.py,drivers/mil_passive_sonar .)" ]]; 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
'''
}
}