-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·83 lines (75 loc) · 2.3 KB
/
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright (c) 2014 "Kaazing Corporation," (www.kaazing.com)
#
# This file is part of Robot.
#
# Robot is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#!/bin/bash
echo "Checking if Vagrant and VirtualBox are installed..."
# Check if vagrant command works to see if Vagrant is installed
vagrant -v &> /dev/null
vagrant=$?
if [ $vagrant -eq 0 ]
then
echo $(vagrant -v)
else
echo "Vagrant is not installed"
fi
# Check if vboxmanage command works to see if VirtualBox is installed
vboxmanage -v &> /dev/null
virtualbox=$?
if [ $virtualbox -eq 0 ]
then
echo "VirtualBox "$(vboxmanage -v)
else
echo "VirtualBox is not installed"
fi
if [ $vagrant -eq 0 ]
then if [ $virtualbox -eq 0 ]
then
echo "Both are installed"
# Prepare vagrant environment and execute script over SSH
vagrant up
echo "Starting tests..."
vagrant ssh -c "sh /vagrant/wrap_run_tests.sh"
vagrant destroy -f
# Show test results
echo "=====TEST RESULTS====="
cat ./build/test_results.txt
echo "Tests complete..."
# Fail build with error status 1 if tests failed (hard fail or timeout)
if grep --quiet FAILED ./build/test_results.txt
then echo "Tests failed...Failing Build"
exit 1
else
if grep --quiet PASSED ./build/test_results.txt
then
echo Tests Passed
else
echo "Tests failed due to timeout. Consider re-running with a higher timeout in example_tests.cpp"
echo "Tests failed...Failing Build"
exit 1
fi
fi
else
echo "[WARNING]Tests cannot be run in this environment...nothing will be built"
echo "Build Failed"
exit 1
fi
else
echo "[WARNING]Tests cannot be run in this environment...nothing will be built"
echo "Build Failed"
exit 1
fi
echo "BUILD SUCCESS"
exit 0