diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 12342f9..e549596 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,3 +13,7 @@ updates: directory: "/auto-pipeline-examples" schedule: interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecb16d9..0f3ce27 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,14 +18,14 @@ jobs: strategy: matrix: os: [ ubuntu-20.04, windows-2022 ] - java: [ 8, 20 ] + java: [ 8, 21 ] fail-fast: false max-parallel: 32 - name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} + name: CI on JDK ${{ matrix.java }} OS ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: zulu java-version: ${{ matrix.java }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d2deb6d..708cf9e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install mdbook diff --git a/.github/workflows/strong-ci.yml b/.github/workflows/strong-ci.yml index 21cca0d..3ea3d44 100644 --- a/.github/workflows/strong-ci.yml +++ b/.github/workflows/strong-ci.yml @@ -19,39 +19,34 @@ jobs: # 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 + name: CI by multiply java versions steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - name: setup Java 8 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 8 distribution: zulu # only first java setup need enable cache cache: maven - name: setup Java 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 11 distribution: microsoft - name: setup Java 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 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 + uses: actions/setup-java@v4 with: - java-version: 21-ea + java-version: 21 distribution: zulu - run: scripts/integration_test @@ -59,7 +54,6 @@ jobs: 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 diff --git a/scripts/bash-buddy b/scripts/bash-buddy index eb0cb6f..e3b1586 160000 --- a/scripts/bash-buddy +++ b/scripts/bash-buddy @@ -1 +1 @@ -Subproject commit eb0cb6fc995ec14ba20b9fca5a7779937212c31f +Subproject commit e3b1586dc53f15b9b8a8ff74c2d0b3108872a61b diff --git a/scripts/clear_appveyor_cache b/scripts/clear_appveyor_cache deleted file mode 100755 index 266d4c5..0000000 --- a/scripts/clear_appveyor_cache +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env pwsh - -$appveyor_project = "oldratlee/auto-pipeline" - -# https://stackoverflow.com/questions/24649019/how-to-use-confirm-in-powershell -$confirmation = Read-Host "Are you Sure You Want To Clear cache of appveyor project $appveyor_project [y/N]" -if ($confirmation -ne 'y') -{ - Write-Output "do nothing and exit" - exit -} - -# PowerShell: Run command from script's directory - Stack Overflow -# https://stackoverflow.com/questions/4724290 -# $script_path = $MyInvocation.MyCommand.Path -# $script_dir = Split-Path $script_path - -# Equivalent of bash's `source` command in Powershell? - Super User -# https://superuser.com/questions/71446 -# Script scope and dot sourcing - PowerShell | Microsoft Docs -# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scripts#script-scope-and-dot-sourcing -# PowerShell: How to quickly switch to your home directory -# https://sid-500.com/2017/08/03/powershell-how-to-quickly-switch-to-your-home-directory/ -. "$home\.appveyor_token.ps1" -# file appveyor_token.ps1 provide appveyor token. content sample: -# $appveyor_token = xxx - -# https://www.appveyor.com/docs/build-cache/#remove-cache-entry-from-build-config -# https://www.appveyor.com/docs/api/#authentication - -$headers = @{ } -$headers['Authorization'] = "Bearer $appveyor_token" -$headers["Content-type"] = "application/json" -$uri = "https://ci.appveyor.com/api/projects/$appveyor_project/buildcache" - -Invoke-RestMethod -Uri $uri -Headers $headers -Method Delete diff --git a/scripts/integration_test b/scripts/integration_test index 98b88ab..a33fb36 100755 --- a/scripts/integration_test +++ b/scripts/integration_test @@ -6,7 +6,8 @@ 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" +source "$BASH_BUDDY_ROOT/lib/java_utils.sh" +source "$BASH_BUDDY_ROOT/lib/maven_utils.sh" ################################################################################ # ci build logic @@ -18,10 +19,8 @@ readonly JDK_VERSIONS=( 8 $default_build_jdk_version 17 - 20 21 ) -readonly default_jh_var_name="JAVA${default_build_jdk_version}_HOME" # here use `install` and `-D performRelease` intended # to check release operations. @@ -30,8 +29,8 @@ readonly default_jh_var_name="JAVA${default_build_jdk_version}_HOME" # https://stackoverflow.com/questions/25201430 # # shellcheck disable=SC2034 -readonly 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}} ) @@ -42,42 +41,35 @@ cd .. # build and test by default version jdk ######################################## -[ -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}" +jvu::switch_to_jdk "$default_build_jdk_version" cu::head_line_echo "build and test with Java $default_build_jdk_version: $JAVA_HOME" -jvb::mvn_cmd clean install +mvu::mvn_cmd clean install ######################################## # test by multiply version jdks ######################################## +# 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 + 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}" + jvu::switch_to_jdk "$jdk_version" # just test without build 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 + # skip default jdk, already tested above + if [ "$jdk_version" != "$default_build_jdk_version" ]; then + mvu::mvn_cmd ${CI_MORE_BEGIN_OPTS:-} surefire:test ${CI_MORE_END_OPTS:-} fi + # Test for slf4j v1 + mvu::mvn_cmd ${CI_MORE_BEGIN_OPTS:-} -P enable-slf4j-v1 dependency:tree surefire:test ${CI_MORE_END_OPTS:-} + ( cd auto-pipeline-examples cu::log_then_run ./gradlew clean test