Skip to content

Optimize code and improve readability #2056

Optimize code and improve readability

Optimize code and improve readability #2056

name: Spring Integration Test1
env:
projectSpringBootVersion: 2.2.0.RELEASE
sermantVersion: 1.0.0
on:
push:
pull_request:
branches:
- '*'
paths:
- 'sermant-agentcore/**'
- 'sermant-integration-tests/spring-test/**'
- 'sermant-plugins/sermant-dynamic-config/**'
- 'sermant-plugins/sermant-flowcontrol/**'
- 'sermant-plugins/sermant-monitor/**'
- 'sermant-plugins/sermant-loadbalancer/**'
- 'sermant-plugins/sermant-router/**'
- 'sermant-plugins/sermant-service-registry/**'
- 'sermant-plugins/sermant-springboot-registry/**'
- 'sermant-plugins/sermant-service-visibility/**'
- '.github/workflows/spring_integration_test_1.yml'
- '.github/actions/common/spring/action.yml'
- '.github/actions/scenarios/spring/**'
- '.github/actions/common/plugin-change-check/action.yml'
- '.github/actions/common/entry/action.yml'
- '.github/actions/common/exit/action.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
set-execution-conditions:
name: set-execution-conditions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: plugin-change-check
id: plugin-change-check
uses: ./.github/actions/common/plugin-change-check
- name: set-outputs
id: set-outputs
run: |
echo "enableGraceful=${{env.enableGraceful}}" >> $GITHUB_OUTPUT
echo "enableSpringCommon=${{env.enableSpringCommon}}" >> $GITHUB_OUTPUT
echo "enableDynamicConfig=${{env.enableDynamicConfig}}" >> $GITHUB_OUTPUT
echo "enableSpringMonitor=${{env.enableSpringMonitor}}" >> $GITHUB_OUTPUT
echo "enableSpringVisibility=${{env.enableSpringVisibility}}" >> $GITHUB_OUTPUT
echo "enableSpringRemoval=${{env.enableSpringRemoval}}" >> $GITHUB_OUTPUT
outputs:
enableGraceful: ${{ steps.set-outputs.outputs.enableGraceful }}
enableSpringCommon: ${{ steps.set-outputs.outputs.enableSpringCommon }}
enableDynamicConfig: ${{ steps.set-outputs.outputs.enableDynamicConfig }}
enableSpringMonitor: ${{ steps.set-outputs.outputs.enableSpringMonitor }}
enableSpringVisibility: ${{ steps.set-outputs.outputs.enableSpringVisibility }}
enableSpringRemoval: ${{ steps.set-outputs.outputs.enableSpringRemoval }}
download-midwares-and-cache:
name: download midwares and cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: cache local cse
uses: actions/cache@v4
with:
path: Local-CSE-2.1.3-linux-amd64.zip
key: ${{ runner.os }}-local-cse
restore-keys: |
${{ runner.os }}-local-cse
- name: download cse
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh cse
- name: cache zookeeper
uses: actions/cache@v4
with:
path: apache-zookeeper-3.6.3-bin.tar.gz
key: ${{ runner.os }}-apache-zookeeper-3.6.3
restore-keys: |
${{ runner.os }}-apache-zookeeper-3.6.3
- name: download zookeeper
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh zk
- name: cache nacos server
uses: actions/cache@v4
with:
path: nacos-server-1.4.2.tar.gz
key: ${{ runner.os }}-nacos-server-1.4.2
restore-keys: |
${{ runner.os }}-nacos-server-1.4.2
- name: download nacos
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh nacos
build-agent-and-cache:
name: build agent and cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'adopt'
cache: maven
- name: cache agent
uses: actions/cache@v4
with:
path: sermant-agent-*/
key: ${{ runner.os }}-agent-${{ github.run_id }}
- name: package agent
run: |
sed -i '/sermant-integration-tests/d' pom.xml
sed -i '/sermant-injector/d' pom.xml
mvn package -DskipTests -Ptest --file pom.xml
test-for-spring:
name: Test for spring
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableGraceful == 'true'
|| needs.set-execution-conditions.outputs.enableSpringCommon == 'true'
|| needs.set-execution-conditions.outputs.enableDynamicConfig == 'true'
|| needs.set-execution-conditions.outputs.enableSpringMonitor == 'true'
|| needs.set-execution-conditions.outputs.enableSpringVisibility == 'true'
|| needs.set-execution-conditions.outputs.enableSpringRemoval == 'true'
needs: [set-execution-conditions, build-agent-and-cache, download-midwares-and-cache]
strategy:
matrix:
include:
- springBootVersion: "1.5.0.RELEASE"
springCloudVersion: "Edgware.SR2"
nacosVersion: "1.5.0.RELEASE"
- springBootVersion: "2.0.2.RELEASE"
springCloudVersion: "Finchley.RELEASE"
httpClientVersion: "4.1.3"
nacosVersion: "2.0.0.RELEASE"
jettyClientVersion: "1.0.1"
- springBootVersion: "2.1.0.RELEASE"
springCloudVersion: "Greenwich.RELEASE"
httpClientVersion: "4.2.6"
nacosVersion: "2.1.0.RELEASE"
jettyClientVersion: "1.0.1"
- springBootVersion: "2.2.0.RELEASE"
springCloudVersion: "Hoxton.RELEASE"
httpClientVersion: "4.3.6"
nacosVersion: "2.2.0.RELEASE"
jettyClientVersion: "1.0.3"
- springBootVersion: "2.3.0.RELEASE"
springCloudVersion: "Hoxton.RELEASE"
httpClientVersion: "4.4.1"
nacosVersion: "2.2.8.RELEASE"
jettyClientVersion: "1.1.2"
- springBootVersion: "2.4.0"
springCloudVersion: "2020.0.0"
httpClientVersion: "4.5.6"
nacosVersion: "2021.0.1.0"
jettyClientVersion: "1.1.4"
- springBootVersion: "2.6.2"
springCloudVersion: "2021.0.0"
httpClientVersion: "4.5.10"
nacosVersion: "2021.1"
jettyClientVersion: "1.1.10"
- springBootVersion: "2.7.2"
springCloudVersion: "2021.0.3"
httpClientVersion: "4.5.13"
jettyClientVersion: "1.1.12"
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: set java version to environment
run: |
echo "javaVersion=8" >> $GITHUB_ENV
- name: common operations
uses: ./.github/actions/common/spring
- name: (graceful) test for springboot=${{ matrix.springBootVersion }} springCloudVersion=${{ matrix.springCloudVersion }}
if: needs.set-execution-conditions.outputs.enableGraceful == 'true'
uses: ./.github/actions/scenarios/spring/graceful
- name: (spring common) test for springboot=${{ matrix.springBootVersion }} springCloudVersion=${{ matrix.springCloudVersion }}
if: needs.set-execution-conditions.outputs.enableSpringCommon == 'true'
uses: ./.github/actions/scenarios/spring/spring-common
- name: (nacos dynamic config) test for springboot=${{ matrix.springBootVersion }} springCloudVersion=${{ matrix.springCloudVersion }}
if: ${{ matrix.nacosVersion != '' && needs.set-execution-conditions.outputs.enableDynamicConfig == 'true' }}
uses: ./.github/actions/scenarios/spring/dynamic-config-nacos
- name: (zk dynamic config) test for springboot=${{ matrix.springBootVersion }} springCloudVersion=${{ matrix.springCloudVersion }}
if: needs.set-execution-conditions.outputs.enableDynamicConfig == 'true'
uses: ./.github/actions/scenarios/spring/dynamic-config-zk
- name: monitor test for springboot=${{ matrix.springBootVersion }} springCloudVersion=${{ matrix.springCloudVersion }}
if: needs.set-execution-conditions.outputs.enableSpringMonitor == 'true'
uses: ./.github/actions/scenarios/spring/monitor
- name: visibility test for springboot=${{ matrix.springBootVersion }} springCloudVersion=${{ matrix.springCloudVersion }}
if: needs.set-execution-conditions.outputs.enableSpringVisibility == 'true'
uses: ./.github/actions/scenarios/spring/visibility
- name: removal test for springboot=${{ matrix.springBootVersion }} springCloudVersion=${{ matrix.springCloudVersion }}
if: needs.set-execution-conditions.outputs.enableSpringRemoval == 'true'
uses: ./.github/actions/scenarios/spring/removal