1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 20:10:05 +00:00
DirectXTex/build/DirectXTex-OneFuzz-Coverage.yml
2024-04-03 20:48:00 -07:00

82 lines
2.1 KiB
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248926
# OneFuzz code coverage pipeline
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
workspace:
clean: all
steps:
- task: CmdLine@2
displayName: 'Fetch source'
inputs:
script: |
git clone --quiet --no-tags https://%GITHUBPUBLICTOKEN%@github.com/microsoft/DirectXTex.git
cd DirectXTex
git checkout $(commit-ID)
git clone --quiet --no-tags https://%GITHUBPUBLICTOKEN%@github.com/walbourn/directxtextest.git Tests
workingDirectory: $(Build.SourcesDirectory)
failOnStderr: true
- 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: 'Get code coverage from OneFuzz'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: ./$(container-name)\$(coverage-file)
pathToSources: $(Build.SourcesDirectory)
displayName: 'Generate coverage report'