Skip to content

Commit

Permalink
chore: adjust coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
BytePender committed Dec 30, 2024
1 parent 0b35817 commit fe3c4f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
workflow_conclusion: success
name: main.breakdown
if_no_artifact_found: warn
- name: Ensure default.breakdown exists if download fails
- name: Create main.breakdown If Not Exist
run: |
if [ ! -f main.breakdown ]; then
echo "main.breakdown not found. Creating an empty main.breakdown file."
Expand All @@ -45,7 +45,7 @@ jobs:
with:
config: ./.testcoverage.yml
breakdown-file-name: ${{ github.ref_name == 'main' && 'main.breakdown' || '' }}
diff-base-breakdown-file-name: ${{ steps.download-main-breakdown.outputs.found_artifact && 'main.breakdown' || 'main.breakdown' }}
diff-base-breakdown-file-name: 'main.breakdown'
- name: Upload Artifact (main.breakdown)
uses: actions/upload-artifact@v4
if: github.ref_name == 'main'
Expand All @@ -60,7 +60,7 @@ jobs:
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'go-test-coverage report:'
body-includes: '📊 Coverage Report'
- name: Send Coverage Report
if: ${{ github.event.pull_request.number != null }}
uses: peter-evans/create-or-update-comment@v4
Expand All @@ -75,9 +75,7 @@ jobs:
<details>
<summary>Click to see detailed coverage report</summary>
```
${{ steps.coverage.outputs.report }}
```
</details>
Expand Down
26 changes: 8 additions & 18 deletions .testcoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ threshold:
# Minimum overall project coverage percentage required.
total: 75

# (optional; default 0)
# Minimum coverage percentage required for individual files.
file: 70

# (optional; default 0)
# Minimum coverage percentage required for each package.
package: 70

# Holds regexp rules which will exclude matched files or packages
# from coverage statistics.
exclude:
Expand All @@ -26,24 +34,6 @@ exclude:
- "examples/"
- "mock/"

# 设置总体覆盖率要求
total:
statements: 75

# 按包统计覆盖率
by-package:
# 每个包的最低覆盖率要求
threshold: 60
# 展示所有包的覆盖率,而不是只展示未达标的包
show-all: true

# 按文件统计覆盖率
by-file:
# 每个文件的最低覆盖率要求
threshold: 50
# 展示所有文件的覆盖率
show-all: true

# 增量覆盖率配置
diff:
# 新增代码的最低覆盖率要求
Expand Down

0 comments on commit fe3c4f0

Please sign in to comment.