This repository has been archived by the owner on Apr 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
132 lines (110 loc) · 3.78 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
132
# Azure DevOps Pipeline
name: $(Date:yyyyMMdd)$(Rev:r)
variables:
dotnetBuildConfiguration: 'Release'
dotnetVerbosity: 'Detailed'
trigger:
- master
stages:
- stage: BuildNuget
displayName: 'Build NuGet packages'
jobs:
- job: BuildTestPackageNuGet
displayName: 'Build'
strategy:
matrix:
Windows:
vmImage: 'windows-latest'
artifactName: 'nuget-windows'
macOS:
vmImage: 'macOS-latest'
artifactName: 'nuget-macos'
Linux:
vmImage: 'ubuntu-latest'
artifactName: 'nuget-linux'
maxParallel: 3
pool:
vmImage: '$(vmImage)'
variables:
pathToBuildProjects: '**/**/*.*sproj'
pathToTestProjects: '**/test/**/*.Test.*sproj'
pathToPackProjects: '**/src/**/*.*sproj'
pathToNugetPackages: '**/*.nupkg'
sourceRepositoryBranch: '$(Build.SourceBranchName)'
sourceRepositoryCommit: '$(Build.SourceVersion)'
steps:
- task: UseDotNet@2
displayName: 'Install: .NET Core SDK'
inputs:
useGlobalJson: true
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '$(pathToBuildProjects)'
arguments: '--verbosity $(dotnetVerbosity)'
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: build
projects: '$(pathToBuildProjects)'
arguments: '--configuration $(dotnetBuildConfiguration) --verbosity $(dotnetVerbosity)'
- task: DotNetCoreCLI@2
displayName: 'dotnet pack: ci'
inputs:
command: custom
custom: pack
projects: '$(pathToPackProjects)'
arguments: '--output "$(Build.ArtifactStagingDirectory)/ci" --configuration $(dotnetBuildConfiguration) --verbosity $(dotnetVerbosity) /p:Configuration=$(dotnetBuildConfiguration) /p:RepositoryBranch=$(sourceRepositoryBranch) /p:RepositoryCommit=$(sourceRepositoryCommit) /p:VersionSuffix=ci-$(Build.BuildNumber)'
- task: DotNetCoreCLI@2
displayName: 'dotnet pack: release'
inputs:
command: custom
custom: pack
projects: '$(pathToPackProjects)'
arguments: '--output "$(Build.ArtifactStagingDirectory)/release" --configuration $(dotnetBuildConfiguration) --verbosity $(dotnetVerbosity) /p:Configuration=$(dotnetBuildConfiguration) /p:RepositoryBranch=$(sourceRepositoryBranch) /p:RepositoryCommit=$(sourceRepositoryCommit)'
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: '$(pathToTestProjects)'
arguments: '--configuration $(dotnetBuildConfiguration) --collect "Code coverage"'
- publish: '$(Build.ArtifactStagingDirectory)'
artifact: '$(artifactName)'
- stage: BuildSamples
displayName: 'Build samples'
dependsOn: []
jobs:
- job: BuildTestSamples
displayName: 'Build'
strategy:
matrix:
Windows:
vmImage: 'windows-latest'
artifactName: 'samples-windows'
macOS:
vmImage: 'macOS-latest'
artifactName: 'samples-macos'
Linux:
vmImage: 'ubuntu-latest'
artifactName: 'samples-linux'
maxParallel: 3
pool:
vmImage: '$(vmImage)'
variables:
pathToPublishProjects: '**/samples/**/*.*sproj'
steps:
- task: UseDotNet@2
displayName: 'Install: .NET Core SDK'
inputs:
useGlobalJson: true
- task: DotNetCoreCLI@2
displayName: 'dotnet publish'
inputs:
command: publish
publishWebProjects: true
zipAfterPublish: true
projects: '$(pathToPublishProjects)'
arguments: '--configuration $(dotnetBuildConfiguration) --output $(build.artifactstagingdirectory)'
- publish: '$(Build.ArtifactStagingDirectory)'
artifact: '$(artifactName)'