forked from Netflix-Skunkworks/atlas-system-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-build.sh
executable file
·56 lines (45 loc) · 1.33 KB
/
run-build.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
52
53
54
55
#!/bin/bash
set -e
RED='\033[0;31m' # Red
BB='\033[0;34m' # Blue
NC='\033[0m' # No Color
BG='\033[0;32m' # Green
error() { >&2 echo -e "${RED}$1${NC}"; }
showinfo() { echo -e "${BG}$1${NC}"; }
workingprocess() { echo -e "${BB}$1${NC}"; }
alert () { echo -e "${RED}$1${NC}"; }
# Fetch and build libatlasclient
rm -rf nc
mkdir nc
cd nc
git init
git remote add origin https://github.com/Netflix-Skunkworks/atlas-native-client.git
git fetch origin $NATIVE_CLIENT_VERSION
git reset --hard FETCH_HEAD
mkdir build root
cd build
cmake -DCMAKE_INSTALL_PREFIX=/ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5 ..
make -j4
make install DESTDIR=../root
cd ../..
# Building project
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo $TITUS_AGENT -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5 ..
make -j4
# Checks if last comand didn't output 0
# $? checks what last command outputed
# If output is 0 then command is succesfuly executed
# If command fails it outputs number between 0 to 255
if [ $? -ne 0 ]; then
error "Error: there are compile errors!"
# Terminate script and outputs 3
exit 3
fi
showinfo "Running tests ..."
./runtests
if [ $? -ne 0 ]; then
error "Error: there are failed tests!"
exit 4
fi
workingprocess "All tests compile and pass."