Skip to content

Commit

Permalink
chore(ci): use GitHub action šŸ™ ci_by_multiply_java_versions.yaml inā€¦
Browse files Browse the repository at this point in the history
ā€¦stead of `appveyor.yml`
  • Loading branch information
oldratlee committed Apr 4, 2023
1 parent 152ab9e commit b8eab09
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 78 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Quickstart for GitHub Actions
# https://docs.github.com/en/actions/quickstart

name: CI
on: [ push, pull_request ]
name: Fast CI
on: [ push, pull_request, workflow_dispatch ]
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
java: [ 8, 11, 17, 19, 20-ea ]
java: [ 8, 11 ]
fail-fast: false
max-parallel: 64
name: Test JDK ${{ matrix.java }}, ${{ matrix.os }}
name: fast test on Java ${{ matrix.java }} OS ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
Expand All @@ -22,5 +22,18 @@ jobs:
java-version: ${{ matrix.java }}
distribution: zulu
cache: maven

- name: Build with Maven
run: ./mvnw -V --no-transfer-progress clean install

- name: remove cola self maven install files for OS *nix
run: rm -rf $HOME/.m2/repository/com/alibaba/{cola,craftsman}
# https://docs.github.com/en/actions/learn-github-actions/variables#detecting-the-operating-system
# https://docs.github.com/en/actions/learn-github-actions/expressions
if: runner.os != 'Windows'
- name: remove cola self maven install files for OS Windows
run: |
Remove-Item -Recurse -Force $home/.m2/repository/com/alibaba/cola
Remove-Item -Recurse -Force $home/.m2/repository/com/alibaba/craftsman
if: runner.os == 'Windows'

55 changes: 55 additions & 0 deletions .github/workflows/ci_by_multiply_java_versions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Quickstart for GitHub Actions
# https://docs.github.com/en/actions/quickstart

name: Strong CI with multiply java versions
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: 20
name: test by multiply java versions

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: setup java8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: zulu
# only first java setup need enable cache
cache: maven
- name: setup java11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: microsoft
- name: setup java17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: microsoft
- name: setup java19
uses: actions/setup-java@v3
with:
java-version: 19
distribution: temurin
- name: setup java20
uses: actions/setup-java@v3
with:
java-version: 20
distribution: zulu

- run: scripts/integration_test
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 }}

- name: remove cola self maven install files
run: rm -rf $HOME/.m2/repository/com/alibaba/{cola,craftsman}
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# šŸ„¤ COLA v4

[![Github Workflow Build Status](https://img.shields.io/github/actions/workflow/status/alibaba/cola/ci.yaml?branch=master&logo=github&logoColor=white)](https://github.com/alibaba/cola/actions/workflows/ci.yaml)
[![Appveyor Build Status](https://img.shields.io/appveyor/ci/oldratlee/cola/master?logo=appveyor&logoColor=white)](https://ci.appveyor.com/project/oldratlee/cola)
[![Maven Central](https://img.shields.io/maven-central/v/com.alibaba.cola/cola-component-dto.svg?logo=apache-maven&color=2d545e)](https://search.maven.org/search?q=g:com.alibaba.cola)
[![GitHub release](https://img.shields.io/github/release/alibaba/COLA.svg)](https://github.com/alibaba/COLA/releases)
[![Java support](https://img.shields.io/badge/Java-8+-green?logo=OpenJDK&logoColor=white)](https://openjdk.java.net/)
[![Fast CI](https://img.shields.io/github/actions/workflow/status/alibaba/cola/ci.yaml?branch=master&logo=github&logoColor=white&label=fast-ci)](https://github.com/alibaba/cola/actions/workflows/ci.yaml)
[![Multiply Java versions CI](https://img.shields.io/github/actions/workflow/status/alibaba/cola/ci_by_multiply_java_versions.yaml?branch=master&logo=github&logoColor=white&label=strong-ci)](https://github.com/alibaba/cola/actions/workflows/ci_by_multiply_java_versions.yaml)
[![License](https://img.shields.io/badge/license-LGPL%202.1-4EB1BA.svg?color=4D7A97&logo=apache)](LICENSE)
[![Java support](https://img.shields.io/badge/Java-8+-339933?logo=OpenJDK&logoColor=white)](https://openjdk.java.net/)
[![Maven Central](https://img.shields.io/maven-central/v/com.alibaba.cola/cola-component-dto.svg?logo=apache-maven)](https://search.maven.org/search?q=g:com.alibaba.cola)
[![GitHub Releases](https://img.shields.io/github/release/alibaba/COLA.svg)](https://github.com/alibaba/COLA/releases)
[![GitHub Stars](https://img.shields.io/github/stars/alibaba/COLA)](https://github.com/alibaba/COLA/stargazers)
[![GitHub Forks](https://img.shields.io/github/forks/alibaba/COLA)](https://github.com/alibaba/COLA/fork)
[![user repos](https://badgen.net/github/dependents-repo/alibaba/COLA?label=user%20repos)](https://github.com/alibaba/COLA/network/dependents)
[![user repos](https://badgen.net/github/dependents-repo/alibaba/COLA?label=user-repos)](https://github.com/alibaba/COLA/network/dependents)
[![GitHub issues](https://img.shields.io/github/issues/alibaba/COLA.svg)](https://github.com/alibaba/COLA/issues)
[![GitHub Contributors](https://img.shields.io/github/contributors/alibaba/COLA)](https://github.com/alibaba/COLA/graphs/contributors)
[![gitpod: Ready to Code](https://img.shields.io/badge/Gitpod-ready--to--code-green?label=gitpod&logo=gitpod&logoColor=white)](https://gitpod.io/#https://github.com/alibaba/COLA)
[![gitpod: Ready to Code](https://img.shields.io/badge/Gitpod-ready--to--code-339933?label=gitpod&logo=gitpod&logoColor=white)](https://gitpod.io/#https://github.com/alibaba/COLA)

<strong>COLA ę˜Æ Clean Object-Oriented and Layered Architectureēš„ē¼©å†™ļ¼Œä»£č”Øā€œę•“ę“é¢å‘åÆ¹č±”åˆ†å±‚ęž¶ęž„ā€ć€‚
ē›®å‰COLAå·²ē»å‘展到[COLA v4](https://blog.csdn.net/significantfrank/article/details/110934799)怂</strong>
Expand Down
49 changes: 0 additions & 49 deletions appveyor.yml

This file was deleted.

41 changes: 23 additions & 18 deletions scripts/integration_test
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")"

source bash-buddy/lib/trap_error_info.sh
source bash-buddy/lib/common_utils.sh
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_build_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
19
20
)
readonly default_jh_var_name="JAVA${default_build_jdk_version}_HOME"

source bash-buddy/lib/prepare_jdks.sh

source bash-buddy/lib/java_build_utils.sh

# here use `install` and `-D performRelease` intended
# to check release operations.
# Here use `-D performRelease` intendedly to check release operations.
#
# De-activate a maven profile from command line
# https://stackoverflow.com/questions/25201430
Expand Down Expand Up @@ -120,24 +121,28 @@ test_cola_archetype() {
# default jdk 11, do build and test
########################################

prepare_jdks::switch_to_jdk "$default_build_jdk_version"
[ -d "${!default_jh_var_name:-}" ] || cu::die "\$${default_jh_var_name}(${!default_jh_var_name:-}) dir is not existed!"
export JAVA_HOME="${!default_jh_var_name}"

cu::head_line_echo "build and test with Java: $JAVA_HOME"
cu::head_line_echo "build and test with Java $default_build_jdk_version: $JAVA_HOME"

jvb::mvn_cmd clean install

test_cola_archetype

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

prepare_jdks::switch_to_jdk "$jdk"
for jdk_version in "${JDK_VERSIONS[@]}"; do
# skip default jdk, already tested above
[ "$jdk_version" = "$default_build_jdk_version" ] && continue

jh_var_name="JAVA${jdk_version}_HOME"
[ -d "${!jh_var_name:-}" ] || cu::die "\$${jh_var_name}(${!jh_var_name:-}) dir is not existed!"
export JAVA_HOME="${!jh_var_name}"

cu::head_line_echo "test with Java: $JAVA_HOME"
cu::head_line_echo "test with Java $jdk_version: $JAVA_HOME"

# just test without build
jvb::mvn_cmd surefire:test
Expand Down

0 comments on commit b8eab09

Please sign in to comment.