Skip to content

Commit

Permalink
build(ci): use GitHub action 🐙 strong_ci.yaml instead of `appveyor.…
Browse files Browse the repository at this point in the history
…yml`
  • Loading branch information
oldratlee committed Aug 13, 2023
1 parent d2407c2 commit 43999c2
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 83 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/strong_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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 }}
JAVA19_HOME: ${{ env.JAVA_HOME_19_X64 }}
JAVA20_HOME: ${{ env.JAVA_HOME_20_X64 }}
JAVA21_HOME: ${{ env.JAVA_HOME_21_X64 }}

- name: remove self maven install files
run: $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 }}
1 change: 0 additions & 1 deletion README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<a href="https://github.com/alibaba/transmittable-thread-local/actions/workflows/ci.yaml"><img src="https://img.shields.io/github/actions/workflow/status/alibaba/transmittable-thread-local/ci.yaml?branch=master&logo=github&logoColor=white" alt="Github Workflow Build Status"></a>
<a href="https://ci.appveyor.com/project/oldratlee/transmittable-thread-local"><img src="https://img.shields.io/appveyor/ci/oldratlee/transmittable-thread-local/master?logo=appveyor&logoColor=white" alt="Appveyor Build Status"></a>
<a href="https://codecov.io/gh/alibaba/transmittable-thread-local/branch/master"><img src="https://img.shields.io/codecov/c/github/alibaba/transmittable-thread-local/master?logo=codecov&logoColor=white" alt="Coverage Status"></a>
<a href="https://codeclimate.com/github/alibaba/transmittable-thread-local/maintainability"><img src="https://img.shields.io/codeclimate/maintainability/alibaba/transmittable-thread-local?logo=codeclimate&logoColor=white" alt="Maintainability"></a>
<a href="https://openjdk.java.net/"><img src="https://img.shields.io/badge/Java-6+-green?logo=openjdk&logoColor=white" alt="JDK support"></a>
<a href="https://www.apache.org/licenses/LICENSE-2.0.html"><img src="https://img.shields.io/github/license/alibaba/transmittable-thread-local?color=4D7A97&logo=apache" alt="License"></a>
<a href="https://alibaba.github.io/transmittable-thread-local/apidocs/"><img src="https://img.shields.io/github/release/alibaba/transmittable-thread-local?label=javadoc&color=3d7c47&logo=microsoft-academic&logoColor=white" alt="Javadocs"></a>
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<a href="https://github.com/alibaba/transmittable-thread-local/actions/workflows/ci.yaml"><img src="https://img.shields.io/github/actions/workflow/status/alibaba/transmittable-thread-local/ci.yaml?branch=master&logo=github&logoColor=white" alt="Github Workflow Build Status"></a>
<a href="https://ci.appveyor.com/project/oldratlee/transmittable-thread-local"><img src="https://img.shields.io/appveyor/ci/oldratlee/transmittable-thread-local/master?logo=appveyor&logoColor=white" alt="Appveyor Build Status"></a>
<a href="https://codecov.io/gh/alibaba/transmittable-thread-local/branch/master"><img src="https://img.shields.io/codecov/c/github/alibaba/transmittable-thread-local/master?logo=codecov&logoColor=white" alt="Coverage Status"></a>
<a href="https://codeclimate.com/github/alibaba/transmittable-thread-local/maintainability"><img src="https://img.shields.io/codeclimate/maintainability/alibaba/transmittable-thread-local?logo=codeclimate&logoColor=white" alt="Maintainability"></a>
<a href="https://openjdk.java.net/"><img src="https://img.shields.io/badge/Java-6+-green?logo=openjdk&logoColor=white" alt="JDK support"></a>
<a href="https://www.apache.org/licenses/LICENSE-2.0.html"><img src="https://img.shields.io/github/license/alibaba/transmittable-thread-local?color=4D7A97&logo=apache" alt="License"></a>
<a href="https://alibaba.github.io/transmittable-thread-local/apidocs/"><img src="https://img.shields.io/github/release/alibaba/transmittable-thread-local?label=javadoc&color=3d7c47&logo=microsoft-academic&logoColor=white" alt="Javadocs"></a>
Expand Down
48 changes: 0 additions & 48 deletions appveyor.yml

This file was deleted.

7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,13 @@
</profile>
<profile>
<id>gen-code-cov</id>
<activation>
<property>
<!-- https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables -->
<name>env.CI</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
Expand Down
73 changes: 41 additions & 32 deletions scripts/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,85 +4,94 @@ 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.
#
# De-activate a maven profile from command line
# 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'
${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

(
cd ttl2-compatible
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
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@
</profile>
<profile>
<id>gen-code-cov</id>
<activation>
<property>
<!-- https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables -->
<name>env.CI</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
Expand Down
7 changes: 7 additions & 0 deletions ttl2-compatible/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@
</profile>
<profile>
<id>gen-code-cov</id>
<activation>
<property>
<!-- https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables -->
<name>env.CI</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
Expand Down

0 comments on commit 43999c2

Please sign in to comment.