Skip to content

Commit 556cecf

Browse files
committed
chore/CI: upgrade bash-buddy and improve integration_test 🤖
1 parent e617026 commit 556cecf

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

scripts/integration_test

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/bin/bash
22
set -eEuo pipefail
3-
cd "$(dirname "$(readlink -f "$0")")"
4-
5-
BASH_BUDDY_ROOT="$(readlink -f bash-buddy)"
6-
readonly BASH_BUDDY_ROOT
3+
# the canonical path of this script
4+
SELF_PATH=$(realpath -- "$0")
5+
readonly SELF_PATH SELF_DIR=${SELF_PATH%/*}
6+
# cd to script dir
7+
cd "$SELF_DIR"
8+
9+
readonly BASH_BUDDY_ROOT="$SELF_DIR/bash-buddy"
10+
# shellcheck disable=SC1091
711
source "$BASH_BUDDY_ROOT/lib/trap_error_info.sh"
12+
# shellcheck disable=SC1091
813
source "$BASH_BUDDY_ROOT/lib/common_utils.sh"
14+
# shellcheck disable=SC1091
915
source "$BASH_BUDDY_ROOT/lib/java_utils.sh"
16+
# shellcheck disable=SC1091
1017
source "$BASH_BUDDY_ROOT/lib/maven_utils.sh"
1118

1219
################################################################################
@@ -93,11 +100,11 @@ mvu::mvn_cmd clean install
93100
# test by multi-version jdk
94101
########################################
95102

103+
SUREFIRE_TEST_GOAL=(surefire:test)
96104
# about CI env var
97105
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
98-
if [ "${CI:-}" = true ]; then
99-
readonly CI_MORE_BEGIN_OPTS=jacoco:prepare-agent CI_MORE_END_OPTS=jacoco:report
100-
fi
106+
[ "${CI:-}" = true ] && SUREFIRE_TEST_GOAL=(jacoco:prepare-agent "${SUREFIRE_TEST_GOAL[@]}" jacoco:report)
107+
readonly SUREFIRE_TEST_GOAL
101108

102109
for jdk in "${CI_JDKS[@]}"; do
103110
# already tested by above `mvn install`
@@ -108,5 +115,5 @@ for jdk in "${CI_JDKS[@]}"; do
108115
cu::head_line_echo "test with Java: $JAVA_HOME"
109116
# just test without build
110117
# shellcheck disable=SC2086
111-
mvu::mvn_cmd ${CI_MORE_BEGIN_OPTS:-} surefire:test ${CI_MORE_END_OPTS:-}
118+
mvu::mvn_cmd "${SUREFIRE_TEST_GOAL[@]}"
112119
done

0 commit comments

Comments
 (0)