-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtravis.sh
More file actions
52 lines (45 loc) · 1.38 KB
/
travis.sh
File metadata and controls
52 lines (45 loc) · 1.38 KB
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
#!/bin/bash
# Copyright (C) 2018 Swift Navigation Inc.
# Contact: Swift Navigation <dev@swiftnav.com>
# 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
make clang-format-all && check_format_errors
make clang-tidy-all && check_tidy_errors
cd ../
}
if [ "$TESTENV" == "lint" ]; then
./travis-clang-format-check.sh
else
build
fi