Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 52 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Benchmark

on:
workflow_dispatch:
schedule:
- cron: '0 18 * * 6'

permissions:
contents: read

concurrency:
group: benchmark-${{ github.ref }}
cancel-in-progress: true

jobs:
serialization-benchmark:
name: Serialization Benchmark
runs-on: ubuntu-24.04
timeout-minutes: 20

steps:
- name: Checkout code
uses: actions/checkout@v7

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

- name: Build benchmark module
run: mvn -B -ntp -pl rpc-benchmark -am clean package -DskipTests -Drpc.registry=local

- name: Run JMH serialization benchmark
run: >-
java -jar rpc-benchmark/target/benchmarks.jar
'.*SerializationBenchmark.*'
-f 1
-wi 1
-i 2
-rf json
-rff benchmark-results.json

- name: Upload benchmark result
if: always()
uses: actions/upload-artifact@v7
with:
name: serialization-benchmark
retention-days: 30
if-no-files-found: error
path: benchmark-results.json
88 changes: 69 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
name: CI/CD Pipeline
name: CI

on:
push:
branches: [ main, master, develop ]
branches: [ main ]
pull_request:
branches: [ main, master, develop ]
branches: [ main ]

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
build:
name: Build
runs-on: ubuntu-24.04
timeout-minutes: 10

steps:
- name: Checkout code
Expand All @@ -21,29 +30,43 @@ jobs:
distribution: 'temurin'
cache: 'maven'

- name: Build with Maven
run: mvn clean package -DskipTests
- name: Build all modules
run: mvn -B -ntp clean package -DskipTests -Drpc.registry=local

- name: Run unit tests
run: mvn test -pl rpc-core,rpc-transport-netty -am
unit-tests:
name: Unit Tests & Coverage
runs-on: ubuntu-24.04
timeout-minutes: 10

steps:
- name: Checkout code
uses: actions/checkout@v7

- name: Run integration tests
run: mvn test -pl rpc-consumer -am -Dtest=FullIntegrationTest
- name: Set up JDK 17
uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

- name: Check test coverage
run: mvn jacoco:report
- name: Run core and transport unit tests
run: mvn -B -ntp test -pl rpc-core,rpc-transport-netty -am -Drpc.registry=local

- name: Upload test results
- name: Upload unit test and coverage reports
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
name: unit-test-reports
retention-days: 7
if-no-files-found: warn
path: |
**/target/surefire-reports/
**/target/site/jacoco/

code-quality:
rpc-integration:
name: RPC Integration
runs-on: ubuntu-24.04
timeout-minutes: 10

steps:
- name: Checkout code
Expand All @@ -56,8 +79,35 @@ jobs:
distribution: 'temurin'
cache: 'maven'

- name: Run Maven verify
run: mvn verify -DskipTests
- name: Run local-registry Netty end-to-end test
run: >-
mvn -B -ntp test
-pl rpc-consumer -am
-Dtest=FullIntegrationTest
-Dsurefire.failIfNoSpecifiedTests=false
-Drpc.registry=local
-Drpc.protocol=netty

- name: Upload integration test reports
if: always()
uses: actions/upload-artifact@v7
with:
name: rpc-integration-reports
retention-days: 7
if-no-files-found: warn
path: '**/target/surefire-reports/'

ci-gate:
name: CI Gate
if: always()
needs: [ build, unit-tests, rpc-integration ]
runs-on: ubuntu-24.04
timeout-minutes: 2

- name: Check code style
run: mvn checkstyle:check || true
steps:
- name: Verify required checks
shell: bash
run: |
test "${{ needs.build.result }}" = "success"
test "${{ needs.unit-tests.result }}" = "success"
test "${{ needs.rpc-integration.result }}" = "success"
205 changes: 205 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
name: Extended Integration

on:
workflow_dispatch:
schedule:
- cron: '0 18 * * 0'

permissions:
contents: read

concurrency:
group: extended-integration-${{ github.ref }}
cancel-in-progress: false

jobs:
protocol-matrix:
name: Protocol - ${{ matrix.protocol }}
runs-on: ubuntu-24.04
timeout-minutes: 12
strategy:
fail-fast: false
matrix:
protocol: [ netty, http, http2, grpc ]

steps:
- name: Checkout code
uses: actions/checkout@v7

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

- name: Run end-to-end protocol test
run: >-
mvn -B -ntp test
-pl rpc-consumer -am
-Dtest=FullIntegrationTest
-Dsurefire.failIfNoSpecifiedTests=false
-Drpc.registry=local
-Drpc.protocol=${{ matrix.protocol }}

- name: Upload protocol test reports
if: always()
uses: actions/upload-artifact@v7
with:
name: protocol-${{ matrix.protocol }}-reports
retention-days: 7
if-no-files-found: warn
path: '**/target/surefire-reports/'

nacos-integration:
name: Nacos Integration
runs-on: ubuntu-24.04
timeout-minutes: 15

services:
nacos:
image: nacos/nacos-server:v2.5.4
env:
MODE: standalone
NACOS_AUTH_ENABLE: 'false'
JVM_XMS: 256m
JVM_XMX: 256m
JVM_XMN: 128m
ports:
- 8848:8848
- 9848:9848
- 9849:9849

steps:
- name: Checkout code
uses: actions/checkout@v7

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

- name: Wait for Nacos
shell: bash
run: |
for i in {1..60}; do
if curl -fsS http://127.0.0.1:8848/nacos/v1/console/health/readiness >/dev/null 2>&1; then
exit 0
fi
sleep 2
done
echo 'Nacos did not become ready in time'
docker ps -a
container_id=$(docker ps -aq --filter ancestor=nacos/nacos-server:v2.5.4 | head -1)
if [ -n "$container_id" ]; then
docker logs "$container_id" || true
fi
exit 1

- name: Run real Nacos registry integration test
run: >-
mvn -B -ntp test
-pl rpc-consumer -am
-Dtest=FullIntegrationTest
-Dsurefire.failIfNoSpecifiedTests=false
-Drpc.registry=nacos
-Drpc.registry-address=127.0.0.1:8848
-Drpc.protocol=netty

- name: Upload Nacos integration reports
if: always()
uses: actions/upload-artifact@v7
with:
name: nacos-integration-reports
retention-days: 7
if-no-files-found: warn
path: '**/target/surefire-reports/'

cross-language-grpc:
name: gRPC - Python & Go
runs-on: ubuntu-24.04
timeout-minutes: 20

steps:
- name: Checkout code
uses: actions/checkout@v7

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

- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.12'

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

- name: Install Java modules
run: mvn -B -ntp install -DskipTests -Drpc.registry=local

- name: Install Python gRPC runtime
run: python -m pip install grpcio==1.76.0 protobuf==6.31.1

- name: Start Java gRPC provider
shell: bash
run: |
nohup mvn -B -ntp -pl rpc-provider \
org.codehaus.mojo:exec-maven-plugin:3.5.0:java \
-Dexec.mainClass=com.xiaoyu.rpc.provider.ProviderApp \
-Drpc.registry=local \
-Drpc.protocol=grpc \
-Drpc.serializer=protobuf \
> provider.log 2>&1 &
echo $! > provider.pid

- name: Wait for Java provider
run: |
python - <<'PY'
import socket
import sys
import time

for _ in range(60):
try:
with socket.create_connection(('127.0.0.1', 8080), timeout=1):
sys.exit(0)
except OSError:
time.sleep(0.5)

print('Java gRPC provider did not become ready in time', file=sys.stderr)
sys.exit(1)
PY

- name: Run official Python gRPC client
run: python python_client/client.py

- name: Run Go gRPC client
working-directory: go_client
run: go run .

- name: Stop Java provider
if: always()
shell: bash
run: |
if [ -f provider.pid ]; then
kill "$(cat provider.pid)" 2>/dev/null || true
fi

- name: Upload provider log
if: always()
uses: actions/upload-artifact@v7
with:
name: cross-language-provider-log
retention-days: 7
if-no-files-found: warn
path: provider.log
Loading