-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.sh
executable file
·48 lines (37 loc) · 1022 Bytes
/
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
#!/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
BASE=${PWD}
echo -n "Code quality: "
cd ${BASE}/api/src/main/resources
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
nosetests tests/test_*.py
[[ $? -ne 0 ]] && exit -1
cd ${BASE}
mkdir -p pnda-build
cd api
mvn versions:set -DnewVersion=${VERSION}
mvn clean package
cd ..
mv api/target/package-repository-${VERSION}.tar.gz pnda-build/
sha512sum pnda-build/package-repository-${VERSION}.tar.gz > pnda-build/package-repository-${VERSION}.tar.gz.sha512.txt