-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
110 lines (87 loc) · 3.84 KB
/
azure-pipelines.yml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
branches:
include:
- master
- develop
paths:
exclude:
- README.md
- CHANGELOG.md
- CONTRIBUTING.md
pool:
vmImage: 'vs2017-win2016'
variables:
BuildConfiguration: 'Release'
DotNetCoreVersion: '2.2.203'
BuildPlatform: 'Any CPU'
SolutionName: 'TheSolution'
major: 1
minor: 0
# creates a counter called versioncounter and seeds it at 100 and then assigns the value to a variable named buildNo.
buildNo: $[counter('geomversioncounter', 100)]
version: '$(major).$(minor).$(buildNo)'
CIVersionSuffix: 'CI'
PreReleaseVersionSuffix: 'beta-1'
DoPreRelease: false
steps:
- script: echo Build.Reason:$(Build.Reason) version:$(version) DoPreRelease:$(DoPreRelease)
displayName: 'BuildNumber'
- task: DotNetCoreInstaller@0
displayName: Install .NET Core $(DotNetCoreVersion)
inputs:
version: $(DotNetCoreVersion)
- script: dotnet restore ./src/$(SolutionName).sln
displayName: dotnet restore
- script: dotnet build --configuration $(buildConfiguration) /p:AssemblyVersion=$(version) ./src/$(SolutionName).sln
displayName: 'dotnet build $(buildConfiguration)'
# do this after your tests have run
- script: dotnet test ./src/xUnit_TheWebAppTests --logger trx --collect "Code coverage" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
displayName: Unit Test Reports
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
TargetFolder: '$(Build.SourcesDirectory)\Results'
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
**\coverage.cobertura.xml
- script: dotnet tool install dotnet-reportgenerator-globaltool --tool-path . --version 4.1.4
displayName: Install dotnet-reportgenerator-globaltool
- script: .\reportgenerator "-reports:$(Build.SourcesDirectory)/src/xUnit_TheWebAppTests/coverage.cobertura.xml" "-targetdir:results" "-reporttypes:HTMLInline;HTMLChart"
displayName: Unit Test Reports
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
- task: PublishCodeCoverageResults@1
inputs:
summaryFileLocation: $(Build.SourcesDirectory)/results/src/xUnit_TheWebAppTests\coverage.cobertura.xml
reportDirectory: $(Build.SourcesDirectory)\results
codecoverageTool: cobertura
- script: dotnet publish --no-restore --no-build --self-contained --configuration $(buildConfiguration) --version-suffix $(CIVersionSuffix) /property:Version=$(version)-CI ./src/$(SolutionName).sln
displayName: dotnet publish CI
condition: and(succeeded(), eq(variables['DoPreRelease'], 'false'))
- script: dotnet pack --no-build --include-source --include-symbols /property:Version=$(version) --version-suffix $(PreReleaseVersionSuffix) ./src/$(SolutionName).sln
displayName: dotnet pack PreRelease
condition: and(succeeded(), eq(variables['DoPreRelease'], 'true'))
- script: dotnet pack --no-build --include-source --include-symbols /property:Version=$(version) --version-suffix $(CIVersionSuffix) ./src/$(SolutionName).sln
displayName: dotnet pack CI
condition: and(succeeded(), eq(variables['DoPreRelease'], 'false'))
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
TargetFolder: '$(Build.ArtifactStagingDirectory)'
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
**\results\**
**\publish\**
**\bin\**\*.nupkg
!.git/**/*
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop