forked from alibaba/COLA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
integration-test.sh
executable file
·104 lines (81 loc) · 3.06 KB
/
integration-test.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
#!/bin/bash
# NOTE about Bash Traps and Pitfalls:
#
# 1. DO NOT declare var as readonly if value is supplied by subshell!!
# for example: readonly var1=$(echo value1)
#
# readonly declaration make exit code of assignment to be always 0,
# aka. the exit code of command in subshell is discarded.
# tested on bash 3.2.57/4.2.46
set -eEuo pipefail
# shellcheck source=common.sh
source "$(dirname "$(readlink -f "$0")")/common.sh"
# shellcheck source=common_build.sh
source "$(dirname "$(readlink -f "$0")")/common_build.sh"
# adjust current dir to project root dir
cd "$(dirname "$(readlink -f "$0")")/.."
################################################################################
# CI operations
################################################################################
cleanMavenInstallOfColaInMavenLocalRepository
(
headInfo "CI: cola-components"
cd cola-components/
MVN clean install
)
(
headInfo "CI: cola-archetypes"
cd cola-archetypes/
MVN clean install
)
(
headInfo "CI: archetype:generate by cola-framework-archetype-service"
# NOTE: DO NOT declare archetypeVersion var as readonly, its value is supplied by subshell.
archetypeVersion=$(extractFirstElementValueFromPom version cola-archetypes/cola-archetype-service/pom.xml)
# shellcheck disable=SC2030
readonly demo_dir="cola-archetypes/target/cola-framework-archetype-service-demo"
mkdir -p "$demo_dir"
cd "$demo_dir"
# shellcheck disable=SC2030
readonly artifactId=demo-service
MVN archetype:generate \
-DgroupId=com.alibaba.cola.demo.archetype-service \
-DartifactId="$artifactId" \
-Dversion=1.0.0-SNAPSHOT \
-Dpackage=com.alibaba.cola.demo.service \
-DarchetypeGroupId=com.alibaba.cola \
-DarchetypeArtifactId=cola-framework-archetype-service \
-DarchetypeVersion="$archetypeVersion" \
-DinteractiveMode=false \
-DarchetypeCatalog=local
cd "$artifactId"
MVN_WITH_BASIC_OPTIONS install
)
(
headInfo "CI: archetype:generate by cola-framework-archetype-web"
# NOTE: DO NOT declare archetypeVersion var as readonly, its value is supplied by subshell.
archetypeVersion=$(extractFirstElementValueFromPom version cola-archetypes/cola-archetype-web/pom.xml)
# shellcheck disable=SC2031
readonly demo_dir="cola-archetypes/target/cola-framework-archetype-web-demo"
mkdir -p "$demo_dir"
cd "$demo_dir"
# shellcheck disable=SC2031
readonly artifactId=demo-web
MVN archetype:generate \
-DgroupId=com.alibaba.cola.demo.archetype-web \
-DartifactId="$artifactId" \
-Dversion=1.0.0-SNAPSHOT \
-Dpackage=com.alibaba.cola.demo.web \
-DarchetypeGroupId=com.alibaba.cola \
-DarchetypeArtifactId=cola-framework-archetype-web \
-DarchetypeVersion="$archetypeVersion" \
-DinteractiveMode=false \
-DarchetypeCatalog=local
cd "$artifactId"
MVN_WITH_BASIC_OPTIONS install
)
(
headInfo "CI: samples/craftsman"
cd samples/craftsman/
MVN_WITH_BASIC_OPTIONS clean install
)