From 76d893aa57c0b99b12c07dbbeca868e527141058 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Sat, 1 Feb 2020 10:26:06 -0800 Subject: [PATCH 1/2] Enable sonar cloud analysis --- azure-pipelines/templates/coverage.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/templates/coverage.yml b/azure-pipelines/templates/coverage.yml index 3f44da89..408dec9d 100644 --- a/azure-pipelines/templates/coverage.yml +++ b/azure-pipelines/templates/coverage.yml @@ -2,13 +2,31 @@ steps: - template: "use_python.yml" - script: | - python -m pip install -U pip setuptools tox + python -m pip install -U pip setuptools tox displayName: 'Setup Python packages' + - task: SonarCloudPrepare@1 + displayName: 'Prepare analysis on SonarCloud' + inputs: + SonarCloud: 'SonarCloud-debugpy' + organization: microsoft + scannerMode: CLI + extraProperties: | + sonar.python.coverage.reportPaths=$(Build.SourcesDirectory)\**\coverage\coverage.xml + sonar.projectKey=microsoft_debugpy + - script: | - python -m tox --develop -e py38-cov -- --cov-report=html --cov-report=xml -vv + python -m tox --develop -e py38-cov -- --cov-report=html --cov-report=xml -vv displayName: 'Coverage Run' + - task: SonarCloudAnalyze@1 + displayName: 'Run Code Analysis' + + - task: SonarCloudPublish@1 + displayName: 'Publish Quality Gate Result' + inputs: + pollingTimeoutSec: '300' + - task: PublishCodeCoverageResults@1 displayName: 'Publish Coverage Report' inputs: From 892483ce5965969dc11ce068f73c62655a6b3f51 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Tue, 4 Feb 2020 11:52:53 -0800 Subject: [PATCH 2/2] Try better path pattern --- azure-pipelines/templates/coverage.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/templates/coverage.yml b/azure-pipelines/templates/coverage.yml index 408dec9d..50607378 100644 --- a/azure-pipelines/templates/coverage.yml +++ b/azure-pipelines/templates/coverage.yml @@ -12,7 +12,7 @@ steps: organization: microsoft scannerMode: CLI extraProperties: | - sonar.python.coverage.reportPaths=$(Build.SourcesDirectory)\**\coverage\coverage.xml + sonar.python.coverage.reportPaths=$(Build.SourcesDirectory)/coverage/coverage.xml sonar.projectKey=microsoft_debugpy - script: | @@ -31,7 +31,7 @@ steps: displayName: 'Publish Coverage Report' inputs: codeCoverageTool: Cobertura - summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage/coverage.xml' - reportDirectory: '$(Build.SourcesDirectory)/**/coverage/html' + summaryFileLocation: '$(Build.SourcesDirectory)/coverage/coverage.xml' + reportDirectory: '$(Build.SourcesDirectory)/coverage/html' failIfCoverageEmpty: true condition: always() \ No newline at end of file