forked from elfchief/libswiftnav
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis.sh
51 lines (44 loc) · 1.42 KB
/
travis.sh
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
#!/bin/bash
# Copyright (C) 2018 Swift Navigation Inc.
# Contact: Swift Navigation <[email protected]>
# Run Travis setup
set -ex
set -o errexit
set -o pipefail
#************************************************************************
# UTILITY FUNCTIONS
#************************************************************************
check_format_errors() {
if [[ $(git --no-pager diff --name-only HEAD) ]]; then
echo "######################################################"
echo "####### clang-format warning found! Exiting... #######"
echo "######################################################"
echo ""
echo "This should be formatted locally and pushed again..."
git --no-pager diff
travis_terminate 1
fi
}
check_tidy_errors() {
if [ -e ../fixes.yaml ]; then
echo "####################################################"
echo "####### clang-tidy warning found! Exiting... #######"
echo "####################################################"
echo ""
echo " ^^ Please see and correct the clang-tidy warnings found above ^^"
travis_terminate 1
fi
}
function build() {
# Create and enter build directory.
mkdir -p build && cd build
cmake ../
make -j4 VERBOSE=1
if [ "$TEST_SUITE" == "lint" ]; then
make clang-format-all && check_format_errors
## keep clang-tidy disabled until the findings are addressed
# make clang-tidy-all && check_tidy_errors
fi
cd ../
}
build