Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f97df87
尝试集成CI/CD进行测试
xiaoyumuxi Jan 20, 2026
01dcf07
移除了对python客户端环境的requirement.txt的校验
xiaoyumuxi Jan 20, 2026
694f1b2
docs: improve CI/CD section in README and fix workflow cache
xiaoyumuxi Jan 20, 2026
4e44fd1
修改README.md文件,增加CI/CD内容描述
xiaoyumuxi Jan 20, 2026
90b327d
将测试文件改成使用Juint来写同时修改CI/CD流程
xiaoyumuxi Jan 23, 2026
f0da3bf
fix了common模块运行测试错误的情况
xiaoyumuxi Jan 23, 2026
60621e9
README: add test
xiaoyumuxi Jan 23, 2026
ef42aad
README:修改结构,更美观
xiaoyumuxi Jan 23, 2026
8834cf2
解耦传输层,减少对Netty的依赖,使用SPI封装,仅需要实现Transport, TransportServer, TransportC…
xiaoyumuxi Jan 23, 2026
21de409
完全解耦传输层,将core完全剔除和Netty的强绑定关系
xiaoyumuxi Jan 23, 2026
93e491d
README:添加有关SPI的部分说明
xiaoyumuxi Jan 23, 2026
35b674d
README-ZH更新,方便阅读
xiaoyumuxi Jan 23, 2026
67239a2
README:更新了FAQ部分内容
xiaoyumuxi Jan 23, 2026
36ae6c6
SpringBoot:引入了rpc-spring-boot-starter模块,用于自动与Spring Boot集成RPC功能
xiaoyumuxi Jan 23, 2026
29f89ad
JMH: 新增 rpc-benchmark 模块并优化 Kryo 序列化器以提高 Protobuf 性能和资源复用,然后进行了JMH性能测试
xiaoyumuxi Jan 29, 2026
3fa0d0f
fix:多路复用重构和异步优化
xiaoyumuxi Jan 29, 2026
ef72b27
README:更新readme
xiaoyumuxi Jan 29, 2026
5b7f27b
feat:引入go的客户端
xiaoyumuxi Feb 1, 2026
154a21a
fix:ByteBuddyProxyFactory创建RpcClient的时候进行复用,减小了对象反复进行分配(尤其是在高频的RPC场景下)
xiaoyumuxi Feb 3, 2026
6b5202f
feat: 引入最大报文长度配置,防御恶意报文
xiaoyumuxi Feb 3, 2026
d726c31
feat: 将 RPC 请求处理改为异步 CompletableFuture 模式
xiaoyumuxi Feb 3, 2026
41d313b
feat:引入shutdownGracefully()来进行优雅下线,保护存量任务执行完毕
xiaoyumuxi Feb 3, 2026
e1970bc
feat:Nacos的防抖——获取失败临时使用本地缓存的列表顶一下
xiaoyumuxi Feb 3, 2026
aa8a1dd
使用AI辅助修改单元测试(边界条件更新)
xiaoyumuxi Feb 12, 2026
d9d658f
添加测试类进行边界条件的测试
xiaoyumuxi Feb 12, 2026
480d8e1
对Go客户端也提供CI/CD测试流程
xiaoyumuxi Feb 12, 2026
4dbb690
更新readme
xiaoyumuxi Feb 12, 2026
7b03e8f
更新readme
xiaoyumuxi Feb 12, 2026
b78d811
忘记配置原来的是grpc模式了
xiaoyumuxi Feb 12, 2026
0fc42e6
给Java的客户端也添加了gRPC模式,删除了之前的gRPC仅仅支持跨语言客户端的设计
xiaoyumuxi Feb 12, 2026
713da75
修改对应CI/CD的逻辑判断
xiaoyumuxi Feb 12, 2026
20e78b2
将CI/CD改成并行运行
xiaoyumuxi Feb 12, 2026
635e0c0
修bug
xiaoyumuxi Feb 12, 2026
4808fe5
修bug
xiaoyumuxi Feb 12, 2026
3e98561
修bug
xiaoyumuxi Feb 12, 2026
248a97f
更新日志级别
xiaoyumuxi Feb 12, 2026
554dc6e
修复CD流水线bug
xiaoyumuxi Feb 12, 2026
31e55d5
更新readme
xiaoyumuxi Feb 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 232 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
name: Java CI with Maven, Nacos, and Python

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
unit-tests:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Run Maven Tests
run: |
set -euo pipefail
mvn -B -ntp clean test

- name: Upload Surefire Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: surefire-reports
path: |
**/target/surefire-reports/*.txt
**/target/surefire-reports/*.xml

go-client-check:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go_client/go.mod
cache-dependency-path: go_client/go.sum

- name: Verify Go Client Build
working-directory: go_client
run: |
set -euo pipefail
go mod download
go test ./...
go build -o /tmp/go-rpc-client main.go

integration-test:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [unit-tests, go-client-check]

services:
nacos:
image: nacos/nacos-server:v2.2.3
env:
MODE: standalone
AUTH_ENABLE: false
ports:
- 8848:8848
- 9848:9848
# Wait for Nacos to be fully ready
options: >-
--name nacos-server
--health-cmd "curl -f http://localhost:8848/nacos/v1/console/health/readiness"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go_client/go.mod
cache-dependency-path: go_client/go.sum

- name: Install Python Dependencies
run: |
set -euo pipefail
python -m pip install --upgrade pip
pip install grpcio grpcio-tools protobuf

- name: Build Jars For Integration Test
run: |
set -euo pipefail
mvn -B -ntp -DskipTests clean package

- name: Wait For Nacos Ports
run: |
set -euo pipefail
echo "Waiting for Nacos HTTP API on 8848..."
timeout 60s bash -c 'until curl -sf http://localhost:8848/nacos/v1/console/health/readiness > /dev/null; do sleep 1; done'
echo "Waiting for Nacos gRPC port on 9848..."
timeout 60s bash -c 'until echo > /dev/tcp/localhost/9848; do sleep 1; done'
echo "Nacos 8848/9848 are both reachable."

- name: Start RPC Provider (Java Server)
run: |
set -euo pipefail
# Build classpath including project jars and dependencies
CLASSPATH="rpc-provider/target/rpc-provider-1.0-SNAPSHOT.jar:rpc-transport-netty/target/rpc-transport-netty-1.0-SNAPSHOT.jar:rpc-core/target/rpc-core-1.0-SNAPSHOT.jar:rpc-common/target/rpc-common-1.0-SNAPSHOT.jar:rpc-api/target/rpc-api-1.0-SNAPSHOT.jar:$(mvn -q dependency:build-classpath -Dmdep.outputFile=/dev/stdout -pl rpc-provider -am)"

echo "Starting Java Server..."
echo "Provider protocol override: rpc.protocol=grpc"
# Run in background with nohup
nohup java -Dlogback.configurationFile=rpc-core/src/main/resources/logback.xml -Drpc.protocol=grpc -cp "$CLASSPATH" com.xiaoyu.rpc.provider.ProviderApp > server.log 2>&1 &

# Wait for server port 8080 to be available
echo "Waiting for Java Server to start on port 8080..."
timeout 60s bash -c 'until echo > /dev/tcp/localhost/8080; do sleep 1; done'

echo "Java Server is running!"
# Optional: Print initial logs
head -n 20 server.log

- name: Wait For Service Registration In Nacos
run: |
set -euo pipefail
echo "Waiting for HelloService registration..."
if timeout 60s bash -c 'until grep -q "Service registered: com.xiaoyu.rpc.api.HelloService" server.log; do sleep 1; done'; then
echo "HelloService registration confirmed."
else
echo "Service registration wait timed out. Recent server logs:"
tail -n 120 server.log || true
exit 1
fi

- name: Run Multi-Client Chains In Parallel
run: |
set -euo pipefail
mkdir -p .ci-status

CLASSPATH="rpc-consumer/target/rpc-consumer-1.0-SNAPSHOT.jar:rpc-transport-netty/target/rpc-transport-netty-1.0-SNAPSHOT.jar:rpc-core/target/rpc-core-1.0-SNAPSHOT.jar:rpc-common/target/rpc-common-1.0-SNAPSHOT.jar:rpc-api/target/rpc-api-1.0-SNAPSHOT.jar:$(mvn -q dependency:build-classpath -Dmdep.outputFile=/dev/stdout -pl rpc-consumer -am)"

run_java() {
echo "Running Java Client (grpc)..."
if timeout 120s java -Dlogback.configurationFile=rpc-core/src/main/resources/logback.xml -Drpc.protocol=grpc -Drpc.serializer=protobuf -cp "$CLASSPATH" com.xiaoyu.rpc.consumer.ConsumerApp | tee java-client.log \
&& grep -q "Result1:" java-client.log \
&& grep -q "Result2:" java-client.log; then
echo "PASS" > .ci-status/java.status
else
echo "Java client chain failed or timed out."
echo "FAIL" > .ci-status/java.status
fi
}

run_python() {
echo "Running Python Client..."
if timeout 120s bash -c 'cd python_client && python client.py' | tee python-client.log \
&& grep -q "Message: Success" python-client.log; then
echo "PASS" > .ci-status/python.status
else
echo "Python client chain failed or timed out."
echo "FAIL" > .ci-status/python.status
fi
}

run_go() {
echo "Running Go Client..."
if timeout 120s bash -c 'cd go_client && go run main.go' | tee go-client.log \
&& grep -q "Message: Success" go-client.log; then
echo "PASS" > .ci-status/go.status
else
echo "Go client chain failed or timed out."
echo "FAIL" > .ci-status/go.status
fi
}

run_java &
PID_JAVA=$!
run_python &
PID_PY=$!
run_go &
PID_GO=$!

wait "${PID_JAVA}" || true
wait "${PID_PY}" || true
wait "${PID_GO}" || true

- name: Aggregate Multi-Client Results
run: |
set -euo pipefail
JAVA_RESULT=$(cat .ci-status/java.status 2>/dev/null || echo "FAIL")
PY_RESULT=$(cat .ci-status/python.status 2>/dev/null || echo "FAIL")
GO_RESULT=$(cat .ci-status/go.status 2>/dev/null || echo "FAIL")

echo "Multi-client chain summary:"
echo " Java : ${JAVA_RESULT}"
echo " Python : ${PY_RESULT}"
echo " Go : ${GO_RESULT}"

if [[ "${JAVA_RESULT}" != "PASS" || "${PY_RESULT}" != "PASS" || "${GO_RESULT}" != "PASS" ]]; then
echo "At least one client chain failed."
exit 1
fi
echo "All three client chains passed."

- name: Upload CI Logs
if: always()
uses: actions/upload-artifact@v4
with:
name: ci-logs
path: |
server.log
java-client.log
python-client.log
go-client.log
.ci-status/*.status
Loading
Loading