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

CodeCoverage pipeline for submission to onefuzz. #4177

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Atest
ATL
AUrl
Authenticode
azcopy
azurewebsites
bcp
BEFACEF
Expand Down Expand Up @@ -66,6 +67,7 @@ CLOSEAPP
cloudapp
clsctx
clsid
cobertura
CODEOWNERS
COINIT
COMGLB
Expand Down Expand Up @@ -386,6 +388,7 @@ runtimeclass
ryfu
rzkzqaqjwj
SARL
SASURL
schematab
sddl
SECUREFILEPATH
Expand Down
70 changes: 70 additions & 0 deletions azure-pipelines.coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Code coverage pipeline required by OneFuzz
pr: none
trigger: none

pool:
vmImage: windows-latest

parameters:
- name: sasUrl
type: string
displayName: SAS URL
- name: branch
type: string
displayName: Branch
- name: jobID
type: string
displayName: OneFuzz Job ID
- name: buildDate
type: string
displayName: Build Date
- name: commitID
type: string
displayName: Commit ID

variables:
- name: coverage-file
value: cobertura-coverage.xml
- name: job-ID
value: ${{ parameters.jobID }}
- name: build-date
value: ${{ parameters.buildDate }}
- name: branch
value: ${{ parameters.branch }}
- name: sas-url
value: ${{ parameters.sasUrl }}
- name: commit-ID
value: ${{ parameters.commitID }}

jobs:
- job: prod
displayName: Prod Task
steps:
# Get source code
- script: |
git clone https://github.com/microsoft/winget-cli.git
git checkout $(commit-ID)
displayName: 'Clone winget-cli'
# Get code coverage from OneFuzz for the job
- powershell: |
Write-Host "Job ID: $(job-ID), Build Date: $(build-date), Branch: $(branch)"
$SASUrl = [System.Uri]::new("$(sas-url)")
azcopy cp $SASUrl.AbsoluteUri ./ --recursive
$ContainerName = $SASURL.LocalPath.Split("/")[1]
Write-Host "##vso[task.setvariable variable=container-name;]$ContainerName"
cd $ContainerName
$size = ((Get-Item .\$(coverage-file)).length)
if ($size -eq 0) {
Write-Host "Cobertura coverage XML is empty."
exit 1
}
displayName: PowerShell script to get coverage
# Use Cobertura report generator
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: ./$(container-name)\$(coverage-file)
pathToSources: $(System.DefaultWorkingDirectory)
displayName: Built in ADO Task that uses ReportGenerator
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -592,3 +592,4 @@ jobs:
onefuzzDropDirectory: '$(buildOutDir)\WinGetYamlFuzzing'
onefuzzDropPAT: $(onefuzzDropPAT)
onefuzzFilingBugPAT: $(onefuzzBugFilingPAT)
onefuzzCodeCoveragePAT: $(onefuzzCodeCoveragePAT)
5 changes: 5 additions & 0 deletions src/WinGetYamlFuzzing/OneFuzzConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"AssignedTo": "ryfu@microsoft.com",
"AreaPath": "OS\\Windows Client and Services\\ADEPT\\E4D-Engineered for Developers\\InstaDev",
"IterationPath": "OS"
},
"codeCoverage": {
"org": "ms",
"project": "winget-cli",
"pipelineId": "Pipeline ID"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This id will be updated once the pipeline is created.

}
}
]
Expand Down
Loading