Skip to content

Commit

Permalink
test: add test-os.yml for OS (#6081)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 authored Dec 9, 2023
1 parent bdfed8d commit 8984880
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 100 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,27 @@ jobs:
# step 3
- name: "Print maven version"
run: ./mvnw -version
# step 4
- name: "Build with Maven"
# step 4.1
- name: "Test, Check style, Check license with Maven and Java8"
if: matrix.java == '8'
run: |
./mvnw -T 4C clean test \
-Dcheckstyle.skip=false -Dlicense.skip=false \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
# step 4.2
- name: "Test with Maven and Java${{ matrix.java }}"
if: matrix.java != '8'
run: |
if [ "${{ matrix.java }}" == "8" ]; then
./mvnw -T 4C clean test -Dcheckstyle.skip=false -Dlicense.skip=false -Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
elif [ "${{ matrix.java }}" == "17" ]; then
./mvnw -T 4C clean test -Dcheckstyle.skip=true -Dlicense.skip=true -Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
fi
./mvnw -T 4C clean test \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
# step 5
- name: "Codecov"
if: matrix.java == '8'
uses: codecov/[email protected]

# job 2: Test on 'arm64v8/ubuntu' OS.
# job 2: Build on 'arm64v8/ubuntu' OS (Skip tests).
build_arm64-binary:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && (github.ref_name == 'develop' || github.ref_name == 'snapshot' || github.ref_name == '2.x') }}
Expand All @@ -56,11 +63,15 @@ jobs:
id: qemu
uses: docker/setup-qemu-action@v3
# step 3
- name: "Build arm-binary"
- name: "Build with Maven on 'arm64v8/ubuntu:20.04' OS (Skip tests)"
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
arm64v8/ubuntu:20.04 \
bash -exc 'apt-get update -y && \
apt-get install maven -y && \
mvn -version && \
mvn -Prelease-seata -DskipTests -Dmaven.git-commit-id.skip=true clean install -U'
mvn clean install \
-Prelease-seata \
-DskipTests \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
15 changes: 7 additions & 8 deletions .github/workflows/test-druid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [ 8, 11, 17, 21 ]
druid: [
1.2.20,
1.2.19,
#1.2.18, # Unit test triggered a bug in Druid, see the commit https://github.com/alibaba/druid/commit/6c493f852852fb287ed5fd31ee16c27ead0ea5cf
#1.2.17, # Unit test triggered a bug in Druid, see the commit https://github.com/alibaba/druid/commit/6c493f852852fb287ed5fd31ee16c27ead0ea5cf
Expand Down Expand Up @@ -50,15 +50,14 @@ jobs:
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
java-version: 8
# step 3
- name: "Print maven version"
run: ./mvnw -version
# step 4
- name: "Test with Maven"
- name: "Test with Maven and Druid ${{ matrix.druid }}"
run: |
if [ "${{ matrix.java }}" == "8" ]; then
./mvnw -T 4C clean test -Ddruid.version=${{ matrix.druid }} -Dcheckstyle.skip=false -Dlicense.skip=false -Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
./mvnw -T 4C clean test -Ddruid.version=${{ matrix.druid }} -Dcheckstyle.skip=true -Dlicense.skip=true -Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
fi
./mvnw -T 4C clean test \
-Ddruid.version=${{ matrix.druid }} \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
117 changes: 66 additions & 51 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@ jobs:
# job 1
test:
name: "test"
runs-on: ubuntu-latest
runs-on: "${{ matrix.os }}-latest"
strategy:
fail-fast: false
matrix:
java: [ 8, 11, 17, 21 ]
os: [
ubuntu,
macos,
windows, # Skip tests, because too many errors in unit-test.
]
springboot: [
2.7.16 -Dspring-framework.version=5.3.30,
2.6.15 -Dspring-framework.version=5.3.27,
2.5.15 -Dspring-framework.version=5.3.27,
2.4.13 -Dspring-framework.version=5.3.13,
2.3.12.RELEASE -Dspring-framework.version=5.2.15.RELEASE,
2.2.13.RELEASE -Dspring-framework.version=5.2.12.RELEASE,
2.7.18 -D spring-framework.version=5.3.31,
2.6.15 -D spring-framework.version=5.3.27,
2.5.15 -D spring-framework.version=5.3.27,
2.4.13 -D spring-framework.version=5.3.13,
2.3.12.RELEASE -D spring-framework.version=5.2.15.RELEASE,
2.2.13.RELEASE -D spring-framework.version=5.2.12.RELEASE,
#2.1.18.RELEASE,
#2.0.9.RELEASE,
#1.5.22.RELEASE,
#1.4.7.RELEASE,
#1.3.8.RELEASE,
#1.2.8.RELEASE,
#1.1.12.RELEASE,
#1.0.2.RELEASE
]
steps:
# step 1
Expand All @@ -40,29 +39,40 @@ jobs:
distribution: 'zulu'
java-version: ${{ matrix.java }}
# step 3
- name: "Print maven version"
run: ./mvnw -version
# step 4
- name: "Test with Maven"
# https://docs.github.com/cn/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context
## step 3.1: for Ubuntu and MacOS
- name: "Test with Maven on '${{ matrix.os }}' OS"
if: matrix.os != 'windows'
run: |
if [ "${{ matrix.java }}" == "8" ]; then
./mvnw -T 4C clean test -P args-for-client-test -Dspring-boot.version=${{ matrix.springboot }} -Dcheckstyle.skip=false -Dlicense.skip=false -Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
./mvnw -T 4C clean test -P args-for-client-test -Dspring-boot.version=${{ matrix.springboot }} -Dcheckstyle.skip=true -Dlicense.skip=true -Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
fi
./mvnw -version;
./mvnw -T 4C clean test \
-P args-for-client-test \
-Dspring-boot.version=${{ matrix.springboot }} \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
## step 3.2: for Windows
- name: "Build with Maven on 'windows' OS (Skip tests)"
if: matrix.os == 'windows'
run: | # Skip tests, because too many errors in unit-test.
./mvnw.cmd -version;
./mvnw.cmd clean install -P args-for-client-test -DskipTests -D spring-boot.version=${{ matrix.springboot }} -D maven.git-commit-id.skip=true -e -B -D org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
# job 2
test-springboot3x:
name: "test-springboot3.x"
runs-on: ubuntu-latest
runs-on: "${{ matrix.os }}-latest"
strategy:
fail-fast: false
matrix:
java: [ 17, 21 ]
os: [
ubuntu,
macos,
windows, # Skip tests, because too many errors in unit-test.
]
springboot: [
3.1.4 -Dspring-framework.version=6.0.12,
3.0.11 -Dspring-framework.version=6.0.12,
3.2.0 -D spring-framework.version=6.1.1,
3.1.6 -D spring-framework.version=6.0.14,
3.0.13 -D spring-framework.version=6.0.14,
]
steps:
# step 1
Expand All @@ -75,34 +85,39 @@ jobs:
distribution: 'zulu'
java-version: ${{ matrix.java }}
# step 3
- name: "Print maven version"
run: ./mvnw -version
# step 4
- name: "Test with Maven"
## step 3.1: for Ubuntu and MacOS
- name: "Test with Maven on '${{ matrix.os }}' OS"
if: matrix.os != 'windows'
run: |
./mvnw -T 4C clean test -P args-for-client-test -Dspring-boot.version=${{ matrix.springboot }} -Dkotlin-maven-plugin.version=1.7.22 -Dcheckstyle.skip=true -Dlicense.skip=true -Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
./mvnw -version;
./mvnw -T 4C clean install \
-P args-for-client-test \
-Dspring-boot.version=${{ matrix.springboot }} \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
## step 3.2: for Windows
- name: "Build with Maven on 'windows' OS (Skip tests)"
if: matrix.os == 'windows'
run: | # Skip tests, because too many errors in unit-test.
./mvnw.cmd -version;
./mvnw.cmd clean install -P args-for-client-test -DskipTests -D spring-boot.version=${{ matrix.springboot }} -D maven.git-commit-id.skip=true -e -B -D org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
# job 3
arm64-test:
test-arm64:
name: "test-arm64"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
springboot: [
2.7.16 -Dspring-framework.version=5.3.30,
2.6.15 -Dspring-framework.version=5.3.27,
2.5.15 -Dspring-framework.version=5.3.27,
#2.7.18 -Dspring-framework.version=5.3.31, # The maven-compiler-plugin will throw an error for an unknown reason.
#2.6.15 -Dspring-framework.version=5.3.27, # The maven-compiler-plugin will throw an error for an unknown reason.
#2.5.15 -Dspring-framework.version=5.3.27, # The maven-compiler-plugin will throw an error for an unknown reason.
2.4.13 -Dspring-framework.version=5.3.13,
2.3.12.RELEASE -Dspring-framework.version=5.2.15.RELEASE,
2.2.13.RELEASE -Dspring-framework.version=5.2.12.RELEASE,
#2.1.18.RELEASE,
#2.0.9.RELEASE,
#1.5.22.RELEASE,
#1.4.7.RELEASE,
#1.3.8.RELEASE,
#1.2.8.RELEASE,
#1.1.12.RELEASE,
#1.0.2.RELEASE
]
steps:
# step 1
Expand All @@ -111,18 +126,18 @@ jobs:
# step 2
- name: "Set up QEMU"
id: qemu
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
# step 3
- name: "install"
- name: "Build with Maven on 'arm64v8/ubuntu:20.04' OS (Skip tests)"
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
arm64v8/ubuntu:20.04 \
bash -exc 'apt-get update -y && \
apt-get install maven -y'
# step 4
- name: "Print maven version"
run: ./mvnw -version
# step 5
- name: "test-arm64"
run: |
./mvnw -T 4C clean test -P args-for-client-test -Dspring-boot.version=${{ matrix.springboot }} -Dcheckstyle.skip=true -Dlicense.skip=true -Dmaven.git-commit-id.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
apt-get install maven -y && \
mvn -version && \
mvn -T 4C clean install \
-Dspring-boot.version=${{ matrix.springboot }} \
-Prelease-seata \
-DskipTests \
-Dmaven.git-commit-id.skip=true \
-e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
4 changes: 3 additions & 1 deletion build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<!-- Compiler -->
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
<kotlin-maven-plugin.version>1.3.72</kotlin-maven-plugin.version>
<kotlin-maven-plugin.version>1.9.21</kotlin-maven-plugin.version>
<!-- Check -->
<maven-pmd-plugin.version>3.8</maven-pmd-plugin.version>
<p3c-pmd.version>1.3.6</p3c-pmd.version>
Expand Down Expand Up @@ -431,6 +431,8 @@

--add-opens java.sql/java.sql=ALL-UNNAMED
--add-opens java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED

-Dnet.bytebuddy.experimental=true
</maven.surefire.argLine>
</properties>
</profile>
Expand Down
1 change: 1 addition & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6069](https://github.com/seata/seata/pull/6069)] Upgrade Guava dependencies to fix security vulnerabilities

### test:
- [[#6081](https://github.com/seata/seata/pull/6081)] add `test-os.yml` for testing the OS
- [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] A brief and accurate description of PR
- [[#6125](https://github.com/seata/seata/pull/6125)] unbind xid in TransactionTemplateTest

Expand Down
2 changes: 1 addition & 1 deletion changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- [[#6069](https://github.com/seata/seata/pull/6069)] 升级Guava依赖版本,修复安全漏洞

### test:
- [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] 准确简要的PR描述
- [[#6081](https://github.com/seata/seata/pull/6081)] 添加 `test-os.yml` 用于测试seata在各种操作系统下的运行情况
- [[#6125](https://github.com/seata/seata/pull/6125)] TransactionTemplateTest单测unbind xid

非常感谢以下 contributors 的代码贡献。若有无意遗漏,请报告。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ protected String loadBalance(String transactionServiceGroup, Object msg) {
RegistryFactory.getInstance().aliveLookup(transactionServiceGroup);
address = this.doSelect(inetSocketAddressList, msg);
} catch (Exception ex) {
LOGGER.error(ex.getMessage());
LOGGER.error("Select the address failed: {}", ex.getMessage());
}
if (address == null) {
throw new FrameworkException(NoAvailableService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,54 @@ private static String[] getDenyClassPatternList() {
}

private static Set<Class<?>> getProtocolType() {
Enumeration<URL> packageDir = null;
String packageName = "io.seata.core.protocol";
Set<Class<?>> classNameSet = new HashSet<>();

try {
packageDir = Thread.currentThread().getContextClassLoader().getResources(packageName.replace(".", "/"));
String packageName = "io.seata.core.protocol";
Enumeration<URL> packageDir = Thread.currentThread().getContextClassLoader().getResources(packageName.replace(".", "/"));
while (packageDir.hasMoreElements()) {
String filePath = packageDir.nextElement().getFile();
findProtocolClassByPackage(filePath, packageName, classNameSet);
}
} catch (IOException ignore) {
}
while (packageDir.hasMoreElements()) {
String filePath = packageDir.nextElement().getFile();
findProtocolClassByPackage(filePath, packageName, classNameSet);

if (classNameSet.size() < 30) {
// package io.seata.core.protocol
classNameSet.add(io.seata.core.protocol.BatchResultMessage.class);
classNameSet.add(io.seata.core.protocol.HeartbeatMessage.class);
classNameSet.add(io.seata.core.protocol.MergedWarpMessage.class);
classNameSet.add(io.seata.core.protocol.MergeResultMessage.class);
classNameSet.add(io.seata.core.protocol.RegisterRMRequest.class);
classNameSet.add(io.seata.core.protocol.RegisterRMResponse.class);
classNameSet.add(io.seata.core.protocol.RegisterTMRequest.class);
classNameSet.add(io.seata.core.protocol.RegisterTMResponse.class);
classNameSet.add(io.seata.core.protocol.RpcMessage.class);

// package io.seata.core.protocol.transaction
classNameSet.add(io.seata.core.protocol.transaction.BranchCommitRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.BranchCommitResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.BranchRegisterRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.BranchRegisterResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.BranchReportRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.BranchReportResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.BranchRollbackRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.BranchRollbackResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalBeginRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalBeginResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalCommitRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalCommitResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalLockQueryResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalLockQueryRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalReportRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalReportResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalRollbackRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalRollbackResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalStatusRequest.class);
classNameSet.add(io.seata.core.protocol.transaction.GlobalStatusResponse.class);
classNameSet.add(io.seata.core.protocol.transaction.UndoLogDeleteRequest.class);
}

return classNameSet;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public List<InetSocketAddress> lookup(String key) throws Exception {
for (String endpoint : endpoints) {
String[] ipAndPort = NetUtil.splitIPPortStr(endpoint);
if (ipAndPort.length != 2) {
throw new IllegalArgumentException("endpoint format should like ip:port");
throw new IllegalArgumentException("endpoint format should like ip:port, the invalid endpoint: " + endpoint);
}
inetSocketAddresses.add(new InetSocketAddress(ipAndPort[0], Integer.parseInt(ipAndPort[1])));
}
Expand Down
Loading

0 comments on commit 8984880

Please sign in to comment.