Skip to content

Commit 4dbfdf2

Browse files
committed
feat(环境): 添加单元测试 CI
1 parent edde5f2 commit 4dbfdf2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/checker.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,27 @@ jobs:
2929
- name: Check Spotbugs
3030
run: ./mvnw spotbugs:check
3131

32+
# 添加单元测试步骤
33+
- name: Run Unit Tests
34+
run: ./mvnw -B test
35+
36+
# 生成测试覆盖率报告
37+
- name: Generate Test Coverage Report
38+
run: ./mvnw -B verify jacoco:report
39+
3240
- name: Build with Maven
3341
run: ./mvnw -B clean package
3442

43+
# 使用 actions/test-reporter 展示测试结果
44+
- name: Publish Test Results
45+
uses: dorny/test-reporter@v1
46+
if: always()
47+
with:
48+
name: JUnit Tests (${{ matrix.java }})
49+
path: target/surefire-reports/*.xml
50+
reporter: java-junit
51+
fail-on-error: true
52+
3553
- name: Upload Test Results
3654
if: always()
3755
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)