-
-
Notifications
You must be signed in to change notification settings - Fork 168
/
azure-pipelines.yml
165 lines (160 loc) · 5.41 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
# This is the main build configuration, that build and tests the libraries
name: $(Rev:r)
variables:
BuildConfiguration: Release
TargetWindowsVMImage: windows-latest
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
jobs:
# Publish the demo website for windows-latest
- job: demo
displayName: Demo build
pool:
vmImage: $(TargetWindowsVMImage)
steps:
- task: UseDotNet@2
displayName: 'Use .NET 8.0 SDK'
inputs:
packageType: 'sdk'
version: '8.0.x'
installationPath: $(Agent.ToolsDirectory)/dotnet-demo
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: 'Demo/Demo.csproj'
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: build
arguments: '--configuration $(buildConfiguration) --no-restore --nologo "-p:Version=$(Build.BuildNumber)-development"'
projects: 'Demo/Demo.csproj'
- task: DotNetCoreCLI@2
displayName: Publish website [net8.0]
inputs:
command: publish
arguments: '--no-build --nologo --configuration $(BuildConfiguration) --output $(build.ArtifactStagingDirectory)/net8.0 /p:PackageVersion=$(Build.BuildNumber)-development --framework net8.0'
publishWebProjects: false
projects: 'Demo/Demo.csproj'
- task: PublishBuildArtifacts@1
displayName: Copy website to artifacts [net8.0]
inputs:
pathToPublish: $(build.ArtifactStagingDirectory)/net8.0
artifactName: Demo .Net 8.0
# Build the Blazor WebAssembly demo
- job: blazorWasmDemo
displayName: BlazorWasmDemo build
pool:
vmImage: $(TargetWindowsVMImage)
steps:
- task: UseDotNet@2
displayName: 'Use .NET 8.0 SDK'
inputs:
packageType: 'sdk'
version: '8.0.x'
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: 'BlazorWasmDemo/Server/BlazorWasmDemo.Server.csproj'
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: build
arguments: '--configuration $(buildConfiguration) --no-restore --nologo "-p:Version=$(Build.BuildNumber)-development"'
projects: 'BlazorWasmDemo/Server/BlazorWasmDemo.Server.csproj'
# Run unit tests for windows-latest and publish coverage
- job: test_windows
displayName: Unit test windows
pool:
vmImage: $(TargetWindowsVMImage)
steps:
- task: UseDotNet@2
displayName: 'Install .NET 6.0 SDK'
inputs:
packageType: 'sdk'
version: '6.0.x'
- task: UseDotNet@2
displayName: 'Install .NET 8.0 SDK'
inputs:
packageType: 'sdk'
version: '8.0.x'
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: 'Tests/Fido2.Tests/Fido2.Tests.csproj'
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: build
arguments: '--configuration $(buildConfiguration) --no-restore --nologo "-p:Version=$(Build.BuildNumber)-development"'
projects: 'Tests/Fido2.Tests/Fido2.Tests.csproj'
- task: DotNetCoreCLI@2
displayName: Run unit tests
inputs:
command: test
projects: 'Tests/Fido2.Tests/Fido2.Tests.csproj'
arguments: '--configuration $(buildConfiguration) --no-restore --no-build --nologo --collect:"XPlat Code Coverage"'
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
displayName: ReportGenerator
inputs:
reports: '$(Agent.TempDirectory)\**\coverage.cobertura.xml'
targetdir: '$(Build.SourcesDirectory)/CodeCoverage'
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges'
assemblyfilters: '-xunit*'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
reportDirectory: '$(Build.SourcesDirectory)/CodeCoverage'
- task: Bash@3
displayName: 'Upload coverage to Codecov'
inputs:
targetType: 'inline'
script: 'bash <(curl -s https://codecov.io/bash) -Z -t 0b864a87-d3bc-4130-b942-81909f1064c0 -f CodeCoverage/Cobertura.xml'
# Run unit tests for mac/linux
- job: test_mac_linux
displayName: Unit test mac/linux
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: 'macOS-latest'
pool:
vmImage: $(imageName)
steps:
- task: UseDotNet@2
displayName: 'Use .NET 6.0 SDK'
inputs:
packageType: 'sdk'
version: '6.0.x'
- task: UseDotNet@2
displayName: 'Use .NET 8.0 SDK'
inputs:
packageType: 'sdk'
version: '8.0.x'
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: 'Tests/Fido2.Tests/Fido2.Tests.csproj'
- task: DotNetCoreCLI@2
displayName: 'dotnet format'
inputs:
command: custom
custom: 'format'
arguments: '--verify-no-changes --no-restore'
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: build
arguments: '--configuration $(buildConfiguration) --no-restore --nologo "-p:Version=$(Build.BuildNumber)-development"'
projects: 'Tests/Fido2.Tests/Fido2.Tests.csproj'
- task: DotNetCoreCLI@2
displayName: Run unit tests
inputs:
command: test
projects: 'Tests/Fido2.Tests/Fido2.Tests.csproj'
arguments: '--configuration $(buildConfiguration) --no-restore --no-build --nologo'