Skip to content

Commit

Permalink
chore(ci): use GitHub actions 🐙 strong-ci.yml instead of `appveyo…
Browse files Browse the repository at this point in the history
…r.yml`
  • Loading branch information
oldratlee committed Sep 3, 2023
1 parent b3df2b2 commit 80a86df
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 92 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: CI

name: Fast CI
on:
push:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-excluding-paths
Expand All @@ -10,15 +9,16 @@ on:
paths-ignore:
- 'docs/**'
- '**.md'
workflow_dispatch:

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
timeout-minutes: 5
strategy:
matrix:
os: [ ubuntu-20.04, windows-2022 ]
java: [ 8, 11, 17, 19, 20-ea ]
java: [ 8, 20 ]
fail-fast: false
max-parallel: 32
name: Test JDK ${{ matrix.java }}, ${{ matrix.os }}
Expand All @@ -31,12 +31,4 @@ jobs:
java-version: ${{ matrix.java }}
cache: maven
- name: Test with build
run: ./mvnw -V --no-transfer-progress -D performRelease -P'!gen-sign' clean install
- name: Test without build for slf4j v1
run: ./mvnw -V --no-transfer-progress -P gen-code-cov -P enable-slf4j-v1 dependency:tree surefire:test
- name: Upload coverage to Codecov
# https://github.com/marketplace/actions/codecov
uses: codecov/codecov-action@v3
with:
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
run: ./mvnw -V --no-transfer-progress clean package
73 changes: 73 additions & 0 deletions .github/workflows/strong-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Quickstart for GitHub Actions
# https://docs.github.com/en/actions/quickstart

name: Strong CI
on:
push:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-excluding-paths
paths-ignore:
- 'docs/**'
- '**.md'
pull_request:
paths-ignore:
- 'docs/**'
- '**.md'
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

- 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 }}
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/foldright/auto-pipeline/

- name: Upload coverage to Codecov
# https://github.com/marketplace/actions/codecov
uses: codecov/codecov-action@v3
with:
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# <div align="center"><a href="#"><img src="docs/logo-green.png" alt="auto-pipeline 🚀"></a></div>
# <div align="center"><a href="#"><img src="https://user-images.githubusercontent.com/1063891/233436006-857e06d6-90d1-42fa-ac5a-e953b80526de.png" alt="auto-pipeline 🚀"></a></div>

<p align="center">
<a href="https://github.com/foldright/auto-pipeline/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/foldright/auto-pipeline/ci.yml?branch=main&logo=github&logoColor=white" alt="Github Workflow Build Status"></a>
<a href="https://ci.appveyor.com/project/oldratlee/auto-pipeline"><img src="https://img.shields.io/appveyor/ci/oldratlee/auto-pipeline/main?logo=appveyor&logoColor=white" alt="Appveyor Build Status"></a>
<a href="https://github.com/foldright/auto-pipeline/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/foldright/auto-pipeline/ci.yml?branch=main&logo=github&logoColor=white&label=fast ci" alt="Github Workflow Build Status"></a>
<a href="https://github.com/foldright/auto-pipeline/actions/workflows/strong-ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/foldright/auto-pipeline/strong-ci.yml?branch=main&logo=github&logoColor=white&label=strong ci" alt="Github Workflow Build Status"></a>
<a href="https://codecov.io/gh/foldright/auto-pipeline"><img src="https://img.shields.io/codecov/c/github/foldright/auto-pipeline/main?logo=codecov&logoColor=white" alt="Coverage Status"></a>
<a href="https://openjdk.java.net/"><img src="https://img.shields.io/badge/Java-8+-green?logo=openjdk&logoColor=white" alt="Java support"></a>
<a href="https://www.apache.org/licenses/LICENSE-2.0.html"><img src="https://img.shields.io/github/license/foldright/auto-pipeline?color=4D7A97&logo=apache" alt="License"></a>
Expand Down
47 changes: 0 additions & 47 deletions appveyor.yml

This file was deleted.

76 changes: 47 additions & 29 deletions scripts/integration_test
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,80 @@
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"
$default_build_jdk_version
17
19
20
21
)

source bash-buddy/lib/prepare_jdks.sh

source bash-buddy/lib/java_build_utils.sh

readonly default_jh_var_name="JAVA${default_build_jdk_version}_HOME"

# 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=(
readonly JVB_MVN_OPTS=(
"${JVB_DEFAULT_MVN_OPTS[@]}"
-DperformRelease -P'!gen-sign'
${CI_MORE_MVN_OPTS:+${CI_MORE_MVN_OPTS}}
)

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

cd ..

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

prepare_jdks::switch_to_jdk "$default_build_jdk_version"

cu::head_line_echo "build and test with Java: $JAVA_HOME"
[ -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}"

jvb::mvn_cmd -Pgen-code-cov '-P!gen-sign' -DperformRelease clean install
cu::head_line_echo "build and test with Java $default_build_jdk_version: $JAVA_HOME"
jvb::mvn_cmd clean install

########################################
# test multi-version java
# test by multiply version jdks
########################################
for jdk in "${PREPARE_JDKS_INSTALL_BY_SDKMAN[@]}"; do
prepare_jdks::switch_to_jdk "$jdk"

cu::head_line_echo "test with Java: $JAVA_HOME"
for jdk_version in "${JDK_VERSIONS[@]}"; do
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}"

# just test without build
# default build jdk version already tested by above `mvn install`
if [ "$default_build_jdk_version" != "$jdk" ]; then
jvb::mvn_cmd surefire:test
cu::head_line_echo "test with Java $jdk_version: $JAVA_HOME"

# about CI env var
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
if [ "${CI:-}" = true ]; then
# skip default jdk, already tested above
[ "$jdk_version" = "$default_build_jdk_version" ] &&
jvb::mvn_cmd jacoco:prepare-agent surefire:test jacoco:report

# Test for slf4j v1
jvb::mvn_cmd jacoco:prepare-agent -P enable-slf4j-v1 dependency:tree surefire:test jacoco:report
else
# skip default jdk, already tested above
[ "$jdk_version" = "$default_build_jdk_version" ] &&
jvb::mvn_cmd surefire:test

# Test for slf4j v1
jvb::mvn_cmd -P enable-slf4j-v1 dependency:tree surefire:test
fi

(
Expand Down

0 comments on commit 80a86df

Please sign in to comment.