From 6f36743ee57d281896f0e1c12d3d42c3a05bec29 Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Fri, 23 Aug 2024 19:58:25 +0800 Subject: [PATCH] refactor: update `integration_test.template.sh` --- README.md | 4 +- templates/appveyor.template.yml | 87 -------------------------- templates/integration_test.template.sh | 42 +++++++------ 3 files changed, 24 insertions(+), 109 deletions(-) delete mode 100644 templates/appveyor.template.yml diff --git a/README.md b/README.md index ed66e9b..9163e1d 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@

License GitHub release -GitHub Stars -GitHub Forks +GitHub Stars +GitHub Forks GitHub issues GitHub repo size

diff --git a/templates/appveyor.template.yml b/templates/appveyor.template.yml deleted file mode 100644 index 3c3445f..0000000 --- a/templates/appveyor.template.yml +++ /dev/null @@ -1,87 +0,0 @@ -# appveyor.yml Reference -# https://www.appveyor.com/docs/appveyor-yml/ -# -# How to use AppVeyor to build a multi-arch Docker image for Linux and Windows -# https://stefanscherer.github.io/use-appveyor-to-build-multi-arch-docker-image/ -# -# Building ASP.NET Core apps on both Windows and Linux using AppVeyor -# https://andrewlock.net/building-asp-net-core-apps-on-both-windows-and-linux-using-appveyor/ -# -# appveyor.yml Example: -# https://github.com/cdcseacave/openMVS/blob/master/.appveyor.yml - -version: '{build}' -image: - - Ubuntu2004 - - Visual Studio 2017 -build: false -clone_depth: 50 -branches: - except: - - gh-pages - -environment: - APPVEYOR_YML_DISABLE_PS_LINUX: true - MAVEN_OPTS: "-Xmx768m -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2" - JAVA_OPTS: "-Xmx768m" - -for: - - - #------------------ - # Ubuntu - #------------------ - matrix: - only: - - image: Ubuntu2004 - - install: - - git submodule update --init - test_script: - - scripts/integration_test - - after_test: - # remove self maven install - # - rm -rf $HOME/.m2/repository/$project_gid_aid_path - # remove maven install file - - rm -rf $HOME/.m2/wrapper/dists/*/*/*.zip - # remove gradle install file - # - rm -rf $HOME/.gradle/wrapper/dists/*/*/*.zip - # # remove sdkman install file - - rm -rf $HOME/.sdkman/archives/* - - cache: - # if cache size is exceed appveyor limit: - # Compressed cache item cannot exceed 1,048,576,000 bytes - # skip below maven cache: - - $HOME/.m2/ - - $HOME/.gradle/ - - $HOME/.sdkman/ - - - #------------------ - # Windows - #------------------ - matrix: - only: - - image: Visual Studio 2017 - install: - - ps: "ls 'C:/Program Files/Java/jdk*'" - - ps: "ls 'C:/Program Files (x86)/Java/jdk*'" - - echo JAVA_HOME=%JAVA_HOME%, HOMEPATH=%HOMEPATH%, PATH=%PATH% - - test_script: - # test under java 11 - - set JAVA_HOME=C:\Program Files\Java\jdk11 - - ./mvnw.cmd -DperformRelease -P!gen-sign -V --no-transfer-progress clean install - # test under java 8 - - set JAVA_HOME=C:\Program Files\Java\jdk1.8.0 - - ./mvnw.cmd -DperformRelease -P!gen-sign -V --no-transfer-progress surefire:test - - after_test: - # remove self maven install - # - ps: Remove-Item -r -fo $home\.m2\repository\$project_gid_aid_path - # remove maven install file - - ps: Remove-Item -Path $HOME\.m2\wrapper\dists\*\*\*.zip - - cache: - # https://www.appveyor.com/docs/build-cache/ - - '%HOMEDRIVE%%HOMEPATH%\.m2\' diff --git a/templates/integration_test.template.sh b/templates/integration_test.template.sh index 546d6e6..756fb06 100644 --- a/templates/integration_test.template.sh +++ b/templates/integration_test.template.sh @@ -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