-
Notifications
You must be signed in to change notification settings - Fork 95
/
.ci_script.sh
executable file
·148 lines (133 loc) · 3.3 KB
/
.ci_script.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash
set -ex
#Default flags
COVERAGE=0
UNIT=0
INTEGRATED=0
MMS=0
TESTS=0
MAIN_TARGET=
UPDATE_SCRIPT=0
CONFIGURE_SHELL=
usage() {
echo "$0 options are: "
#Just pull out special comments from this file
grep "\#\#\#" $0
exit 1
}
#Handle input flags
while getopts "cuimt:5s:" arg;
do
case $arg in
c) ### Run the coverage-post job tasks
COVERAGE=1
;;
u) ### Run the unit tests
UNIT=1
TESTS=1
;;
i) ### Run the integrated tests
INTEGRATED=1
TESTS=1
;;
m) ### Run the mms tests
MMS=1
TESTS=1
;;
t) ### Set target to build
MAIN_TARGET="$MAIN_TARGET $OPTARG"
;;
5) ### Run the update to version 5 script
UPDATE_SCRIPT=1
;;
s) ### Use specific shell to configure
CONFIGURE_SHELL="$OPTARG"
;;
*) ### Show usage message
usage
;;
esac
done
./.build_sundials_for_ci.sh
if test $UPDATE_SCRIPT -gt 0
then
# Make sure the header list is up to date
if ! diff bin/bout_4to5_header_file_list <(cd include/;ls *xx|grep -v ^bout.hxx|sort)
then
echo "Some header files changed."
echo "Please update the list by running:"
echo "(cd include/;ls *xx|grep -v ^bout.hxx|sort) > bin/bout_4to5_header_file_list"
echo "And commit the updated file."
exit 1
fi
bin/bout_4to5 -f
fi
export MAKEFLAGS="-j 2 -k"
echo "****************************************"
echo "Configuring with $CONFIGURE_OPTIONS"
echo "****************************************"
conf=0
time $CONFIGURE_SHELL ./configure $CONFIGURE_OPTIONS MAKEFLAGS="$MAKEFLAGS" || conf=$?
if test $conf -gt 0
then
RED_FG="\033[031m"
RESET_FG="\033[039m"
echo -e $RED_FG
echo "**************************************************"
echo "Printing config.log:"
echo "**************************************************"
echo -e $RESET_FG
echo
cat config.log
echo
echo -e $RED_FG
echo "**************************************************"
echo "Printing config-build.log:"
echo "**************************************************"
echo -e $RESET_FG
echo
cat config-build.log
exit $conf
fi
export PYTHONPATH=$(pwd)/tools/pylib/:$PYTHONPATH
for target in ${MAIN_TARGET[@]}
do
make_exit=0
echo "make $target"
time make $target || make_exit=$?
if [[ $make_exit -gt 0 ]]; then
make clean > /dev/null
echo -e $RED_FG
echo "**************************************************"
echo "Printing make commands:"
echo "**************************************************"
echo -e $RESET_FG
echo
make -n $target
exit $make_exit
fi
done
if [[ ${UNIT} == 1 ]]
then
time make check-unit-tests
fi
if [[ ${INTEGRATED} == 1 ]]
then
time make check-integrated-tests
fi
if [[ ${MMS} == 1 ]]
then
time make check-mms-tests
fi
if [[ ${COVERAGE} == 1 ]]
then
# Ensure that there is a corresponding .gcda file for every .gcno file
# This is to try and make the coverage report slightly more accurate
# It still won't include, e.g. any solvers we don't build with though
find . -name "*.gcno" -exec sh -c 'touch -a "${1%.gcno}.gcda"' _ {} \;
# Use lcov to generate a report, upload it to codecov.io
make code-coverage-capture
bash <(curl -s https://codecov.io/bash) -f bout-coverage.info
#For codacy
bash ./.codacy_coverage.sh
fi