This repository was archived by the owner on Dec 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
69 lines (57 loc) · 2.5 KB
/
azure-pipelines.yml
File metadata and controls
69 lines (57 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
trigger:
branches:
include:
- master
- develop
- hotfix*
paths:
exclude:
- .editorconfig
- build.ps1
- README.md
- stylecop.json
# Must be Windows due to the .NET 4.5 build target
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
buildVersion: '0.0.0'
projectPath: '.\Net.Http.OData\Net.Http.OData.csproj'
testWorkingDirectory: 'Net.Http.OData.Tests'
steps:
- script: |
dotnet tool uninstall dotnet-reportgenerator-globaltool --global
dotnet tool install --global dotnet-reportgenerator-globaltool
displayName: 'dotnet tool install dotnet-reportgenerator-globaltool'
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- script: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=.\TestResults\
displayName: 'dotnet test'
- script: reportgenerator "-reports:TestResults\coverage.cobertura.xml" "-targetdir:TestResults\Coverage" -reporttypes:HTML;
workingDirectory: $(testWorkingDirectory)
displayName: 'reportgenerator'
- task: PublishCodeCoverageResults@1
displayName: 'publish code coverage'
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(Build.SourcesDirectory)\$(testWorkingDirectory)\TestResults\coverage.cobertura.xml'
reportDirectory: '$(Build.SourcesDirectory)\$(testWorkingDirectory)\TestResults\Coverage'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$projVersion = ([xml](Get-Content "$(projectPath)")) | Select-Xml -XPath "//Project/PropertyGroup[1]/Version"
Write-Host "##vso[task.setvariable variable=buildVersion]$projVersion"
- script: dotnet pack --no-build -o:$(Build.ArtifactStagingDirectory) -p:PackageVersion="$(buildVersion)-preview$(Build.BuildNumber)"
displayName: 'dotnet pack (pre)'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
- script: dotnet pack --no-build -o:$(Build.ArtifactStagingDirectory) -p:PackageVersion=$(buildVersion)
displayName: 'dotnet pack'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: NuGetCommand@2
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet.org (Net.Http.OData)'
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))