Skip to content

Commit

Permalink
refactor: update integration_test.template.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Aug 28, 2024
1 parent a98cb8a commit 6f36743
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 109 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<p align="center">
<a href="https://www.apache.org/licenses/LICENSE-2.0.html"><img src="https://img.shields.io/github/license/foldright/bash-buddy?color=4D7A97&logo=apache" alt="License"></a>
<a href="https://github.com/foldright/bash-buddy/releases"><img src="https://img.shields.io/github/release/foldright/bash-buddy.svg" alt="GitHub release"></a>
<a href="https://github.com/foldright/bash-buddy/stargazers"><img src="https://img.shields.io/github/stars/foldright/bash-buddy" alt="GitHub Stars"></a>
<a href="https://github.com/foldright/bash-buddy/fork"><img src="https://img.shields.io/github/forks/foldright/bash-buddy" alt="GitHub Forks"></a>
<a href="https://github.com/foldright/bash-buddy/stargazers"><img src="https://img.shields.io/github/stars/foldright/bash-buddy?style=flat" alt="GitHub Stars"></a>
<a href="https://github.com/foldright/bash-buddy/fork"><img src="https://img.shields.io/github/forks/foldright/bash-buddy?style=flat" alt="GitHub Forks"></a>
<a href="https://github.com/foldright/bash-buddy/issues"><img src="https://img.shields.io/github/issues/foldright/bash-buddy" alt="GitHub issues"></a>
<a href="https://github.com/foldright/bash-buddy"><img src="https://img.shields.io/github/repo-size/foldright/bash-buddy" alt="GitHub repo size"></a>
</p>
Expand Down
87 changes: 0 additions & 87 deletions templates/appveyor.template.yml

This file was deleted.

42 changes: 22 additions & 20 deletions templates/integration_test.template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,56 @@ SELF_PATH=$(realpath -- "$0")
readonly SELF_PATH SELF_DIR=${SELF_PATH%/*}
cd "$SELF_DIR"

FIXME BASH_BUDDY_ROOT="$(realpath -- path/to/bash-buddy/dir)"
FIXME BASH_BUDDY_ROOT=......
readonly BASH_BUDDY_ROOT

# shellcheck disable=SC1091
source "$BASH_BUDDY_ROOT/lib/trap_error_info.sh"
# shellcheck disable=SC1091
source "$BASH_BUDDY_ROOT/lib/common_utils.sh"
# shellcheck disable=SC1091
source "$BASH_BUDDY_ROOT/lib/java_utils.sh"
# shellcheck disable=SC1091
source "$BASH_BUDDY_ROOT/lib/maven_utils.sh"

################################################################################
# prepare
################################################################################

readonly default_build_jdk_version=11
# shellcheck disable=SC2034
readonly PREPARE_JDKS_INSTALL_BY_SDKMAN=(
readonly default_build_jdk_version=17
readonly JDK_VERSIONS=(
8
11
"$default_build_jdk_version"
17
21
)

source "$BASH_BUDDY_ROOT/lib/prepare_jdks.sh"

source "$BASH_BUDDY_ROOT/lib/maven_utils.sh"

################################################################################
# ci build logic
################################################################################

FIXME PROJECT_ROOT_DIR="$(realpath -- /path/to/project/root/dir)"
cd "$PROJECT_ROOT_DIR"
FIXME PROJECT_ROOT=......
readonly PROJECT_ROOT
cd "$PROJECT_ROOT"

########################################
# do build and test by default version jdk
########################################

prepare_jdks::switch_to_jdk "$default_build_jdk_version"
jvu::switch_to_jdk "$default_build_jdk_version"

cu::head_line_echo "build and test with JDK: $JAVA_HOME"
jvb::mvn_cmd clean install
cu::head_line_echo "build and test with Java: $JAVA_HOME"
mvu::mvn_cmd clean install

########################################
# test by multi-version jdk
########################################
for jdk in "${PREPARE_JDKS_INSTALL_BY_SDKMAN[@]}"; do
for jdk_version in "${JDK_VERSIONS[@]}"; do
# already tested above
[ "$jdk" = "$default_build_jdk_version" ] && continue
[ "$jdk_version" = "$default_build_jdk_version" ] && continue

prepare_jdks::switch_to_jdk "$jdk"
jvu::switch_to_jdk "$jdk_version"

cu::head_line_echo "test with JDK: $JAVA_HOME"
cu::head_line_echo "test with Java: $JAVA_HOME"
# just test without build
jvb::mvn_cmd surefire:test
mvu::mvn_cmd surefire:test
done

0 comments on commit 6f36743

Please sign in to comment.