-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.sh
executable file
·62 lines (49 loc) · 1.42 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
#!/bin/bash
#
# Please check pnda-build/ for the build products
VERSION=${1}
function error {
echo "Not Found"
echo "Please run the build dependency installer script"
exit -1
}
function code_quality_error {
echo "${1}"
}
echo -n "Apache Maven 3.0.5: "
if [[ $(mvn -version 2>&1) == *"Apache Maven 3.0.5"* ]]; then
echo "OK"
else
error
fi
function check_pylint {
PYLINTOUT=$(find . -type f -name '*.py' | grep -vi __init__ | xargs pylint)
SCORE=$(echo ${PYLINTOUT} | grep -Po '(?<=rated at ).*?(?=/10)')
echo ${SCORE}
if [[ $(bc <<< "${SCORE} > 9") == 0 ]]; then
code_quality_error "${PYLINTOUT}"
fi
}
BASE=${PWD}
echo -n "Code quality (data-service) : "
cd ${BASE}/data-service/src/main/resources
check_pylint
nosetests tests/*.py
[[ $? -ne 0 ]] && exit -1
echo -n "Code quality (hdfs-cleaner) : "
cd ${BASE}/hdfs-cleaner/src/main/resources
check_pylint
cd ${BASE}
mkdir -p pnda-build
cd data-service
mvn versions:set -DnewVersion=${VERSION}
mvn clean package
cd ..
mv data-service/target/data-service-${VERSION}.tar.gz pnda-build/
sha512sum pnda-build/data-service-${VERSION}.tar.gz > pnda-build/data-service-$VERSION.tar.gz.sha512.txt
cd hdfs-cleaner
mvn versions:set -DnewVersion=${VERSION}
mvn clean package
cd ..
mv hdfs-cleaner/target/hdfs-cleaner-${VERSION}.tar.gz pnda-build/
sha512sum pnda-build/hdfs-cleaner-${VERSION}.tar.gz > pnda-build/hdfs-cleaner-${VERSION}.tar.gz.sha512.txt