зеркало из https://github.com/microsoft/genalog.git
Cache code coverage report
This commit is contained in:
Родитель
67c12a3c82
Коммит
6316a9c953
|
@ -11,74 +11,31 @@ stages:
|
|||
parameters:
|
||||
pyVersion: '3.6'
|
||||
|
||||
- stage: run_unit_test_matrix
|
||||
- stage: unit_tests
|
||||
dependsOn: static_analysis
|
||||
jobs:
|
||||
- template: templates/run-tests-on-multiple-os-py.yml
|
||||
parameters:
|
||||
pyVersions: ['3.6']
|
||||
testTypes: ['unit', 'io']
|
||||
testTypes: ['unit']
|
||||
imageOSs: ['ubuntu-18.04'] # 'windows-latest', 'macos-latest'
|
||||
|
||||
- stage: run_e2e_test_matrix
|
||||
- stage: e2e_tests
|
||||
dependsOn: static_analysis
|
||||
jobs:
|
||||
- template: templates/run-tests-on-multiple-os-py.yml
|
||||
parameters:
|
||||
pyVersions: ['3.6']
|
||||
testTypes: ['slow']
|
||||
testTypes: ['io']
|
||||
imageOSs: ['ubuntu-18.04'] # 'windows-latest', 'macos-latest'
|
||||
|
||||
- stage: collect_final_code_coverage
|
||||
dependsOn:
|
||||
- run_unit_test_matrix
|
||||
- run_e2e_test_matrix
|
||||
- unit_tests
|
||||
- e2e_tests
|
||||
jobs:
|
||||
- job:
|
||||
steps:
|
||||
- template: templates/publish-cov.yml
|
||||
- template: templates/merge-cov-reports.yml
|
||||
|
||||
|
||||
|
||||
# strategy:
|
||||
# matrix:
|
||||
# linux_x64_py3.6:
|
||||
# imageName: 'ubuntu-18.04'
|
||||
# pyVersion: '3.6'
|
||||
|
||||
# windows_x64_py3.6:
|
||||
# imageName: 'windows-2019'
|
||||
# pyVersion: '3.6'
|
||||
|
||||
# macos_x64_py3.6:
|
||||
# imageName: 'macOS-10.14'
|
||||
# pyVersion: '3.6'
|
||||
|
||||
# To build using more python versions follow the syntax below:
|
||||
# linux_x64_py3.5:
|
||||
# imageName: 'ubuntu-16.04'
|
||||
# pyVersion: '3.5'
|
||||
|
||||
# pool:
|
||||
# vmImage: '$(imageName)'
|
||||
|
||||
# steps:
|
||||
# - template: templates/run-linter.yml
|
||||
# parameters:
|
||||
# pyVersion: $(python.version)
|
||||
|
||||
# - template: templates/run-tests.yml
|
||||
# parameters:
|
||||
# testType: 'fast'
|
||||
# imageName: $(imageName)
|
||||
# pyVersion: $(python.version)
|
||||
|
||||
# - template: templates/run-tests.yml
|
||||
# parameters:
|
||||
# testType: 'slow'
|
||||
# skipInstall: true
|
||||
# imageName: $(imageName)
|
||||
# pyVersion: $(python.version)
|
||||
|
||||
# - template: templates/publish-cov.yml
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# Template to merge several code coverage reports (.coverage*)
|
||||
parameters:
|
||||
- name: pyVersion
|
||||
default: '3.6'
|
||||
|
||||
jobs:
|
||||
- job:
|
||||
displayName: Merge Code Coverage Reports
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
|
||||
steps:
|
||||
- checkout: none
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: ${{ parameters.pyVersion }}
|
||||
addToPath: true
|
||||
architecture: 'x64'
|
||||
displayName: 'Use Python ${{ parameters.pyVersion }}'
|
||||
|
||||
- bash: |
|
||||
python -m pip --upgrade pip setuptools
|
||||
python -m pip install coverage
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
displayName: 'Install coverage'
|
||||
|
||||
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&tabs=yaml#multiple-artifacts
|
||||
- download: current
|
||||
patterns: '**/.coverage*'
|
||||
|
||||
- bash: |
|
||||
python -m coverage combine $(Pipeline.Workspace)/**/.coverage*
|
||||
python -m coverage report
|
||||
python -m coverage xml
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
displayName: Show and merge cached coverage report
|
||||
|
||||
- task: PublishCodeCoverageResults@1
|
||||
inputs:
|
||||
codeCoverageTool: Cobertura
|
||||
summaryFileLocation: '$(Build.SourcesDirectory)/coverage.xml'
|
||||
displayName: 'Publish merged code coverage report'
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# Template for publishing code coverage report
|
||||
steps:
|
||||
- task: PublishCodeCoverageResults@1
|
||||
inputs:
|
||||
codeCoverageTool: Cobertura
|
||||
summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage.xml'
|
|
@ -31,10 +31,15 @@ jobs:
|
|||
- template: run-tests.yml
|
||||
parameters:
|
||||
testType: ${{testType}}
|
||||
|
||||
- template: publish-test-results.yml
|
||||
parameters:
|
||||
pyVersion: ${{pyVersion}}
|
||||
|
||||
- template: publish-cov.yml
|
||||
|
||||
- bash: |
|
||||
mv .coverage .coverage_$(System.StageName)_${{imageOS}}_${{pyVersion}}
|
||||
ls .coverage*
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
displayName: 'Rename coverage report'
|
||||
# Cache the coverage report
|
||||
- publish: $(Build.SourcesDirectory)/.coverage_$(System.StageName)_${{imageOS}}_${{pyVersion}}
|
||||
artifact: cov_report_$(System.StageName)_${{imageOS}}_${{pyVersion}}
|
Загрузка…
Ссылка в новой задаче