Skip to content

Commit 17208a0

Browse files
authored
[ci]: Support PR coverage (#1806)
The output log will be collected by subsequent pipelines to generate Pull Request coverage reports. And if a branch wants to enforce the coverage rate, we can simply and "--fail-under SCORE" in the cover-diff command, see detail in https://diff-cover.readthedocs.io/en/latest/README.html
1 parent c2c2354 commit 17208a0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

azure-pipelines.yml

+8
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ stages:
9191
python3 setup.py test
9292
displayName: 'Test Python 3'
9393
94+
- script: |
95+
sudo pip3 install diff-cover
96+
target_branch=$(System.PullRequest.TargetBranch)
97+
compare_branch=origin/${target_branch#refs/heads/}
98+
diff-cover coverage.xml --compare-branch=$compare_branch
99+
condition: eq(variables['Build.Reason'], 'PullRequest')
100+
displayName: "Diff coverage"
101+
94102
- task: PublishTestResults@2
95103
inputs:
96104
testResultsFiles: '$(System.DefaultWorkingDirectory)/test-results.xml'

0 commit comments

Comments
 (0)