Skip to content

Merge pull request #12 from xiaoyumuxi/ci/performance-md-history #35

Merge pull request #12 from xiaoyumuxi/ci/performance-md-history

Merge pull request #12 from xiaoyumuxi/ci/performance-md-history #35

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
paths-ignore:
- 'docs/PERFORMANCE.md'
pull_request:
branches: [ main ]
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-24.04
timeout-minutes: 10
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 all modules
run: mvn -B -ntp clean package -DskipTests -Drpc.registry=local
unit-tests:
name: Unit Tests & Coverage
runs-on: ubuntu-24.04
timeout-minutes: 10
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 core, transport and starter unit tests
run: >-
mvn -B -ntp test
-pl rpc-core,rpc-transport-netty,rpc-spring-boot-starter -am
-Drpc.registry=local
- name: Upload unit test and coverage reports
if: always()
uses: actions/upload-artifact@v7
with:
name: unit-test-reports
retention-days: 7
if-no-files-found: warn
path: |
**/target/surefire-reports/
**/target/site/jacoco/
rpc-integration:
name: RPC Integration
runs-on: ubuntu-24.04
timeout-minutes: 10
outputs:
performance_markdown: ${{ steps.performance-record.outputs.markdown }}
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 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
# Performance data is observational only. Hosted Runner variance makes absolute
# latency/QPS unsuitable as a merge threshold. PR CI validates the snapshot;
# successful main CI runs persist the result into docs/PERFORMANCE.md.
- name: Run RPC performance snapshot
run: >-
mvn -B -ntp test
-pl rpc-consumer -am
-Dtest=RpcPerformanceSnapshotTest
-Dsurefire.failIfNoSpecifiedTests=false
-Drpc.registry=local
-Drpc.protocol=netty
-Drpc.serializer=kryo
-Drpc.perf.warmup=100
-Drpc.perf.sequential-requests=200
-Drpc.perf.concurrent-requests=1000
-Drpc.perf.concurrency=16
- name: Prepare performance record
id: performance-record
shell: bash
run: |
summary='rpc-consumer/target/rpc-performance/summary.md'
test -f "$summary"
{
echo 'markdown<<RPC_PERFORMANCE_EOF'
sed \
-e '1{/^# RPC CI Performance Snapshot$/d;}' \
-e '/^> Observational snapshot only\./d' \
-e '/^Raw per-request samples are available/d' \
-e 's/^## Framework metrics$/### Framework metrics/' \
"$summary"
echo 'RPC_PERFORMANCE_EOF'
} >> "$GITHUB_OUTPUT"
- 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/'
record-performance:
name: Record Performance
if: >-
github.event_name == 'push' &&
github.ref == 'refs/heads/main' &&
needs.rpc-integration.result == 'success'
needs: [ rpc-integration ]
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: write
steps:
- name: Checkout main
uses: actions/checkout@v7
with:
ref: main
fetch-depth: 0
- name: Append performance snapshot
shell: bash
env:
PERFORMANCE_MARKDOWN: ${{ needs.rpc-integration.outputs.performance_markdown }}
run: |
test -n "$PERFORMANCE_MARKDOWN"
mkdir -p docs
test -f docs/PERFORMANCE.md
short_sha="${GITHUB_SHA:0:7}"
recorded_at="$(date -u '+%Y-%m-%d %H:%M:%S UTC')"
{
echo
echo '---'
echo
echo "## CI Snapshot — ${recorded_at} — \`${short_sha}\`"
echo
printf '%s\n' "$PERFORMANCE_MARKDOWN"
} >> docs/PERFORMANCE.md
- name: Commit performance history
shell: bash
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add docs/PERFORMANCE.md
git commit -m 'docs: record RPC performance snapshot [skip ci]'
git push origin HEAD:main
ci-gate:
name: CI Gate
if: always()
needs: [ build, unit-tests, rpc-integration ]
runs-on: ubuntu-24.04
timeout-minutes: 2
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"