Skip to content

Commit 1260a95

Browse files
docs:update GitHub Action. (#80)
1 parent 942d3d7 commit 1260a95

File tree

6 files changed

+136
-61
lines changed

6 files changed

+136
-61
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
# 相当于脚本用途的一个声明
21
name: Release
3-
# 触发脚本的事件 这里为发布release之后触发
42
on:
53
release:
64
types: [published]
75
jobs:
86
release:
97
runs-on: ubuntu-latest
108
steps:
11-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1210
- name: Set up Maven Central Repository
13-
uses: actions/setup-java@v3
11+
uses: actions/setup-java@v4
1412
with:
15-
java-version: '11'
13+
java-version: '8'
1614
distribution: 'adopt'
1715
server-id: ossrh
1816
server-username: MAVEN_USERNAME
@@ -24,4 +22,4 @@ jobs:
2422
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
2523
run: |
2624
cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import;
27-
mvn clean deploy -P release -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -DskipTests
25+
mvn clean deploy -P release -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -DskipTests -B -U

.github/workflows/snapshot.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# 相当于脚本用途的一个声明
21
name: Snapshot
3-
# 触发脚本的事件 这里为发布release之后触发
42
on:
53
push:
64
branches:
7-
- dubbo*
5+
- dubbo-3.2.x
6+
- dubbo-2.x
7+
- release/*
88

99
jobs:
1010
check-snapshot:
@@ -13,7 +13,7 @@ jobs:
1313
IS_SNAPSHOT: ${{ steps.set_output_1.outputs.IS_SNAPSHOT }}
1414
steps:
1515
- name: Checkout codes
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
- name: Check deploy type
1818
id: set_output_1
1919
run: |
@@ -24,16 +24,33 @@ jobs:
2424
else
2525
echo "IS_SNAPSHOT=false" >> $GITHUB_OUTPUT
2626
fi
27-
release:
27+
set-jdk:
2828
runs-on: ubuntu-latest
29-
needs: check-snapshot
29+
outputs:
30+
jdk: ${{ steps.set-jdk.outputs.jdk }}
31+
steps:
32+
- name: Set JDK based on branch
33+
id: set-jdk
34+
run: |
35+
shopt -s nocasematch
36+
if [[ "${{ github.ref_name }}" == "dubbo-3.2.x" ]]; then
37+
echo "jdk=17" >> $GITHUB_OUTPUT
38+
elif [[ "${{ github.ref_name }}" == "dubbo-2.x" ]]; then
39+
echo "jdk=8" >> $GITHUB_OUTPUT
40+
else
41+
echo "jdk=8" >> $GITHUB_OUTPUT
42+
fi
43+
shopt -u nocasematch
44+
snapshot:
45+
runs-on: ubuntu-latest
46+
needs: [ check-snapshot, set-jdk ]
3047
if: ${{ needs.check-snapshot.outputs.IS_SNAPSHOT == 'true' }}
3148
steps:
32-
- uses: actions/checkout@v3
33-
- name: Set up Maven Central Repository
34-
uses: actions/setup-java@v3
49+
- uses: actions/checkout@v4
50+
- name: Set up JDK ${{ needs.set-jdk.outputs.jdk }}
51+
uses: actions/setup-java@v4
3552
with:
36-
java-version: '11'
53+
java-version: ${{ needs.set-jdk.outputs.jdk }}
3754
distribution: 'adopt'
3855
server-id: ossrh
3956
server-username: MAVEN_USERNAME

.github/workflows/testing.yml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,56 @@
1-
# This workflow will build a Java project with Maven
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3-
41
name: Testing
52
on:
63
push:
7-
branches: [ main ]
4+
branches:
5+
- dubbo-3.2.x
6+
- dubbo-2.x
7+
- release/*
88
pull_request:
9-
branches: [ main ]
9+
branches:
10+
- dubbo-3.2.x
11+
- dubbo-2.x
12+
- release/*
1013

1114
jobs:
12-
build:
15+
set-jdks:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
jdks: ${{ steps.set-jdks.outputs.jdks }}
19+
steps:
20+
- name: Set JDK matrix based on branch
21+
id: set-jdks
22+
run: |
23+
shopt -s nocasematch
24+
branch_name=${{ github.ref_name }}
25+
if [ -n "${{ github.base_ref }}" ]; then
26+
branch_name=${{ github.base_ref }}
27+
fi
28+
echo $branch_name
29+
if [[ "$branch_name" == "dubbo-3.2.x" ]]; then
30+
echo "jdks=[8,17]" >> $GITHUB_OUTPUT
31+
elif [[ "$branch_name" == "dubbo-2.x" ]]; then
32+
echo "jdks=[8]" >> $GITHUB_OUTPUT
33+
else
34+
echo "jdks=[8]" >> $GITHUB_OUTPUT
35+
fi
36+
shopt -u nocasematch
37+
junit:
1338
strategy:
1439
matrix:
15-
java: [ 8 ]
40+
java: ${{ fromJson(needs.set-jdks.outputs.jdks) }}
1641
os: [ 'windows-latest', 'ubuntu-latest' ]
1742
runs-on: ${{ matrix.os }}
43+
needs: set-jdks
1844
steps:
1945
- name: Checkout codes
20-
uses: actions/checkout@v3
46+
uses: actions/checkout@v4
2147
- name: Set up JDK ${{ matrix.java }}
22-
uses: actions/setup-java@v3
48+
uses: actions/setup-java@v4
2349
with:
2450
distribution: 'temurin'
2551
java-version: ${{ matrix.java }}
2652
- name: Cache local Maven repository
27-
uses: actions/cache@v3
53+
uses: actions/cache@v4
2854
with:
2955
path: ~/.m2/repository
3056
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

dubbo-examples/pom.xml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,5 @@
5151
<artifactId>log4j-slf4j-impl</artifactId>
5252
<version>${log4j2.version}</version>
5353
</dependency>
54-
55-
<dependency>
56-
<groupId>junit</groupId>
57-
<artifactId>junit</artifactId>
58-
<version>${junit.version}</version>
59-
<scope>test</scope>
60-
</dependency>
61-
62-
<dependency>
63-
<groupId>org.springframework</groupId>
64-
<artifactId>spring-test</artifactId>
65-
<scope>test</scope>
66-
</dependency>
6754
</dependencies>
6855
</project>

polaris-adapter-dubbo/pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,10 @@
6363
<groupId>com.tencent.polaris</groupId>
6464
<artifactId>polaris-all</artifactId>
6565
</dependency>
66-
<dependency>
67-
<groupId>org.slf4j</groupId>
68-
<artifactId>slf4j-api</artifactId>
69-
<version>${slf4j.version}</version>
70-
</dependency>
7166
<dependency>
7267
<groupId>com.jayway.jsonpath</groupId>
7368
<artifactId>json-path</artifactId>
7469
<version>${json_path_version}</version>
7570
</dependency>
76-
<dependency>
77-
<groupId>junit</groupId>
78-
<artifactId>junit</artifactId>
79-
<version>4.13.1</version>
80-
<scope>test</scope>
81-
</dependency>
8271
</dependencies>
8372
</project>

pom.xml

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,15 @@
4646
<!-- Apache Dubbo version -->
4747
<apache.dubbo.version>2.7.23</apache.dubbo.version>
4848

49-
<timestamp>${maven.build.timestamp}</timestamp>
49+
<slf4j.version>1.7.25</slf4j.version>
50+
<json_path_version>2.8.0</json_path_version>
51+
<junit.version>4.13.1</junit.version>
52+
<byte-buddy.version>1.14.19</byte-buddy.version>
53+
<mockito.version>4.9.0</mockito.version>
54+
<assertj.version>3.16.1</assertj.version>
55+
56+
<!-- Maven Plugin -->
5057
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
51-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
52-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
5358
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
5459
<maven.compiler.source>1.8</maven.compiler.source>
5560
<maven.compiler.target>1.8</maven.compiler.target>
@@ -59,8 +64,11 @@
5964
<maven.gpg.plugin.version>3.0.1</maven.gpg.plugin.version>
6065
<maven.deploy.plugin.version>3.0.0-M1</maven.deploy.plugin.version>
6166
<maven.flatten.plugin.version>1.2.5</maven.flatten.plugin.version>
62-
<slf4j.version>1.7.25</slf4j.version>
63-
<json_path_version>2.8.0</json_path_version>
67+
<maven.clean.plugin.version>3.1.0</maven.clean.plugin.version>
68+
69+
<timestamp>${maven.build.timestamp}</timestamp>
70+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
71+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
6472
</properties>
6573

6674
<dependencyManagement>
@@ -76,11 +84,6 @@
7684
<artifactId>polaris-all</artifactId>
7785
<version>${polaris.version}</version>
7886
</dependency>
79-
<dependency>
80-
<groupId>org.slf4j</groupId>
81-
<artifactId>slf4j-api</artifactId>
82-
<version>${slf4j.version}</version>
83-
</dependency>
8487
<dependency>
8588
<groupId>com.jayway.jsonpath</groupId>
8689
<artifactId>json-path</artifactId>
@@ -89,8 +92,63 @@
8992
</dependencies>
9093
</dependencyManagement>
9194

95+
<dependencies>
96+
<!--日志相关依赖-->
97+
<dependency>
98+
<groupId>org.slf4j</groupId>
99+
<artifactId>slf4j-api</artifactId>
100+
<version>${slf4j.version}</version>
101+
<scope>provided</scope>
102+
</dependency>
103+
<dependency>
104+
<groupId>junit</groupId>
105+
<artifactId>junit</artifactId>
106+
<version>${junit.version}</version>
107+
<scope>test</scope>
108+
</dependency>
109+
<dependency>
110+
<groupId>net.bytebuddy</groupId>
111+
<artifactId>byte-buddy</artifactId>
112+
<version>${byte-buddy.version}</version>
113+
<scope>test</scope>
114+
</dependency>
115+
<dependency>
116+
<groupId>net.bytebuddy</groupId>
117+
<artifactId>byte-buddy-agent</artifactId>
118+
<version>${byte-buddy.version}</version>
119+
<scope>test</scope>
120+
</dependency>
121+
<dependency>
122+
<groupId>org.mockito</groupId>
123+
<artifactId>mockito-inline</artifactId>
124+
<version>${mockito.version}</version>
125+
<scope>test</scope>
126+
</dependency>
127+
<dependency>
128+
<groupId>org.assertj</groupId>
129+
<artifactId>assertj-core</artifactId>
130+
<version>${assertj.version}</version>
131+
<scope>test</scope>
132+
</dependency>
133+
</dependencies>
134+
92135
<build>
93136
<plugins>
137+
<plugin>
138+
<groupId>org.apache.maven.plugins</groupId>
139+
<artifactId>maven-clean-plugin</artifactId>
140+
<version>${maven.clean.plugin.version}</version>
141+
<configuration>
142+
<filesets>
143+
<fileset>
144+
<directory>${project.basedir}</directory>
145+
<includes>
146+
<include>dependency-reduced-pom.xml</include>
147+
</includes>
148+
</fileset>
149+
</filesets>
150+
</configuration>
151+
</plugin>
94152
<plugin>
95153
<groupId>org.apache.maven.plugins</groupId>
96154
<artifactId>maven-checkstyle-plugin</artifactId>
@@ -274,4 +332,4 @@
274332
</snapshots>
275333
</repository>
276334
</repositories>
277-
</project>
335+
</project>

0 commit comments

Comments
 (0)