Skip to content

Commit

Permalink
[ci]: Support code diff coverage (#116)
Browse files Browse the repository at this point in the history
Support code diff coverage, and set threshold to 50%
  • Loading branch information
qiluo-msft committed Feb 12, 2022
1 parent 7cd7e0c commit 84c7a85
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ stages:
- job:
displayName: "build"
timeoutInMinutes: 60
variables:
DIFF_COVER_CHECK_THRESHOLD: 50
DIFF_COVER_ENABLE: 'true'
pool:
vmImage: ubuntu-20.04

Expand Down Expand Up @@ -52,13 +55,6 @@ stages:
sudo python3 -m pip install dist/swsssdk-2.0.1-py3-none-any.whl
python3 -m pytest --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml
displayName: "Unit tests"
- 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"
- publish: $(Build.ArtifactStagingDirectory)
artifact: sonic-py-swsssdk
displayName: "Archive artifacts"
Expand Down

0 comments on commit 84c7a85

Please sign in to comment.