Skip to content

Commit e4af655

Browse files
committed
chore(ci): use bash-buddy for ci scripts
1 parent bd20e76 commit e4af655

8 files changed

+81
-299
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "scripts/bash-buddy"]
2+
path = scripts/bash-buddy
3+
url = https://github.com/foldright/bash-buddy.git

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ for:
3333
- image: Ubuntu2004
3434

3535
test_script:
36+
- git submodule update --init --recursive
3637
- sh: ./scripts/integration-test.sh
3738

3839
after_test:

scripts/bash-buddy

Submodule bash-buddy added at bb6ef88

scripts/codecov.sh

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,39 @@
22
set -eEuo pipefail
33
cd "$(dirname "$(readlink -f "$0")")"
44

5-
export DCM_AGENT_SUPRESS_EXCEPTION_STACK=true
5+
source bash-buddy/lib/trap_error_info.sh
6+
source bash-buddy/lib/common_utils.sh
7+
8+
################################################################################
9+
# prepare
10+
################################################################################
11+
12+
# shellcheck disable=SC2034
13+
PREPARE_JDKS_INSTALL_BY_SDKMAN=(
14+
8.322.06.2-amzn
15+
11.0.14-ms
16+
17.0.2.8.1-amzn
17+
)
18+
19+
source bash-buddy/lib/prepare_jdks.sh
620

7-
source ./common_build.sh
8-
source ./prepare_jdk.sh
21+
source bash-buddy/lib/java_build_utils.sh
922

10-
cd "$ROOT_PROJECT_DIR"
23+
################################################################################
24+
# codecov logic
25+
################################################################################
26+
27+
cd ..
28+
29+
export DCM_AGENT_SUPRESS_EXCEPTION_STACK=true
1130

12-
switch_to_jdk 11
13-
MVN_CMD -Pgen-code-cov clean test jacoco:report
31+
prepare_jdks::switch_java_home_to_jdk 11
32+
jvb::mvn_cmd -Pgen-code-cov clean test jacoco:report
1433

15-
switch_to_jdk 8
34+
prepare_jdks::switch_java_home_to_jdk 8
1635
# use -Dmaven.main.skip option fix below problem of jacoco-maven-plugin:report :
1736
#
1837
# [WARNING] Classes in bundle 'Java Dns Cache Manipulator(DCM) Lib' do not match with execution data.
1938
# For report generation the same class files must be used as at runtime.
2039
# [WARNING] Execution data for class com/alibaba/xxx/Yyy does not match.
21-
MVN_CMD -Pgen-code-cov -Dmaven.main.skip test jacoco:report coveralls:report
40+
jvb::mvn_cmd -Pgen-code-cov -Dmaven.main.skip test jacoco:report coveralls:report

scripts/common.sh

Lines changed: 0 additions & 122 deletions
This file was deleted.

scripts/common_build.sh

Lines changed: 0 additions & 64 deletions
This file was deleted.

scripts/integration-test.sh

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,67 @@
22
set -eEuo pipefail
33
cd "$(dirname "$(readlink -f "$0")")"
44

5-
export CI_TEST_MODE=true
6-
export DCM_AGENT_SUPRESS_EXCEPTION_STACK=true
5+
source bash-buddy/lib/trap_error_info.sh
6+
source bash-buddy/lib/common_utils.sh
77

8-
source ./prepare_jdk.sh
9-
source ./common_build.sh
8+
################################################################################
9+
# prepare
10+
################################################################################
1011

11-
# default jdk 11, do build and test
12-
switch_to_jdk 11
12+
# shellcheck disable=SC2034
13+
PREPARE_JDKS_INSTALL_BY_SDKMAN=(
14+
8.322.06.2-amzn
15+
11.0.14-ms
16+
17.0.2.8.1-amzn
17+
)
18+
19+
source bash-buddy/lib/prepare_jdks.sh
1320

14-
if [ "${1:-}" != "skipClean" ]; then
15-
MVN_CMD clean
16-
fi
21+
source bash-buddy/lib/java_build_utils.sh
1722

1823
# here use `install` and `-D performRelease` intended
1924
# to check release operations.
2025
#
2126
# De-activate a maven profile from command line
2227
# https://stackoverflow.com/questions/25201430
23-
headInfo "test with Java: $JAVA_HOME"
24-
MVN_CMD -DperformRelease -P '!gen-sign' install
28+
#
29+
# shellcheck disable=SC2034
30+
JVB_MVN_OPTS=(
31+
"${JVB_DEFAULT_MVN_OPTS[@]}"
32+
-DperformRelease -P'!gen-sign'
33+
)
34+
35+
################################################################################
36+
# ci build logic
37+
################################################################################
38+
39+
cd ..
40+
41+
########################################
42+
# default jdk 11, do build and test
43+
########################################
44+
45+
export CI_TEST_MODE=true
46+
export DCM_AGENT_SUPRESS_EXCEPTION_STACK=true
47+
48+
default_build_jdk_version=11
49+
50+
prepare_jdks::switch_java_home_to_jdk "$default_build_jdk_version"
51+
52+
cu::head_line_echo "build and test with Java: $JAVA_HOME"
53+
jvb::mvn_cmd clean install
2554

26-
# test multi-version java home env
55+
########################################
56+
# test multi-version java
2757
# shellcheck disable=SC2154
28-
for jhome in "${java_home_var_names[@]}"; do
58+
########################################
59+
for jhome_var_name in "${JDK_HOME_VAR_NAMES[@]}"; do
2960
# already tested by above `mvn install`
30-
[ "JDK11_HOME" = "$jhome" ] && continue
61+
[ "JDK${default_build_jdk_version}_HOME" = "$jhome_var_name" ] && continue
3162

32-
export JAVA_HOME=${!jhome}
63+
prepare_jdks::switch_java_home_to_jdk "${!jhome_var_name}"
3364

34-
headInfo "test with Java: $JAVA_HOME"
35-
MVN_CMD surefire:test
65+
cu::head_line_echo "test with Java: $JAVA_HOME"
66+
# just test without build
67+
jvb::mvn_cmd surefire:test
3668
done

0 commit comments

Comments
 (0)