forked from mlinderm/deca
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jenkins-test
executable file
·91 lines (74 loc) · 2.47 KB
/
jenkins-test
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
#!/usr/bin/env bash
set -e -x -v
# make a tempdir for writing maven cruft to
DECA_MVN_TMP_DIR=$(mktemp -d -t decaTestMvnXXXXXXX)
# add this tempdir to the poms...
find . -name pom.xml \
-exec sed -i.bak \
-e "s:sun.io.serialization.extendedDebugInfo=true:sun.io.serialization.extendedDebugInfo=true -Djava.io.tmpdir=${DECA_MVN_TMP_DIR}:g" \
{} \;
find . -name "*.bak" -exec rm -f {} \;
# variable declarations
export PATH=${JAVA_HOME}/bin/:${PATH}
export MAVEN_OPTS="-Xmx1536m -XX:MaxPermSize=1g -Dfile.encoding=utf-8"
DIR=$( cd $( dirname ${BASH_SOURCE[0]} ) && pwd )
PROJECT_ROOT=${DIR}/..
VERSION=$(grep "<version>" ${PROJECT_ROOT}/pom.xml | head -2 | tail -1 | sed 's/ *<version>//g' | sed 's/<\/version>//g')
# is the hadoop version set?
if ! [[ ${HADOOP_VERSION} ]];
then
echo "HADOOP_VERSION environment variable is not set."
echo "Please set this variable before running."
exit 1
fi
# is the spark version set?
if ! [[ ${SPARK_VERSION} ]];
then
echo "SPARK_VERSION environment variable is not set."
echo "Please set this variable before running."
exit 1
fi
# print versions
echo "Testing DECA version ${VERSION} on Spark ${SPARK_VERSION} and Hadoop ${HADOOP_VERSION}"
# first, build the sources, run the unit tests, and generate a coverage report
mvn clean \
-Dhadoop.version=${HADOOP_VERSION} \
-Dspark.version=${SPARK_VERSION}
# make sure we can build the native code
mvn -U \
-P native-lgpl \
package \
-DskipTests \
-Dhadoop.version=${HADOOP_VERSION} \
-Dspark.version=${SPARK_VERSION} \
-DargLine=${DECA_MVN_TMP_DIR}
# if those pass, build the distribution package and the integration tests
mvn -U \
clean \
test \
-P coverage scoverage:report
# if those pass, build the distribution package
mvn -U \
-P distribution \
package \
-DskipTests \
-Dhadoop.version=${HADOOP_VERSION} \
-Dspark.version=${SPARK_VERSION} \
-DargLine=${DECA_MVN_TMP_DIR}
# we are done with maven, so clean up the maven temp dir
find ${DECA_MVN_TMP_DIR}
rm -rf ${DECA_MVN_TMP_DIR}
find . -name pom.xml \
-exec sed -i.bak \
-e "s:sun.io.serialization.extendedDebugInfo=true -Djava.io.tmpdir=${DECA_MVN_TMP_DIR}:sun.io.serialization.extendedDebugInfo=true:g" \
{} \;
find . -name "*.bak" -exec rm -f {} \;
./scripts/format-source
if test -n "$(git status --porcelain | grep -v -e html -e pdf)"
then
echo "Please run './scripts/format-source'"
exit 1
fi
echo
echo "All the tests passed"
echo