-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathazure-pipelines.yml
193 lines (168 loc) · 6.1 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
####################################################################
# VSTS Build Configuration, Version 1.4
#
# (c)2022 superdev GmbH
####################################################################
name: $[format('{0}', variables['buildName'])]
pool:
vmImage: 'windows-2022'
trigger:
branches:
include:
- master
- develop
- feature/*
- bugfix/*
paths:
exclude:
- Docs/*
variables:
solution: 'ValueConverters.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
majorVersion: 3
minorVersion: 1
patchVersion: $[counter(format('{0}.{1}', variables.majorVersion, variables.minorVersion), 0)]
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
# Versioning: 1.0.0
semVersion: $[format('{0}.{1}.{2}', variables.majorVersion, variables.minorVersion, variables.patchVersion)]
${{ if and(ne(variables['Build.SourceBranch'], 'refs/heads/master'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) }}:
# Versioning: 1.0.0-pre
semVersion: $[format('{0}.{1}.{2}-pre', variables.majorVersion, variables.minorVersion, variables.patchVersion)]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}:
# Versioning: 1.0.0-pr.000000001
semVersion: $[format('{0}.{1}.{2}-pr.{3}', variables.majorVersion, variables.minorVersion, variables.patchVersion, variables['System.PullRequest.PullRequestId'])]
buildName: $[format('{0}', variables.semVersion)]
steps:
- task: Bash@3
displayName: 'Print all variables'
inputs:
targetType: 'inline'
script: 'env | sort'
- task: Assembly-Info-NetFramework@2
displayName: 'Update Assembly Info (.NET Framework)'
inputs:
Path: '$(Build.SourcesDirectory)'
FileNames: '**\AssemblyInfo.cs'
InsertAttributes: true
FileEncoding: 'auto'
WriteBOM: false
Title: 'ValueConverters.NET'
Description: ''
Company: 'superdev GmbH'
Copyright: '(c) $(date:YYYY) superdev GmbH'
VersionNumber: '$(Build.BuildNumber)'
FileVersionNumber: '$(Build.BuildNumber)'
InformationalVersion: '$(Build.BuildNumber)'
LogLevel: 'verbose'
FailOnWarning: false
DisableTelemetry: false
- task: Assembly-Info-NetCore@2
displayName: 'Update Assembly Info (.NET Core/Standard)'
inputs:
Path: '$(Build.SourcesDirectory)'
FileNames: |
**/*.csproj
InsertAttributes: true
FileEncoding: 'auto'
WriteBOM: false
Product: 'ValueConverters.NET'
Description: ''
Company: 'superdev GmbH'
Copyright: '(c) $(date:YYYY) superdev GmbH'
VersionNumber: '$(Build.BuildNumber)'
FileVersionNumber: '$(Build.BuildNumber)'
InformationalVersion: '$(Build.BuildNumber)'
PackageVersion: '$(Build.BuildNumber)'
LogLevel: 'verbose'
FailOnWarning: false
DisableTelemetry: false'
- task: UseDotNet@2
displayName: 'Use .NET 8.x'
inputs:
version: 8.x
- task: Bash@3
displayName: Install .NET MAUI
inputs:
targetType: 'inline'
script: |
dotnet nuget locals all --clear
dotnet workload install maui android ios maui-android maui-ios --source https://api.nuget.org/v3/index.json
- task: JavaToolInstaller@0
displayName: "Install Java"
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 6.x'
inputs:
versionSpec: 6.x
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(solution)'
msbuildArgs: ''
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Run UnitTests'
inputs:
command: test
projects: '**/*.Tests.csproj'
arguments: '--no-restore --no-build --configuration $(buildConfiguration) /p:CollectCoverage=true /p:Exclude="[Microsoft*]*%2C[Mono*]*%2C[xunit*]*%2C[*.Testdata]*" /p:CoverletOutput=UnitTests.coverage.cobertura.xml /p:MergeWith=$(Build.SourcesDirectory)/Tests/CoverletOutput/coverage.json /p:CoverletOutputFormat=cobertura'
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
displayName: 'Create Code Coverage Report'
inputs:
reports: '$(Build.SourcesDirectory)/Tests/**/*.coverage.cobertura*.xml'
targetdir: '$(Build.SourcesDirectory)/CodeCoverage'
reporttypes: 'Cobertura'
assemblyfilters: '-xunit*'
- task: NuGetCommand@2
displayName: 'Pack ValueConverters'
inputs:
command: custom
arguments: pack ValueConverters.nuspec -Version $(semVersion) -NoPackageAnalysis -outputdirectory $(Build.ArtifactStagingDirectory)\artifacts
- task: NuGetCommand@2
displayName: 'Pack ValueConverters.Forms'
inputs:
command: custom
arguments: pack ValueConverters.Forms.nuspec -Version $(semVersion) -NoPackageAnalysis -outputdirectory $(Build.ArtifactStagingDirectory)\artifacts
- task: DotNetCoreCLI@2
displayName: 'Pack ValueConverters.MAUI'
inputs:
command: pack
packagesToPack: ValueConverters.MAUI/ValueConverters.MAUI.csproj
versioningScheme: byEnvVar
versionEnvVar: semVersion
nobuild: true
packDirectory: $(Build.ArtifactStagingDirectory)\artifacts
- task: DotNetCoreCLI@2
displayName: 'Pack ValueConverters.Annotations'
inputs:
command: pack
packagesToPack: ValueConverters.Annotations/ValueConverters.Annotations.csproj
versioningScheme: byEnvVar
versionEnvVar: semVersion
nobuild: true
packDirectory: $(Build.ArtifactStagingDirectory)\artifacts
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: |
**\bin\$(BuildConfiguration)\**
**\bin\*.nupkg
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
reportDirectory: '$(Build.SourcesDirectory)/CodeCoverage'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'