docs:support auto snapshot release in GitHub Action. (#871)

* docs:support auto snapshot release in GitHub Action.

* docs:support auto snapshot release in GitHub Action.
pull/872/head
Haotian Zhang 1 year ago committed by GitHub
parent 3f70d7bd1d
commit 6768e94c2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -1,28 +0,0 @@
name: Codecov 2022.0
on:
push:
branches:
- 2022.0
pull_request:
branches:
- 2022.0
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout codes
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Test with Maven
run: mvn clean test -f pom.xml -B -P sonatype -U
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ${{ 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 }}

@ -9,3 +9,4 @@
- [fix:fix the error capture of rate limit exception.](https://github.com/Tencent/spring-cloud-tencent/pull/860)
- [feat:enable stat reporting as default.](https://github.com/Tencent/spring-cloud-tencent/pull/863)
- [refactor:update to junit 5.](https://github.com/Tencent/spring-cloud-tencent/pull/866)
- [docs:support auto snapshot release in GitHub Action.](https://github.com/Tencent/spring-cloud-tencent/pull/871)

@ -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 2022.0](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test17.yml/badge.svg?branch=2022.0)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test17.yml)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/2022.0/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=2022.0)
[English](./README.md) | 简体中文

@ -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 2022.0](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test17.yml/badge.svg?branch=2022.0)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test17.yml)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/2022.0/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=2022.0)
English | [简体中文](./README-zh.md)

@ -286,17 +286,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>
@ -326,4 +315,14 @@
</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>

@ -100,6 +100,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");
}
}

@ -313,17 +313,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