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
19 changes: 9 additions & 10 deletions .github/workflows/PushSDK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,24 @@ jobs:
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Show Java and Maven versions
run: |
java -version
mvn -v

- name: Probe s01 with token (no secrets printed)
run: |
code=$(curl -s -o /dev/null -w "%{http_code}" -u "${OSSRH_TOKEN_USERNAME}:${OSSRH_TOKEN_PASSWORD}" "https://s01.oss.sonatype.org/service/local/status")
echo "status_code=$code"
env:
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}

- name: Deploy (skip tests and gpg signing for now)
- name: Deploy to Central Portal
run: |
mvn -X -B -U \
-DskipTests=true \
-Dgpg.skip=true \
clean deploy
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

# 如果你的 POM 未配置 distributionManagement,或想强制直传,可用下面这个步骤替代上面的 Deploy:
# - name: Deploy via altDeploymentRepository
Expand Down
61 changes: 36 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<boot.version>2.3.9.RELEASE</boot.version>
<skipTests>true</skipTests>
</properties>

<parent>
Expand All @@ -43,38 +44,29 @@

<dependencyManagement>
<dependencies>

<!--springBoot-test-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${boot.version}</version>
</dependency>
<!-- JUnit 5 -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.2</version>
<scope>test</scope>
</dependency>

<!-- Mockito -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.6.28</version>
<scope>test</scope>
</dependency>

<!-- Mockito JUnit Jupiter -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>3.6.28</version>
<scope>test</scope>
</dependency>

<!-- AssertJ -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand All @@ -85,40 +77,29 @@
</dependencyManagement>

<dependencies>

<!-- TEST -->
<!-- JUnit 5 -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<!-- Mockito -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

<!-- Mockito JUnit Jupiter -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<!-- AssertJ -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<url>
https://github.com/Time-Machine-Lab/TmlFoundation.git
</url>
<url>https://github.com/Time-Machine-Lab/TmlFoundation.git</url>

<licenses>
<license>
Expand All @@ -129,12 +110,15 @@
</license>
</licenses>

<!-- 切换到“OSSRH Staging API 兼容服务”的发布端点 -->
<distributionManagement>
<repository>
<id>ossrh</id>
<name>Nexus Release Repository</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<name>OSSRH Staging API (Central)</name>
<url>https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/</url>
</repository>
<!-- 如需快照,也可在 settings.xml 单独配 snapshotRepositoryUrl:
https://central.sonatype.com/repository/maven-snapshots/ -->
</distributionManagement>

<build>
Expand Down Expand Up @@ -187,10 +171,37 @@
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.9.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>ossrh</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>

<!-- maven-deploy-plugin 按“PUT 上传”即可,端点在 distributionManagement 中已切换 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
Expand All @@ -203,7 +214,7 @@
</scm>

<profiles>
<!-- Deployment profile (required so these plugins are only used when deploying) -->
<!-- Deployment profile(保持不变) -->
<!-- 下面这个标签里的不能改 -->
<profile>
<id>deploy</id>
Expand All @@ -226,4 +237,4 @@
</build>
</profile>
</profiles>
</project>
</project>
3 changes: 3 additions & 0 deletions tml-sdk-java-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
</parent>

<artifactId>tml-sdk-java-core</artifactId>
<name>tml-sdk-java-core</name>
<description>TmlFoundation Core SDK</description>
<url>https://github.com/Time-Machine-Lab/TmlFoundation</url>

<properties>
<java.version>11</java.version>
Expand Down
3 changes: 3 additions & 0 deletions tml-sdk-java-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
</parent>

<artifactId>tml-sdk-java-web</artifactId>
<name>tml-sdk-java-web</name>
<description>TmlFoundation Web SDK</description>
<url>https://github.com/Time-Machine-Lab/TmlFoundation</url>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void testSuccessResponse() {
Result<Void> emptyResult = Result.success();
assertTrue(emptyResult.isSuccess());
assertNull(emptyResult.getData());
assertEquals("success", emptyResult.getMessage());
assertEquals("tml.success", emptyResult.getMessage());

// 带数据成功响应
Result<String> dataResult = Result.success("hello");
Expand All @@ -74,7 +74,7 @@ void testErrorResponse() {
System.out.println(errorResult);
assertTrue(errorResult.isError());
assertFalse(errorResult.isSuccess());
assertEquals("error", errorResult.getMessage());
assertEquals("tml.error", errorResult.getMessage());

// 自定义消息错误响应
Result<Void> customErrorResult = Result.error("操作失败");
Expand Down
24 changes: 12 additions & 12 deletions tml-sdk-java-web/src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ spring:

tml:
web:
result:
trace-enabled: true
trace-id-strategy: UUID
timestamp-precision: MILLISECONDS
result:
trace-enabled: true
trace-id-strategy: UUID
timestamp-precision: MILLISECONDS

---
# 测试配置2 - 开启链路追踪,雪花算法策略,纳秒精度
Expand All @@ -29,10 +29,10 @@ spring:

tml:
web:
result:
trace-enabled: true
trace-id-strategy: SNOWFLAKE
timestamp-precision: NANOSECONDS
result:
trace-enabled: true
trace-id-strategy: SNOWFLAKE
timestamp-precision: NANOSECONDS

---
# 测试配置3 - 开启链路追踪,时间戳随机策略,秒精度
Expand All @@ -43,7 +43,7 @@ spring:

tml:
web:
result:
trace-enabled: true
trace-id-strategy: TIMESTAMP_RANDOM
timestamp-precision: SECONDS
result:
trace-enabled: true
trace-id-strategy: TIMESTAMP_RANDOM
timestamp-precision: SECONDS
Loading