From 622afcf0a013ebc12ebb8e74f28b44aa58645260 Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Thu, 29 Jun 2023 14:36:21 +0800 Subject: [PATCH] chore(ci): update CI config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add `JDK 20/21-ea` into GitHub CI 🤖 - use GitHub action 🐙 `strong_ci.yaml` instead of `appveyor.yml` - upgrade `bash-buddy` to `v0.3.3` - upgrade dependencies/plugins 🛠️ - remove invalid `codeclimate` badge from README --- .github/workflows/ci.yaml | 4 +- .github/workflows/strong_ci.yaml | 62 +++++++++++++++ README-EN.md | 7 +- README.md | 7 +- appveyor.yml | 48 ------------ pom.xml | 15 +++- scripts/bash-buddy | 2 +- scripts/integration-test.sh | 76 +++++++++++-------- .../pom.xml | 7 ++ ttl2-compatible/pom.xml | 7 ++ 10 files changed, 140 insertions(+), 95 deletions(-) create mode 100644 .github/workflows/strong_ci.yaml delete mode 100644 appveyor.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 39d36a989..4ea3259fb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,6 @@ # Quickstart for GitHub Actions # https://docs.github.com/en/actions/quickstart -name: CI +name: fast CI on: [ push, pull_request, workflow_dispatch ] jobs: @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest, windows-latest ] - java: [ 8, 11, 17, 19, 20-ea ] + java: [ 8, 11, 17, 20, 21-ea ] fail-fast: false max-parallel: 64 name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} diff --git a/.github/workflows/strong_ci.yaml b/.github/workflows/strong_ci.yaml new file mode 100644 index 000000000..33639e784 --- /dev/null +++ b/.github/workflows/strong_ci.yaml @@ -0,0 +1,62 @@ +# Quickstart for GitHub Actions +# https://docs.github.com/en/actions/quickstart + +name: Strong CI +on: [ push, pull_request, workflow_dispatch ] +jobs: + test: + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners + runs-on: ubuntu-latest + timeout-minutes: 15 + name: test by multiply java versions + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: setup Java 8 + uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: zulu + # only first java setup need enable cache + cache: maven + - name: setup Java 11 + uses: actions/setup-java@v3 + with: + java-version: 11 + distribution: microsoft + - name: setup Java 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: microsoft + - name: setup Java 20 + uses: actions/setup-java@v3 + with: + java-version: 20 + distribution: zulu + - name: setup Java 21 + uses: actions/setup-java@v3 + with: + java-version: 21-ea + distribution: zulu + + - name: run integration test + run: scripts/integration-test.sh + env: + JAVA8_HOME: ${{ env.JAVA_HOME_8_X64 }} + JAVA11_HOME: ${{ env.JAVA_HOME_11_X64 }} + JAVA17_HOME: ${{ env.JAVA_HOME_17_X64 }} + JAVA20_HOME: ${{ env.JAVA_HOME_20_X64 }} + JAVA21_HOME: ${{ env.JAVA_HOME_21_X64 }} + + - name: remove self maven install files + run: rm -rf $HOME/.m2/repository/com/alibaba/{transmittable-thread-local,ttl}* + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + with: + name: codecov-umbrella + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/README-EN.md b/README-EN.md index ed9f1a28b..ecd896ed4 100644 --- a/README-EN.md +++ b/README-EN.md @@ -8,10 +8,9 @@ ----------------------------------------

-Github Workflow Build Status -Appveyor Build Status +Github Workflow Build Status +Github Workflow Build Status Coverage Status -Maintainability JDK support License Javadocs @@ -57,7 +56,7 @@ # 🔧 Functions 👉 `TransmittableThreadLocal`(`TTL`): The missing Java™ std lib(simple & 0-dependency) for framework/middleware, -provide an enhanced `InheritableThreadLocal` that transmits values between threads even using thread pooling components. Support `Java 6~19`. +provide an enhanced `InheritableThreadLocal` that transmits values between threads even using thread pooling components. Support `Java 6~21`. Class [`InheritableThreadLocal`](https://docs.oracle.com/javase/10/docs/api/java/lang/InheritableThreadLocal.html) in `JDK` can transmit value to child thread from parent thread. diff --git a/README.md b/README.md index 16587e22f..019e90998 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,9 @@ ----------------------------------------

-Github Workflow Build Status -Appveyor Build Status +Github Workflow Build Status +Github Workflow Build Status Coverage Status -Maintainability JDK support License Javadocs @@ -60,7 +59,7 @@ # 🔧 功能 -👉 `TransmittableThreadLocal`(`TTL`):在使用线程池等会池化复用线程的执行组件情况下,提供`ThreadLocal`值的传递功能,解决异步执行时上下文传递的问题。一个`Java`标准库本应为框架/中间件设施开发提供的标配能力,本库功能聚焦 & 0依赖,支持`Java 6~20`。 +👉 `TransmittableThreadLocal`(`TTL`):在使用线程池等会池化复用线程的执行组件情况下,提供`ThreadLocal`值的传递功能,解决异步执行时上下文传递的问题。一个`Java`标准库本应为框架/中间件设施开发提供的标配能力,本库功能聚焦 & 0依赖,支持`Java 6~21`。 `JDK`的[`InheritableThreadLocal`](https://docs.oracle.com/javase/10/docs/api/java/lang/InheritableThreadLocal.html)类可以完成父线程到子线程的值传递。但对于使用线程池等会池化复用线程的执行组件的情况,线程由线程池创建好,并且线程是池化起来反复使用的;这时父子线程关系的`ThreadLocal`值传递已经没有意义,应用需要的实际上是把 **任务提交给线程池时**的`ThreadLocal`值传递到 **任务执行时**。 diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index c731214f2..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,48 +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 -build: false -clone_depth: 50 -branches: - except: - - gh-pages - -environment: - MAVEN_OPTS: -Xmx1g - JAVA_OPTS: -Xmx1g - -install: - - git submodule update --init - -test_script: - - scripts/integration-test.sh - -after_test: - - PREPARE_JDKS_AUTO_SHOW_LS_JAVA= scripts/codecov.sh -s - # remove self maven install files - - rm -rf $HOME/.m2/repository/com/alibaba/transmittable-thread-local* - - rm -rf $HOME/.m2/repository/com/alibaba/ttl* - # remove install files of maven - # skip rm zip files, because maven wrapper 3.9 will download zip file if absent - # - rm -rf $HOME/.m2/wrapper/dists/*/*/*.zip - # remove install files of sdkman - - rm -rf $HOME/.sdkman/archives/* - - rm -rf $HOME/.sdkman/tmp/* - -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/.sdkman/ diff --git a/pom.xml b/pom.xml index 05a3dfa8b..76b9ff7db 100644 --- a/pom.xml +++ b/pom.xml @@ -83,17 +83,17 @@ 3.0.2 24.0.1 - 1.8.22 + 1.9.0 ${maven.compiler.source} - 1.7.2 + 1.7.3 1.8.20 8 - 2.0.3 + 2.0.7 - 5.9.3 + 5.10.0 5.6.2 + env.CI + true + + diff --git a/scripts/bash-buddy b/scripts/bash-buddy index eb0cb6fc9..d53f56109 160000 --- a/scripts/bash-buddy +++ b/scripts/bash-buddy @@ -1 +1 @@ -Subproject commit eb0cb6fc995ec14ba20b9fca5a7779937212c31f +Subproject commit d53f56109ae97028ff70264491eec7b1a4ba1a6b diff --git a/scripts/integration-test.sh b/scripts/integration-test.sh index 31b18bdec..72b935779 100755 --- a/scripts/integration-test.sh +++ b/scripts/integration-test.sh @@ -4,26 +4,25 @@ cd "$(dirname "$(readlink -f "$0")")" BASH_BUDDY_ROOT="$(readlink -f bash-buddy)" readonly BASH_BUDDY_ROOT - source "$BASH_BUDDY_ROOT/lib/trap_error_info.sh" source "$BASH_BUDDY_ROOT/lib/common_utils.sh" +source "$BASH_BUDDY_ROOT/lib/java_utils.sh" +source "$BASH_BUDDY_ROOT/lib/maven_utils.sh" ################################################################################ -# prepare +# ci build logic ################################################################################ readonly default_build_jdk_version=11 # shellcheck disable=SC2034 -readonly PREPARE_JDKS_INSTALL_BY_SDKMAN=( +readonly JDK_VERSIONS=( 8 "$default_build_jdk_version" 17 + 20 + 21 ) -source "$BASH_BUDDY_ROOT/lib/prepare_jdks.sh" - -source "$BASH_BUDDY_ROOT/lib/java_build_utils.sh" - # here use `install` and `-D performRelease` intended # to check release operations. # @@ -31,40 +30,44 @@ source "$BASH_BUDDY_ROOT/lib/java_build_utils.sh" # https://stackoverflow.com/questions/25201430 # # shellcheck disable=SC2034 -JVB_MVN_OPTS=( - "${JVB_DEFAULT_MVN_OPTS[@]}" +readonly MVU_MVN_OPTS=( + "${MVU_DEFAULT_MVN_OPTS[@]}" -DperformRelease -P'!gen-sign' + # Maven Plugin Validation + # https://maven.apache.org/guides/plugins/validation/index.html + -Dmaven.plugin.validation=NONE + ${CI_MORE_MVN_OPTS:+${CI_MORE_MVN_OPTS}} ) -################################################################################ -# ci build logic -################################################################################ - -PROJECT_ROOT_DIR="$(readlink -f ..)" -readonly PROJECT_ROOT_DIR -cd "$PROJECT_ROOT_DIR" +cd .. ######################################## -# do build and test by default version jdk +# 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 Java: $JAVA_HOME" -jvb::mvn_cmd clean install +cu::head_line_echo "build and test with Java $default_build_jdk_version: $JAVA_HOME" +mvu::mvn_cmd clean install ######################################## # test by multi-version jdk ######################################## -for jdk in "${PREPARE_JDKS_INSTALL_BY_SDKMAN[@]}"; do - prepare_jdks::switch_to_jdk "$jdk" - # just test without build +# about CI env var +# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables +if [ "${CI:-}" = true ]; then + readonly CI_MORE_BEGIN_OPTS=jacoco:prepare-agent CI_MORE_END_OPTS=jacoco:report +fi - # default jdk already tested above - if [ "$jdk" != "$default_build_jdk_version" ]; then +for jdk_version in "${JDK_VERSIONS[@]}"; do + jvu::switch_to_jdk "$jdk_version" + + # just test without build + if [ "$jdk_version" = "$default_build_jdk_version" ]; then + # default jdk already tested above cu::head_line_echo "test with Java: $JAVA_HOME" - jvb::mvn_cmd surefire:test -Denforcer.skip + mvu::mvn_cmd ${CI_MORE_BEGIN_OPTS:-} surefire:test -Denforcer.skip ${CI_MORE_END_OPTS:-} fi ( @@ -72,17 +75,26 @@ for jdk in "${PREPARE_JDKS_INSTALL_BY_SDKMAN[@]}"; do cu::head_line_echo "test with TTL Agent and Java: $JAVA_HOME" cu::blue_echo 'Run unit test under ttl agent, include check for ExecutorService, ForkJoinPool, Timer/TimerTask' - jvb::mvn_cmd -Penable-ttl-agent-for-test surefire:test -Denforcer.skip \ - -Dttl.agent.extra.d.options='-Drun-ttl-test-under-agent-with-enable-timer-task=true' + mvu::mvn_cmd ${CI_MORE_BEGIN_OPTS:-} \ + surefire:test -Denforcer.skip \ + -Penable-ttl-agent-for-test \ + -Dttl.agent.extra.d.options='-Drun-ttl-test-under-agent-with-enable-timer-task=true' \ + ${CI_MORE_END_OPTS:-} cu::blue_echo 'Run unit test under ttl agent, and turn on the disable inheritable for thread pool enhancement' - jvb::mvn_cmd -Penable-ttl-agent-for-test surefire:test -Denforcer.skip \ + mvu::mvn_cmd ${CI_MORE_BEGIN_OPTS:-} \ + surefire:test -Denforcer.skip \ + -Penable-ttl-agent-for-test \ -Dttl.agent.extra.args='ttl.agent.disable.inheritable.for.thread.pool:true' \ - -Dttl.agent.extra.d.options='-Drun-ttl-test-under-agent-with-disable-inheritable=true' + -Dttl.agent.extra.d.options='-Drun-ttl-test-under-agent-with-disable-inheritable=true' \ + ${CI_MORE_END_OPTS:-} cu::blue_echo 'Run agent check for Timer/TimerTask, explicit "ttl.agent.enable.timer.task"' - jvb::mvn_cmd -Penable-ttl-agent-for-test surefire:test -Denforcer.skip \ + mvu::mvn_cmd ${CI_MORE_BEGIN_OPTS:-} \ + surefire:test -Denforcer.skip \ + -Penable-ttl-agent-for-test \ -Dttl.agent.extra.args='ttl.agent.enable.timer.task:true' \ - -Dttl.agent.extra.d.options='-Drun-ttl-test-under-agent-with-enable-timer-task=true' + -Dttl.agent.extra.d.options='-Drun-ttl-test-under-agent-with-enable-timer-task=true' \ + ${CI_MORE_END_OPTS:-} ) done diff --git a/ttl-integrations/sample-ttl-agent-extension-transformlet/pom.xml b/ttl-integrations/sample-ttl-agent-extension-transformlet/pom.xml index 9df030ef9..cdc3dd5bf 100644 --- a/ttl-integrations/sample-ttl-agent-extension-transformlet/pom.xml +++ b/ttl-integrations/sample-ttl-agent-extension-transformlet/pom.xml @@ -115,6 +115,13 @@ gen-code-cov + + + + env.CI + true + + diff --git a/ttl2-compatible/pom.xml b/ttl2-compatible/pom.xml index 6b9ea418a..78de57a61 100644 --- a/ttl2-compatible/pom.xml +++ b/ttl2-compatible/pom.xml @@ -320,6 +320,13 @@ gen-code-cov + + + + env.CI + true + +