Skip to content

lvjing2 pushed code #123

lvjing2 pushed code

lvjing2 pushed code #123

name: Koupleless Samples Formatter and Test
run-name: ${{ github.actor }} pushed code
on:
push:
branches:
- main
- runtime-2.0.x
- runtime-2.1.x
pull_request:
branches:
- main
- runtime-2.0.x
- runtime-2.1.x
# enable manually running the workflow
workflow_dispatch:
jobs:
unit-test-for-springboot-samples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 8
cache: maven
- name: Install SDKMAN
run: |
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
# 使用 SDKMAN 安装需要的所有 JDK 版本
- name: Install JDKs with SDKMAN
run: |
source "$HOME/.sdkman/bin/sdkman-init.sh"
yes | sdk install java 8.0.412-tem -y
yes | sdk install java 11.0.23-tem -y
yes | sdk install java 17.0.11-tem -y
sdk list java
- name: Update Maven version to 3.9.x to enable cross bundle without install
env:
MAVEN_VERSION: '3.9.5'
run: |
wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
tar xzvf apache-maven-${MAVEN_VERSION}-bin.tar.gz
echo "MAVEN_HOME=$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}/bin" >> $GITHUB_PATH
- name: Find Maven modules
id: find-maven-modules
run: |
echo "Finding Maven Modules"
# 定位 pom.xml 文件,通过 grep 排除掉根目录下的 pom.xml
modules=$(find . -name pom.xml -maxdepth 2 -not -path "./pom.xml" -exec dirname {} \;)
echo "$modules"
# 使用 jq 将 shell 数组转换成 JSON 数组供后续步骤使用
modules_in_json=$(echo $modules | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "$modules_in_json"
echo "modules-list=$modules_in_json" >> $GITHUB_OUTPUT
- name: Install newest adapter for modules
id: get-jdk-versions
run: |
# 创建一个映射来存储模块名到 JDK 版本的映射
source "$HOME/.sdkman/bin/sdkman-init.sh"
declare -A jdk_installed_map=(["1.8"]="8.0.412-tem" ["11"]="11.0.23-tem" ["17"]="17.0.11-tem")
modules=(${{ join(fromJSON(steps.find-maven-modules.outputs.modules-list), ' ') }})
for module in "${modules[@]}"; do
# 读取模块中的 pom.xml 来确定 JDK 版本
jdk_version=$(grep -m 1 '<java.version>' $module/pom.xml | sed 's/<[^>]*>//g' | xargs)
echo "${module} JDK version: ${jdk_version}"
# 将模块与其 JDK 版本添加到映射中
sdk use java ${jdk_installed_map[$jdk_version]}
mvn clean install -pl $module -am -amd -Dmaven.javadoc.skip=true -B -U
echo "Tests completed for module $module"
done
- name: Check code formatter
run: sh ./check_format.sh
- name: Checkout Samples Repository
uses: actions/checkout@v3
with:
repository: 'koupleless/samples'
path: 'samples'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Test for springboot samples
run: mvn clean install -DskipTests -Dmaven.javadoc.skip=true -am -B -U
working-directory: samples/springboot-samples/
unit-test-for-sofaboot-samples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 8
cache: maven
- name: Install SDKMAN
run: |
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
# 使用 SDKMAN 安装需要的所有 JDK 版本
- name: Install JDKs with SDKMAN
run: |
source "$HOME/.sdkman/bin/sdkman-init.sh"
yes | sdk install java 8.0.412-tem -y
yes | sdk install java 11.0.23-tem -y
yes | sdk install java 17.0.11-tem -y
sdk list java
- name: Update Maven version to 3.9.x to enable cross bundle without install
env:
MAVEN_VERSION: '3.9.5'
run: |
wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
tar xzvf apache-maven-${MAVEN_VERSION}-bin.tar.gz
echo "MAVEN_HOME=$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}/bin" >> $GITHUB_PATH
- name: Find Maven modules
id: find-maven-modules
run: |
echo "Finding Maven Modules"
# 定位 pom.xml 文件,通过 grep 排除掉根目录下的 pom.xml
modules=$(find . -name pom.xml -maxdepth 2 -not -path "./pom.xml" -exec dirname {} \;)
echo "$modules"
# 使用 jq 将 shell 数组转换成 JSON 数组供后续步骤使用
modules_in_json=$(echo $modules | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "$modules_in_json"
echo "modules-list=$modules_in_json" >> $GITHUB_OUTPUT
- name: Install newest adapter for modules
id: get-jdk-versions
run: |
# 创建一个映射来存储模块名到 JDK 版本的映射
source "$HOME/.sdkman/bin/sdkman-init.sh"
declare -A jdk_installed_map=(["1.8"]="8.0.412-tem" ["11"]="11.0.23-tem" ["17"]="17.0.11-tem")
modules=(${{ join(fromJSON(steps.find-maven-modules.outputs.modules-list), ' ') }})
for module in "${modules[@]}"; do
# 读取模块中的 pom.xml 来确定 JDK 版本
jdk_version=$(grep -m 1 '<java.version>' $module/pom.xml | sed 's/<[^>]*>//g' | xargs)
echo "${module} JDK version: ${jdk_version}"
# 将模块与其 JDK 版本添加到映射中
sdk use java ${jdk_installed_map[$jdk_version]}
mvn clean install -pl $module -am -amd -Dmaven.javadoc.skip=true -B -U
echo "Tests completed for module $module"
done
- name: Check code formatter
run: sh ./check_format.sh
- name: Checkout Samples Repository
uses: actions/checkout@v3
with:
repository: 'koupleless/samples'
path: 'samples'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Test for sofaboot samples
run: mvn clean install -DskipTests -Dmaven.javadoc.skip=true -am -B -U
working-directory: samples/sofaboot-samples
unit-test-for-dubbo-samples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 8
cache: maven
- name: Install SDKMAN
run: |
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
# 使用 SDKMAN 安装需要的所有 JDK 版本
- name: Install JDKs with SDKMAN
run: |
source "$HOME/.sdkman/bin/sdkman-init.sh"
yes | sdk install java 8.0.412-tem -y
yes | sdk install java 11.0.23-tem -y
yes | sdk install java 17.0.11-tem -y
sdk list java
- name: Update Maven version to 3.9.x to enable cross bundle without install
env:
MAVEN_VERSION: '3.9.5'
run: |
wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
tar xzvf apache-maven-${MAVEN_VERSION}-bin.tar.gz
echo "MAVEN_HOME=$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}/bin" >> $GITHUB_PATH
- name: Find Maven modules
id: find-maven-modules
run: |
echo "Finding Maven Modules"
# 定位 pom.xml 文件,通过 grep 排除掉根目录下的 pom.xml
modules=$(find . -name pom.xml -maxdepth 2 -not -path "./pom.xml" -exec dirname {} \;)
echo "$modules"
# 使用 jq 将 shell 数组转换成 JSON 数组供后续步骤使用
modules_in_json=$(echo $modules | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "$modules_in_json"
echo "modules-list=$modules_in_json" >> $GITHUB_OUTPUT
- name: Install newest adapter for modules
id: get-jdk-versions
run: |
# 创建一个映射来存储模块名到 JDK 版本的映射
source "$HOME/.sdkman/bin/sdkman-init.sh"
declare -A jdk_installed_map=(["1.8"]="8.0.412-tem" ["11"]="11.0.23-tem" ["17"]="17.0.11-tem")
modules=(${{ join(fromJSON(steps.find-maven-modules.outputs.modules-list), ' ') }})
for module in "${modules[@]}"; do
# 读取模块中的 pom.xml 来确定 JDK 版本
jdk_version=$(grep -m 1 '<java.version>' $module/pom.xml | sed 's/<[^>]*>//g' | xargs)
echo "${module} JDK version: ${jdk_version}"
# 将模块与其 JDK 版本添加到映射中
sdk use java ${jdk_installed_map[$jdk_version]}
mvn clean install -pl $module -am -amd -Dmaven.javadoc.skip=true -B -U
echo "Tests completed for module $module"
done
- name: Check code formatter
run: sh ./check_format.sh
- name: Checkout Samples Repository
uses: actions/checkout@v3
with:
repository: 'koupleless/samples'
path: 'samples'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Test for dubbo samples
run: mvn clean install -DskipTests -Dmaven.javadoc.skip=true -am -B -U
working-directory: samples/dubbo-samples
unit-test-for-dubbo32-samples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
cache: maven
- name: Install SDKMAN
run: |
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
# 使用 SDKMAN 安装需要的所有 JDK 版本
- name: Install JDKs with SDKMAN
run: |
source "$HOME/.sdkman/bin/sdkman-init.sh"
yes | sdk install java 8.0.412-tem -y
yes | sdk install java 11.0.23-tem -y
yes | sdk install java 17.0.11-tem -y
sdk list java
- name: Update Maven version to 3.9.x to enable cross bundle without install
env:
MAVEN_VERSION: '3.9.5'
run: |
wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
tar xzvf apache-maven-${MAVEN_VERSION}-bin.tar.gz
echo "MAVEN_HOME=$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}/bin" >> $GITHUB_PATH
- name: Find Maven modules
id: find-maven-modules
run: |
echo "Finding Maven Modules"
# 定位 pom.xml 文件,通过 grep 排除掉根目录下的 pom.xml
modules=$(find . -name pom.xml -maxdepth 2 -not -path "./pom.xml" -exec dirname {} \;)
echo "$modules"
# 使用 jq 将 shell 数组转换成 JSON 数组供后续步骤使用
modules_in_json=$(echo $modules | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "$modules_in_json"
echo "modules-list=$modules_in_json" >> $GITHUB_OUTPUT
- name: Install newest adapter for modules
id: get-jdk-versions
run: |
# 创建一个映射来存储模块名到 JDK 版本的映射
source "$HOME/.sdkman/bin/sdkman-init.sh"
declare -A jdk_installed_map=(["1.8"]="8.0.412-tem" ["11"]="11.0.23-tem" ["17"]="17.0.11-tem")
modules=(${{ join(fromJSON(steps.find-maven-modules.outputs.modules-list), ' ') }})
for module in "${modules[@]}"; do
# 读取模块中的 pom.xml 来确定 JDK 版本
jdk_version=$(grep -m 1 '<java.version>' $module/pom.xml | sed 's/<[^>]*>//g' | xargs)
echo "${module} JDK version: ${jdk_version}"
# 将模块与其 JDK 版本添加到映射中
sdk use java ${jdk_installed_map[$jdk_version]}
mvn clean install -pl $module -am -amd -Dmaven.javadoc.skip=true -B -U
echo "Tests completed for module $module"
done
- name: Check code formatter
run: sh ./check_format.sh
- name: Checkout Samples Repository
uses: actions/checkout@v3
with:
repository: 'koupleless/samples'
path: 'samples'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Test for dubbo32 samples
run: mvn clean install -DskipTests -Dmaven.javadoc.skip=true -am -B -U
working-directory: samples/dubbo32-samples
unit-test-for-springboot3-samples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
cache: maven
- name: Install SDKMAN
run: |
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
# 使用 SDKMAN 安装需要的所有 JDK 版本
- name: Install JDKs with SDKMAN
run: |
source "$HOME/.sdkman/bin/sdkman-init.sh"
yes | sdk install java 8.0.412-tem -y
yes | sdk install java 11.0.23-tem -y
yes | sdk install java 17.0.11-tem -y
sdk list java
- name: Update Maven version to 3.9.x to enable cross bundle without install
env:
MAVEN_VERSION: '3.9.5'
run: |
wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
tar xzvf apache-maven-${MAVEN_VERSION}-bin.tar.gz
echo "MAVEN_HOME=$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}/bin" >> $GITHUB_PATH
- name: Find Maven modules
id: find-maven-modules
run: |
echo "Finding Maven Modules"
# 定位 pom.xml 文件,通过 grep 排除掉根目录下的 pom.xml
modules=$(find . -name pom.xml -maxdepth 2 -not -path "./pom.xml" -exec dirname {} \;)
echo "$modules"
# 使用 jq 将 shell 数组转换成 JSON 数组供后续步骤使用
modules_in_json=$(echo $modules | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "$modules_in_json"
echo "modules-list=$modules_in_json" >> $GITHUB_OUTPUT
- name: Install newest adapter for modules
id: get-jdk-versions
run: |
# 创建一个映射来存储模块名到 JDK 版本的映射
source "$HOME/.sdkman/bin/sdkman-init.sh"
declare -A jdk_installed_map=(["1.8"]="8.0.412-tem" ["11"]="11.0.23-tem" ["17"]="17.0.11-tem")
modules=(${{ join(fromJSON(steps.find-maven-modules.outputs.modules-list), ' ') }})
for module in "${modules[@]}"; do
# 读取模块中的 pom.xml 来确定 JDK 版本
jdk_version=$(grep -m 1 '<java.version>' $module/pom.xml | sed 's/<[^>]*>//g' | xargs)
echo "${module} JDK version: ${jdk_version}"
# 将模块与其 JDK 版本添加到映射中
sdk use java ${jdk_installed_map[$jdk_version]}
mvn clean install -pl $module -am -amd -Dmaven.javadoc.skip=true -B -U
echo "Tests completed for module $module"
done
- name: Check code formatter
run: sh ./check_format.sh
- name: Checkout Samples Repository
uses: actions/checkout@v3
with:
repository: 'koupleless/samples'
path: 'samples'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Test for springboot3 samples
run: mvn clean install -DskipTests -Dmaven.javadoc.skip=true -am -B -U
working-directory: samples/springboot3-samples