Skip to content

Commit

Permalink
[ci]: Support PR coverage (sonic-net#1806)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xumia committed Sep 14, 2021
1 parent c2c2354 commit 17208a0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ stages:
python3 setup.py test
displayName: 'Test Python 3'
- script: |
sudo pip3 install diff-cover
target_branch=$(System.PullRequest.TargetBranch)
compare_branch=origin/${target_branch#refs/heads/}
diff-cover coverage.xml --compare-branch=$compare_branch
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: "Diff coverage"
- task: PublishTestResults@2
inputs:
testResultsFiles: '$(System.DefaultWorkingDirectory)/test-results.xml'
Expand Down

0 comments on commit 17208a0

Please sign in to comment.