-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
145 lines (129 loc) · 3.43 KB
/
build.sh
File metadata and controls
145 lines (129 loc) · 3.43 KB
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
#!/bin/bash
MVN_OPTS="-Duser.home=/var/maven"
if [ ! -e node_modules ]
then
mkdir node_modules
fi
case `uname -s` in
MINGW*)
USER_UID=1000
GROUP_UID=1000
;;
*)
if [ -z ${USER_UID:+x} ]
then
USER_UID=`id -u`
GROUP_GID=`id -g`
fi
esac
init() {
me=`id -u`:`id -g`
echo "DEFAULT_DOCKER_USER=$me" > .env
}
clean () {
docker-compose run --rm maven mvn $MVN_OPT clean
}
buildNode () {
case `uname -s` in
MINGW*)
docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn install --production=false --no-bin-links && node_modules/gulp/bin/gulp.js build && yarn run build:sass"
;;
*)
docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn install --production=false && node_modules/gulp/bin/gulp.js build && yarn run build:sass"
esac
}
buildGulp() {
docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "node_modules/gulp/bin/gulp.js build"
}
buildCss() {
docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn run build:sass"
}
install () {
docker compose run --rm maven mvn $MVN_OPTS install -DskipTests
}
testNode () {
rm -rf coverage
rm -rf */build
case `uname -s` in
MINGW*)
docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn install --no-bin-links && node_modules/gulp/bin/gulp.js drop-cache && yarn test"
;;
*)
docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn install && node_modules/gulp/bin/gulp.js drop-cache && yarn test"
esac
}
testNodeDev () {
rm -rf coverage
rm -rf */build
case `uname -s` in
MINGW*)
docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn install --no-bin-links && node_modules/gulp/bin/gulp.js drop-cache && yarn run test:dev"
;;
*)
docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn install && node_modules/gulp/bin/gulp.js drop-cache && yarn run test:dev"
esac
}
test () {
docker compose run --rm maven mvn $MVN_OPTS test
}
publish() {
version=`docker compose run --rm maven mvn $MVN_OPTS help:evaluate -Dexpression=project.version -q -DforceStdout`
level=`echo $version | cut -d'-' -f3`
case "$level" in
*SNAPSHOT) export nexusRepository='snapshots' ;;
*) export nexusRepository='releases' ;;
esac
docker compose run --rm maven mvn -DrepositoryId=ode-$nexusRepository -DskipTests -Dmaven.test.skip=true --settings /var/maven/.m2/settings.xml deploy
}
publishNexus() {
version=`docker compose run --rm maven mvn $MVN_OPTS help:evaluate -Dexpression=project.version -q -DforceStdout`
level=`echo $version | cut -d'-' -f3`
case "$level" in
*SNAPSHOT) export nexusRepository='snapshots' ;;
*) export nexusRepository='releases' ;;
esac
docker compose run --rm maven mvn -DrepositoryId=ode-$nexusRepository -Durl=$repo -DskipTests -Dmaven.test.skip=true --settings /var/maven/.m2/settings.xml deploy
}
for param in "$@"
do
case $param in
init)
init
;;
clean)
clean
;;
buildNode)
buildNode
;;
buildGulp)
buildGulp
;;
buildCss)
buildCss
;;
install)
buildNode && install
;;
publish)
publish
;;
publishNexus)
publishNexus
;;
test)
test
;;
testNode)
testNode
;;
testNodeDev)
testNodeDev
;;
*)
echo "Invalid argument : $param"
esac
if [ ! $? -eq 0 ]; then
exit 1
fi
done