docs:support auto snapshot release in GitHub Action.

pull/1080/head
Haotian Zhang 2 years ago
parent 21953e17b6
commit da2422ae71

@ -3,33 +3,34 @@ name: Codecov
on:
push:
branches:
- hoxton
- 2022.0
- 2021.0
- 2020.0
- hoxton
- greenwich
pull_request:
branches:
- hoxton
- 2022.0
- 2021.0
- 2020.0
- hoxton
- greenwich
jobs:
build:
codecov:
runs-on: ubuntu-latest
steps:
- name: Checkout codes
uses: actions/checkout@v3
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
java-version: 17
- name: Test with Maven
run: mvn clean test -f pom.xml -B -P sonatype -U
run: mvn clean test -B -U -Psonatype
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ github.workspace }}/target/site/jacoco/jacoco.xml

@ -18,7 +18,7 @@ on:
- greenwich
jobs:
build:
junit:
strategy:
matrix:
java: [ 8, 11, 17 ]
@ -42,4 +42,5 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Test with Maven
run: mvn clean test -f pom.xml -B -P sonatype -U
run: mvn clean test -B -U -Psonatype

@ -0,0 +1,30 @@
name: Snapshot
on:
push:
branches:
- 2022.0
- 2021.0
- 2020.0
- hoxton
- greenwich
jobs:
snapshot:
runs-on: ubuntu-latest
steps:
- name: Checkout codes
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: nexus-snapshots
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
run: mvn clean deploy -B -U -Psonatype
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

@ -5,7 +5,7 @@
[![Contributors](https://img.shields.io/github/contributors/Tencent/spring-cloud-tencent)](https://github.com/Tencent/spring-cloud-tencent/graphs/contributors)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Build Status](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml/badge.svg)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml)
[![Test with Junit](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml/badge.svg)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/hoxton/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=hoxton)
[English](./README.md) | 简体中文
@ -14,12 +14,14 @@
## 介绍
> 欢迎各位同学点击右上角 Star 按钮,持续关注我们的项目,给予我们最大的支持~
Spring Cloud Tencent 是腾讯开源的一站式微服务解决方案。
Spring Cloud Tencent 实现了Spring Cloud 标准微服务 SPI开发者可以基于 Spring Cloud Tencent 快速开发 Spring Cloud
云原生分布式应用。
Spring Cloud Tencent 的核心依托腾讯开源的一站式服务发现与治理平台 [Polaris](https://github.com/polarismesh/polaris)
Spring Cloud Tencent 的核心依托腾讯开源的一站式服务发现与治理平台 [PolarisMesh](https://polarismesh.cn/)
,实现各种分布式微服务场景。
- [Polaris Github home page](https://github.com/polarismesh/polaris)
@ -60,6 +62,8 @@ Spring Cloud Tencent 所有组件都已上传到 Maven 中央仓库,只需要
> 注意:
>
> 支持Spring Cloud 版本2022.0、2021.0、2020.0、Hoxton。
>
> Spring Cloud Tencent
> 的版本列表可以查看
> [Spring Cloud Tencent 版本管理](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86)
@ -75,7 +79,7 @@ Spring Cloud Tencent 所有组件都已上传到 Maven 中央仓库,只需要
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId>
<!--version number-->
<version>1.9.0-Hoxton.SR12</version>
<version>1.9.1-Hoxton.SR12</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -106,27 +110,7 @@ You can build this project with command:
## 文档
- 使用文档
- [Spring Cloud Tencent 版本管理](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86)
- [服务注册与发现](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Discovery-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [配置中心](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Config-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [服务限流](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Rate-Limit-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [服务熔断](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Circuitbreaker-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [服务路由](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Router-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [RPC增强](https://github.com/Tencent/spring-cloud-tencent/wiki/RPC%E5%A2%9E%E5%BC%BA)
- [元数据传递](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Metadata-Transfer-%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97)
- [场景化插件](https://github.com/Tencent/spring-cloud-tencent/wiki/场景化插件)
- [Actuator Endpoint 扩展](https://github.com/Tencent/spring-cloud-tencent/wiki/Actuator-Endpoint-%E6%89%A9%E5%B1%95)
- 最佳实践
- [可观测性实践](https://github.com/Tencent/spring-cloud-tencent/wiki/可观测性实践)
- [测试环境路由](https://github.com/Tencent/spring-cloud-tencent/wiki/%E6%B5%8B%E8%AF%95%E7%8E%AF%E5%A2%83%E8%B7%AF%E7%94%B1)
- [Spring Cloud Gateway 流量染色](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Gateway-%E6%B5%81%E9%87%8F%E6%9F%93%E8%89%B2)
- [多注册与多发现](https://github.com/Tencent/spring-cloud-tencent/wiki/Multi-registration-and-multi-discovery)
- 开发文档
- [项目概览](https://github.com/Tencent/spring-cloud-tencent/wiki/%E9%A1%B9%E7%9B%AE%E6%A6%82%E8%A7%88)
- [参与共建](https://github.com/Tencent/spring-cloud-tencent/wiki/%E5%8F%82%E4%B8%8E%E5%85%B1%E5%BB%BA)
请阅读 [Wiki](https://github.com/Tencent/spring-cloud-tencent/wiki)
## 交流群

@ -6,7 +6,7 @@
[![Contributors](https://img.shields.io/github/contributors/Tencent/spring-cloud-tencent)](https://github.com/Tencent/spring-cloud-tencent/graphs/contributors)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Build Status](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml/badge.svg)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml)
[![Test with Junit](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml/badge.svg)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/hoxton/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=hoxton)
English | [简体中文](./README-zh.md)
@ -19,10 +19,10 @@ Spring Cloud Tencent implements the Spring Cloud standard microservice SPI, so d
Cloud cloud-native distributed applications based on Spring Cloud Tencent.
The core of Spring Cloud Tencent relies on Tencent's open-source one-stop service discovery and governance
platform [Polaris](https://github.com/polarismesh/polaris) to realize various distributed microservice scenarios.
platform [PolarisMesh](https://polarismesh.cn) to realize various distributed microservice scenarios.
- [Polaris Github home page](https://github.com/polarismesh/polaris)
- [Polaris official website](https://polarismesh.cn/)
- [PolarisMesh Github home page](https://github.com/polarismesh/polaris)
- [PolarisMesh official website](https://polarismesh.cn/)
The capabilities provided by Spring Cloud Tencent include but are not limited to:
@ -59,6 +59,8 @@ dependencies.
> Notice:
>
> Support Spring Cloud 2022.0, 2021.0, 2020.0, Hoxton.
>
> The version list of Spring Cloud Tencent can be found
> in
> [Spring Cloud Tencent Version Management](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86)
@ -74,7 +76,7 @@ For example:
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId>
<!--version number-->
<version>1.9.0-Hoxton.SR12</version>
<version>1.9.1-Hoxton.SR12</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -105,27 +107,7 @@ You can build this project with command:
## Documents
- Usage Doc
- [Spring Cloud Tencent Version Management](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86)
- [Spring Cloud Tencent Discovery](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Discovery-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [Spring Cloud Tencent Config](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Config-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [Spring Cloud Tencent Rate Limit](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Rate-Limit-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [Spring Cloud Tencent CircuitBreaker](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Circuitbreaker-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [Spring Cloud Tencent Router](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Router-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3)
- [Spring Cloud Starter Tencent RPC Enhancement](https://github.com/Tencent/spring-cloud-tencent/wiki/RPC%E5%A2%9E%E5%BC%BA)
- [Spring Cloud Tencent Metadata Transfer](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Metadata-Transfer-%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97)
- [Spring Cloud Tencent Plugins](https://github.com/Tencent/spring-cloud-tencent/wiki/%E5%9C%BA%E6%99%AF%E5%8C%96%E6%8F%92%E4%BB%B6)
- [Actuator Endpoint Extension](https://github.com/Tencent/spring-cloud-tencent/wiki/Actuator-Endpoint-%E6%89%A9%E5%B1%95)
- Best Practices
- [Observability Practice](https://github.com/Tencent/spring-cloud-tencent/wiki/%E5%8F%AF%E8%A7%82%E6%B5%8B%E6%80%A7%E5%AE%9E%E8%B7%B5)
- [Multi-feature environment](https://github.com/Tencent/spring-cloud-tencent/wiki/%E5%A4%9A%E7%89%B9%E6%80%A7%E7%8E%AF%E5%A2%83)
- [Spring Cloud Gateway Traffic Staining](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Gateway-%E6%B5%81%E9%87%8F%E6%9F%93%E8%89%B2)
- [Multi-registration and multi-discovery](https://github.com/Tencent/spring-cloud-tencent/wiki/Multi-registration-and-multi-discovery)
- Development documentation
- [Project Structure Overview](https://github.com/Tencent/spring-cloud-tencent/wiki/%E9%A1%B9%E7%9B%AE%E6%A6%82%E8%A7%88)
- [Participate in co-construction](https://github.com/Tencent/spring-cloud-tencent/wiki/%E5%8F%82%E4%B8%8E%E5%85%B1%E5%BB%BA)
Pelease refer to [Wiki](https://github.com/Tencent/spring-cloud-tencent/wiki)
## Chat Group

@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>2.3.5.RELEASE</version>
<version>3.0.5</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -16,7 +16,7 @@
<version>${revision}</version>
<name>Spring Cloud Tencent</name>
<description>Spring Cloud Tencent</description>
<url>https://github.com/Tencent/spring-cloud-tencent/tree/hoxton</url>
<url>https://github.com/Tencent/spring-cloud-tencent/tree/2020.0</url>
<organization>
<name>Tencent</name>
@ -26,7 +26,7 @@
<licenses>
<license>
<name>The BSD 3-Clause License (BSD3)</name>
<url>https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/hoxton/LICENSE</url>
<url>https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/2020.0/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
@ -205,6 +205,7 @@
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${argLine}</argLine>
</configuration>
</plugin>
<plugin>
@ -292,17 +293,6 @@
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>sonatype</id>
@ -331,4 +321,15 @@
</repositories>
</profile>
</profiles>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>

@ -39,6 +39,7 @@ import org.springframework.cloud.context.properties.ConfigurationPropertiesRebin
import org.springframework.cloud.context.refresh.ContextRefresher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
/**
* polaris config module auto configuration at init application context phase.
@ -60,7 +61,7 @@ public class PolarisConfigAutoConfiguration {
}
@Bean
@ConditionalOnMissingBean(search = SearchStrategy.CURRENT)
@Primary
@ConditionalOnReflectRefreshType
public ConfigurationPropertiesRebinder affectedConfigurationPropertiesRebinder(
ConfigurationPropertiesBeans beans) {

@ -81,6 +81,7 @@ public class SpringValueProcessorTest {
.withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class))
.withConfiguration(AutoConfigurations.of(ValueTest.class))
.withConfiguration(AutoConfigurations.of(PolarisConfigAutoConfiguration.class))
.withAllowBeanDefinitionOverriding(true)
.withPropertyValues("spring.application.name=" + "conditionalOnConfigReflectEnabledTest")
.withPropertyValues("spring.cloud.polaris.address=grpc://127.0.0.1:10081")
.withPropertyValues("spring.cloud.polaris.config.refresh-type=" + RefreshType.REFLECT)
@ -114,6 +115,7 @@ public class SpringValueProcessorTest {
.withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class))
.withConfiguration(AutoConfigurations.of(ValueTest.class))
.withConfiguration(AutoConfigurations.of(PolarisConfigAutoConfiguration.class))
.withAllowBeanDefinitionOverriding(true)
.withPropertyValues("spring.application.name=" + "conditionalOnConfigReflectEnabledTest")
.withPropertyValues("spring.cloud.polaris.address=grpc://127.0.0.1:10081")
.withPropertyValues("spring.cloud.polaris.config.refresh-type=" + RefreshType.REFLECT)
@ -147,6 +149,7 @@ public class SpringValueProcessorTest {
.withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class))
.withConfiguration(AutoConfigurations.of(XMLBeamDefinitionTest.class))
.withConfiguration(AutoConfigurations.of(PolarisConfigAutoConfiguration.class))
.withAllowBeanDefinitionOverriding(true)
.withPropertyValues("spring.application.name=" + "conditionalOnConfigReflectEnabledTest")
.withPropertyValues("spring.cloud.polaris.address=grpc://127.0.0.1:10081")
.withPropertyValues("spring.cloud.polaris.config.refresh-type=" + RefreshType.REFLECT)

@ -106,6 +106,12 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.tencent.polaris</groupId>
<artifactId>polaris-test-common</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-jupiter</artifactId>

@ -0,0 +1,63 @@
/*
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.tencent.cloud.common.pojo;
import com.tencent.polaris.api.pojo.Instance;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import static com.tencent.polaris.test.common.Consts.SERVICE_PROVIDER;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
/**
* Test for {@link PolarisServiceInstance}.
*
* @author Haotian Zhang
*/
@ExtendWith(MockitoExtension.class)
public class PolarisServiceInstanceTest {
@Test
@DisplayName("test getters and setters.")
void test() {
Instance secureInstance = mock(Instance.class);
doReturn("test-ID").when(secureInstance).getId();
doReturn(SERVICE_PROVIDER).when(secureInstance).getService();
doReturn("1.1.1.1").when(secureInstance).getHost();
doReturn(8080).when(secureInstance).getPort();
doReturn("https").when(secureInstance).getProtocol();
PolarisServiceInstance securePolarisServiceInstance = new PolarisServiceInstance(secureInstance);
assertThat(securePolarisServiceInstance.getInstanceId()).isEqualTo("test-ID");
assertThat(securePolarisServiceInstance.getServiceId()).isEqualTo(SERVICE_PROVIDER);
assertThat(securePolarisServiceInstance.getHost()).isEqualTo("1.1.1.1");
assertThat(securePolarisServiceInstance.getPort()).isEqualTo(8080);
assertThat(securePolarisServiceInstance.isSecure()).isTrue();
assertThat(securePolarisServiceInstance.getScheme()).isEqualTo("https");
Instance insecureInstance = mock(Instance.class);
doReturn("http").when(insecureInstance).getProtocol();
PolarisServiceInstance insecurePolarisServiceInstance = new PolarisServiceInstance(insecureInstance);
assertThat(insecurePolarisServiceInstance.isSecure()).isFalse();
assertThat(insecurePolarisServiceInstance.getScheme()).isEqualTo("http");
}
}

@ -357,17 +357,17 @@
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
</profiles>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>

Loading…
Cancel
Save