-
Notifications
You must be signed in to change notification settings - Fork 8
/
azure-pipelines.yml
131 lines (113 loc) · 3.51 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# ASP.NET Core
# Build and test ASP.NET Core web applications targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/vsts/pipelines/languages/dotnet-core
pool:
vmImage: 'windows-latest'
trigger:
branches:
include:
- main
- refs/tags/*
schedules:
- cron: '0 0 * * *'
displayName: Daily Build
always: true
branches:
include:
- main
variables:
buildConfiguration: 'Release'
${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
release: true
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.x'
- task: gitversion/execute@0
displayName: Determine Version
# https://dotnet.microsoft.com/download/dotnet-core/3.1
- task: UseDotNet@2
displayName: Install .Net Core 3.1.200 LTS
inputs:
packageType: 'sdk'
version: '3.1.200'
# https://dotnet.microsoft.com/download/dotnet/5.0
- task: UseDotNet@2
displayName: Install .Net Core 5.0.101
inputs:
packageType: 'sdk'
version: '5.0.101'
# https://dotnet.microsoft.com/download/dotnet/6.0
- task: UseDotNet@2
displayName: Install .Net 6.0.101
inputs:
packageType: 'sdk'
version: '6.0.101'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration) /p:Version=$(GitVersion.SemVer)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: |
**/tests/*.Tests/*.csproj
**/tests/*.IntegrationTests/*.csproj
arguments: '--configuration $(buildConfiguration) --no-build --collect:"XPlat Code Coverage" --settings coverlet.runsettings'
# Release: triggered by a version tag
- task: DotNetCoreCLI@2
displayName: NuGet Pack Opw.HttpExceptions
condition: and(succeeded(), eq(variables['release'], true))
inputs:
command: pack
packagesToPack: '**/Opw.HttpExceptions.csproj'
nobuild: true
versioningScheme: byEnvVar
versionEnvVar: 'GitVersion.NuGetVersion'
- task: DotNetCoreCLI@2
displayName: NuGet Pack Opw.HttpExceptions.AspNetCore
condition: and(succeeded(), eq(variables['release'], true))
inputs:
command: pack
packagesToPack: '**/Opw.HttpExceptions.AspNetCore.csproj'
nobuild: true
versioningScheme: byEnvVar
versionEnvVar: 'GitVersion.NuGetVersion'
- task: NuGetCommand@2
displayName: NuGet Push
condition: and(succeeded(), eq(variables['release'], true))
inputs:
command: push
nuGetFeedType: external
publishFeedCredentials: NuGet
versioningScheme: byEnvVar
versionEnvVar: 'GitVersion.NuGetVersion'
- task: GithubRelease@0
displayName: Create GitHub Release
condition: and(succeeded(), eq(variables['release'], true))
inputs:
gitHubConnection: 'github.com'
repositoryName: $(Build.Repository.Name)
action: create
target: $(Build.SourceVersion)
tagSource: auto
tag: '$(GitVersion.SemVer)'
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
displayName: 'Generate Code Coverage Report'
inputs:
reports: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
targetdir: '$(build.artifactstagingdirectory)/coverage/'
- task: PublishCodeCoverageResults@1
displayName: 'Publish Code Coverage Results'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(build.artifactstagingdirectory)/coverage/cobertura.xml'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
condition: always()
inputs:
PathtoPublish: $(build.artifactstagingdirectory)