Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

append code coverage over each other #16202

Merged
109 commits merged into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
56283b6
append code coverage over each other
seankane-msft Jan 15, 2021
7978574
does not need a True
seankane-msft Jan 15, 2021
fad5073
adding append to the coverage combine call
seankane-msft Jan 20, 2021
1167210
adding the append to code coverage in the tox.ini file
seankane-msft Jan 20, 2021
41642b2
forgot to add the cov-append arg
seankane-msft Jan 20, 2021
2a107e3
publish the _coverage file
seankane-msft Jan 21, 2021
824ade0
changing path to coverage for publishing
seankane-msft Jan 21, 2021
539ff5e
adding append to coverage combine, not moving to the root directory n…
seankane-msft Jan 21, 2021
90dbbdc
changing to fileSharePath input for a folder
seankane-msft Jan 21, 2021
f70fe46
filePath was not the right keyword, should have been pipeline
seankane-msft Jan 21, 2021
6ef9d47
wrong way on a slash
seankane-msft Jan 21, 2021
63679ce
removing another coverage combine call
seankane-msft Jan 21, 2021
35679be
found a second coverage combine call, commenting out and re-trying
seankane-msft Jan 21, 2021
8125fa4
adding a stage after build for code coverage
seankane-msft Jan 21, 2021
169fb65
removing extra step
seankane-msft Jan 21, 2021
bf579ae
adding download step to get all generated .coverage files
seankane-msft Jan 22, 2021
613f8e4
changing script to pwsh
seankane-msft Jan 22, 2021
f1f6941
changed condition, download everything from the pipeline uploads
seankane-msft Jan 22, 2021
241d906
added python script for combining coverage files
seankane-msft Jan 22, 2021
cfec863
fixed a syntax error
seankane-msft Jan 22, 2021
e6a1e3d
ended up having the wrong directory in python script
seankane-msft Jan 22, 2021
2763f9b
error in python script and yml file
seankane-msft Jan 22, 2021
2511e60
moving to a stage that depends on build, fixed python script
seankane-msft Jan 22, 2021
e2176b0
fixing yml syntax errors, adding params to the publish-coverage.yml file
seankane-msft Jan 22, 2021
125838d
moving publish coverage to templates, attempt to fix syntax error
seankane-msft Jan 22, 2021
923ed2f
added job and steps portions to yaml
seankane-msft Jan 22, 2021
79c2ff8
moving depends on to publish-coverage.yml file
seankane-msft Jan 22, 2021
eeec8ec
adding runcoverage as a default argument
seankane-msft Jan 22, 2021
34b1ebe
fixed a naming issue, added empty job
seankane-msft Jan 22, 2021
1194bae
fixed more naming issues
seankane-msft Jan 22, 2021
a00b2d0
moving dependsOn around
seankane-msft Jan 22, 2021
6340348
publishing .coverage in the CI pipeline
seankane-msft Jan 22, 2021
005b0e4
installing coverage package in script, adding disable-cov arguments f…
seankane-msft Jan 22, 2021
082d804
had the wrong command line arg for disable cov
seankane-msft Jan 22, 2021
f3718a9
changing live tests to be a staged job
seankane-msft Jan 22, 2021
d6d3b37
fixing the appconfig tests.yml file
seankane-msft Jan 22, 2021
8e40e61
changing EnvVars to have a full description
seankane-msft Jan 22, 2021
841722f
changing parameters to have full info type and default
seankane-msft Jan 22, 2021
5468705
trying to figure out params
seankane-msft Jan 22, 2021
0162da3
changing params in the jobs file
seankane-msft Jan 22, 2021
7c1b31f
fixed parameters in the templates/jobs file, making sure it is correc…
seankane-msft Jan 22, 2021
8832b17
adding params to the stages file, fixing the appconfig tests.yml file
seankane-msft Jan 22, 2021
1ef3ebd
fixed a spacing issue
seankane-msft Jan 22, 2021
0ba995d
fixing up create coverage.py file
seankane-msft Jan 22, 2021
3637010
forgot the directory for the coverage install
seankane-msft Jan 22, 2021
fe6fbdc
fixing a merge conflict
seankane-msft Jan 22, 2021
be75131
commenting out the pool for now
seankane-msft Jan 22, 2021
a470e72
adding the pool to the stages yml file
seankane-msft Jan 22, 2021
d0660b5
removing the publish step, .coverage files are published in the build…
seankane-msft Jan 25, 2021
2034b4c
setting the version of coverage
seankane-msft Jan 25, 2021
b136e2c
raise error on failure
seankane-msft Jan 25, 2021
2ee5f5e
generating code coverage xml via powershell
seankane-msft Jan 25, 2021
24f9e50
adding step to find where the .coverage file is being published to
seankane-msft Jan 25, 2021
1eae302
changing regex, listing all files in working directory
seankane-msft Jan 25, 2021
f93b115
changed the running dir to the root instead of the coverage_dir
seankane-msft Jan 25, 2021
ae82df3
removing the raise exception on run_check_call in gen_cov_xml()
seankane-msft Jan 25, 2021
045ceda
cleaning up yml files for ben to branch off of
seankane-msft Jan 25, 2021
02840d9
removing --appends, coverage file is not generating correctly
seankane-msft Jan 25, 2021
7cffffc
adding check to see if coverage is generated blank
seankane-msft Jan 25, 2021
3acabcc
changing pwsh cmd to see what the .coverage files look like after Run…
seankane-msft Jan 25, 2021
f88f7da
added a new python script to change the file structure
seankane-msft Jan 25, 2021
e35217f
cleaning up some unnecessary commands
seankane-msft Jan 25, 2021
f031835
changing the storage test pipeline
seankane-msft Jan 27, 2021
f16bacd
merge conflict
seankane-msft Jan 27, 2021
e60a29f
undoing changes to storage tests
seankane-msft Jan 27, 2021
978efc2
trying tox in parallel mode
seankane-msft Jan 28, 2021
6dd6722
removing comment, no comments in tox files i guess
seankane-msft Jan 28, 2021
91b1662
moving --parallel-mode to the yml file
seankane-msft Jan 28, 2021
a0a5743
undoing changes, parallel mode does not work with pytest-cov
seankane-msft Jan 28, 2021
045241d
ideas from krista
seankane-msft Jan 28, 2021
de63dff
Update eng/pipelines/templates/jobs/publish-coverage.yml
seankane-msft Jan 28, 2021
5a8d846
Merge branch 'append-code-cov' of https://github.com/Azure/azure-sdk-…
seankane-msft Jan 28, 2021
54cd83d
moving pip install to different step
seankane-msft Jan 28, 2021
c02ca67
fixing syntax error
seankane-msft Jan 28, 2021
c220147
making a change based on response to filed issue
seankane-msft Jan 28, 2021
93bde28
updating paths portion of .coveragerc
seankane-msft Jan 28, 2021
08cb29f
changed eventhub test.yml file too
seankane-msft Jan 29, 2021
4dec3b3
syntax error
seankane-msft Jan 29, 2021
2454baf
changing to stages instead of extends, thanks ben broderick
seankane-msft Jan 29, 2021
26baa25
adding step to show entire .coverage files
seankane-msft Jan 29, 2021
fc86a18
fixing up powershell script
seankane-msft Jan 29, 2021
6bee0f6
fixing part where mgmt package was not being included because it was …
seankane-msft Jan 29, 2021
68e4a9e
fixed the python script a bit
seankane-msft Jan 29, 2021
a0e09f5
cleaning up create_coverage.py script
seankane-msft Jan 29, 2021
fdbc0d0
addressing comments from ben and wes
seankane-msft Feb 1, 2021
d9d1a31
removing commented out sections
seankane-msft Feb 1, 2021
ef88e77
making changes to keyvault and storage
seankane-msft Feb 1, 2021
0138364
changing the yml path being pointed to
seankane-msft Feb 1, 2021
27e1aca
Use unique stage names for live tests (#16454)
benbp Feb 1, 2021
9add276
adjusting sdk tests.yml files
seankane-msft Feb 1, 2021
735d0b8
removing default test matrix params from jobs/archetype-sdk-tests.yml…
seankane-msft Feb 1, 2021
d8ffb63
reverting last change
seankane-msft Feb 1, 2021
9d6c925
adding a step to pip install all the ci tools
seankane-msft Feb 1, 2021
d4a4d4e
fixing up the storage file
seankane-msft Feb 1, 2021
5af7981
changing the storage tests.yml file
seankane-msft Feb 1, 2021
3cda15d
adding a pip list
seankane-msft Feb 2, 2021
4055cfb
using pip install from the build-test yml file
seankane-msft Feb 2, 2021
5af79b7
adding -i flag back
seankane-msft Feb 2, 2021
de9ba2e
adding a step to pin to python 3.7 and always run on ubuntu 18.04
seankane-msft Feb 2, 2021
ce74997
fixing syntax errors
seankane-msft Feb 2, 2021
73f2dae
lowercase p in pool
seankane-msft Feb 2, 2021
cdbfadc
addressing scotts comments
seankane-msft Feb 2, 2021
0a60e7f
fixing storages yml files
seankane-msft Feb 2, 2021
cefb69f
traded the replace out for a regex
seankane-msft Feb 2, 2021
ad8fc63
trying a dependsOn for the keyvault yml file
seankane-msft Feb 3, 2021
62a8250
dependsOn throws a syntax error
seankane-msft Feb 3, 2021
4d27c06
removing runcoverage param
seankane-msft Feb 3, 2021
e093972
adding displayName and combining two display methods
seankane-msft Feb 3, 2021
5cf1802
changing jobs -> states
seankane-msft Feb 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ omit =
*/test*
env*

[paths]
source =
sdk/
**/sdk

[report]
exclude_lines =
pragma: no cover
Expand Down
3 changes: 2 additions & 1 deletion eng/ci_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cryptography==3.1
setuptools==44.1.0; python_version == '2.7'
setuptools==46.4.0; python_version >= '3.5'
virtualenv==20.0.23
wheel==0.34.2
wheel==0.34.2
Jinja2==2.11.2
packaging==20.4
tox==3.15.0
Expand All @@ -18,6 +18,7 @@ coverage==4.5.4
codecov==2.1.0
beautifulsoup4==4.9.1
pkginfo==1.5.0.1
pip==20.2

# locking packages defined as deps from azure-sdk-tools or azure-devtools
pytoml==0.1.21
Expand Down
24 changes: 12 additions & 12 deletions eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,31 @@ parameters:
Pool: $(LinuxPool)
OSVmImage:
PythonVersion: '2.7'
CoverageArg: ''
CoverageArg: '--disablecov'
RunForPR: true
Linux_Python35:
Pool: $(LinuxPool)
OSVmImage:
PythonVersion: '3.5'
CoverageArg: ''
CoverageArg: '--disablecov'
RunForPR: false
Linux_Python38:
Pool: $(LinuxPool)
OSVmImage:
PythonVersion: '3.8'
CoverageArg: ''
CoverageArg: '--disablecov'
RunForPR: true
Windows_Python35:
Pool: $(WindowsPool)
OSVmImage:
PythonVersion: '3.5'
CoverageArg: ''
CoverageArg: '--disablecov'
RunForPR: true
MacOS_Python27:
Pool:
OSVmImage: 'macOS-10.15'
PythonVersion: '2.7'
CoverageArg: ''
CoverageArg: '--disablecov'
RunForPR: false
Linux_pypy3:
Pool: $(LinuxPool)
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:

steps:
- template: ../steps/build-artifacts.yml
parameters:
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
BuildTargetingString: ${{ parameters.BuildTargetingString }}
BeforePublishSteps: ${{ parameters.BeforePublishSteps }}
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
CheckLinkGuidance: $true

- template: ../steps/analyze.yml
parameters:
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
BuildTargetingString: ${{ parameters.BuildTargetingString }}
TestMarkArgument: ${{ parameters.TestMarkArgument }}
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
${{ if or(eq(matrixEntry.value.RunForPR, 'true'), ne(variables['Build.Reason'], 'PullRequest')) }}:
${{ matrixEntry.key }}:
${{ insert }}: ${{ matrixEntry.value }}

pool:
name: $[coalesce(variables['Pool'], '')]
vmImage: $[coalesce(variables['OSVmImage'], '')]
Expand All @@ -195,7 +195,7 @@ jobs:
{
$toxenvvar = '$(Run.ToxCustomEnvs)'
}

echo "##vso[task.setvariable variable=toxenv]$toxenvvar"
displayName: "Set Tox Environment"

Expand All @@ -211,10 +211,10 @@ jobs:
ToxTestEnv: $(toxenv)
ToxEnvParallel: ${{ parameters.ToxEnvParallel }}
InjectedPackages: $(InjectedPackages)
BeforeTestSteps:
BeforeTestSteps:
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'artifacts'
artifactName: 'artifacts'
targetPath: $(Build.ArtifactStagingDirectory)

- template: ../steps/set-dev-build.yml
Expand All @@ -237,6 +237,6 @@ jobs:

steps:
- template: ../steps/test_regression.yml
parameters:
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
BuildTargetingString: ${{ parameters.BuildTargetingString }}
126 changes: 81 additions & 45 deletions eng/pipelines/templates/jobs/archetype-sdk-tests.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,85 @@
parameters:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @benbp I know you are working on refactoring this file and so you will likely conflict with this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weshaggard I chatted with Sean and was waiting for these changes to land first, hence why I did Java instead.

ServiceDirectory: ''
EnvVars: {}
MaxParallel: 0
BeforeTestSteps: []
AfterTestSteps: []
BuildTargetingString: 'azure-*'
AdditionalTestArgs: ''
TestMarkArgument: ''
InjectedPackages: ''
BuildDocs: true
JobName: Test
AllocateResourceGroup: true
DeployArmTemplate: false
TestTimeoutInMinutes: 120
TestSamples: false
Location: ''
Matrix:
Linux_Python35:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
PythonVersion: '3.5'
CoverageArg: '--disablecov'
MacOs_Python37:
Pool: Azure Pipelines
OSVmImage: 'macOS-10.15'
PythonVersion: '3.7'
CoverageArg: '--disablecov'
Windows_Python27:
Pool: azsdk-pool-mms-win-2019-general
OSVmImage: MMS2019
PythonVersion: '2.7'
CoverageArg: '--disablecov'
Linux_PyPy3:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
PythonVersion: 'pypy3'
CoverageArg: '--disablecov'
Linux_Python39:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
PythonVersion: '3.9'
CoverageArg: ''
CloudConfigurations:
AzureCloud:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
- name: ServiceDirectory
type: string
default: ''
- name: EnvVars
type: object
default: {}
- name: MaxParallel
type: number
default: 0
- name: BeforeTestSteps
type: object
default: []
- name: AfterTestSteps
type: object
default: []
- name: BuildTargetingString
type: string
default: 'azure-*'
- name: AdditionalTestArgs
type: string
default: ''
- name: TestMarkArgument
type: string
default: ''
- name: InjectedPackages
type: string
default: ''
- name: BuildDocs
type: boolean
default: true
- name: JobName
type: string
default: 'Test'
- name: AllocateResourceGroup
type: boolean
default: true
- name: DeployArmTemplate
type: boolean
default: false
- name: TestTimeoutInMinutes
type: number
default: 120
- name: TestSamples
type: boolean
default: false
- name: Location
type: string
default: ''
- name: Matrix
type: object
default:
Linux_Python35:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
PythonVersion: '3.5'
CoverageArg: '--disablecov'
MacOs_Python37:
Pool: Azure Pipelines
OSVmImage: 'macOS-10.15'
PythonVersion: '3.7'
CoverageArg: '--disablecov'
Windows_Python27:
Pool: azsdk-pool-mms-win-2019-general
OSVmImage: MMS2019
PythonVersion: '2.7'
CoverageArg: '--disablecov'
Linux_PyPy3:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
PythonVersion: 'pypy3'
CoverageArg: '--disablecov'
Linux_Python39:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
PythonVersion: '3.9'
CoverageArg: ''
- name: CloudConfigurations
type: object
default:
AzureCloud:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)

jobs:
- ${{ each cloudConfig in parameters.CloudConfigurations }}:
Expand Down
67 changes: 67 additions & 0 deletions eng/pipelines/templates/jobs/publish-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
parameters:
- name: ServiceDirectory
type: string
default: ''
- name: Artifacts
type: object
default: []
- name: DependsOn
type: string
default: ''


jobs:
- job: Publish_Code_Coverage
pool:
name: azsdk-pool-mms-ubuntu-1804-general
vmImage: MMSUbuntu18.04

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'

# Download all existing artifacts (most of the time, it's whatever was uploaded before)
- pwsh: |
New-Item -Path $(Build.SourcesDirectory) -Name "_all_coverage_files" -ItemType "directory"
displayName: 'Create all coverages directory'
continueOnError: false
condition: succeededOrFailed()

- task: DownloadPipelineArtifact@2
inputs:
source: current
path: '$(Build.SourcesDirectory)/_all_coverage_files'

- script: |
pip install -r eng/ci_tools.txt
pip freeze
displayName: 'Prep Environment'

- pwsh: |
Get-ChildItem -Recurse .\_all_coverage_files\ |
ForEach-Object {
If (Test-Path $_ -PathType Leaf) {
Get-Content $_
}
}
displayName: Show all coverage files

seankane-msft marked this conversation as resolved.
Show resolved Hide resolved
- task: PythonScript@0
displayName: 'Create Coverage Report'
inputs:
scriptPath: 'scripts/devops_tasks/create_coverage.py'

- pwsh: |
Get-Content $(Build.SourcesDirectory)\.coverage
Get-Content $(Build.SourcesDirectory)\coverage.xml
continueOnError: true
displayName: Show .coverage and coverage.xml file

- task: PublishCodeCoverageResults@1
displayName: 'Publish Code Coverage to DevOps'
continueOnError: true
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/coverage.xml'
Loading