From 84c7a858199d92a2246d7306c100871a7ef27bbf Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 11 Feb 2022 16:14:10 -0800 Subject: [PATCH] [ci]: Support code diff coverage (#116) Support code diff coverage, and set threshold to 50% --- azure-pipelines.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7a2117a3..8bdbbc37 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 @@ -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"