-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathazure-pipelines.yml
200 lines (171 loc) · 6.97 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
194
195
196
197
198
199
200
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- develop
pr:
branches:
include:
- develop
pool:
vmImage: 'windows-2019'
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
testProject: 'tests/MGroup.FEM.Tests'
steps:
- task: PowerShell@2
displayName: Install gitversion.tool v5
inputs:
targetType: inline
script: dotnet tool install --tool-path .. gitversion.tool --version 5.*
pwsh: true
- task: PowerShell@2
displayName: Set SemVer from git history and update AssemblyInfo
inputs:
targetType: inline
script: ../dotnet-gitversion /updateassemblyinfo AssemblyInfo.cs AssemblyVersionInfo.cs /output buildserver
pwsh: true
- task: DotNetCoreCLI@2
name: dotnetRestore
displayName: "Restore nugets"
inputs:
command: 'restore'
verbosityRestore: 'Normal'
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
- task: SonarCloudPrepare@1
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: "Prepares SonarCloud analysis"
inputs:
SonarCloud: 'SonarCloud'
organization: 'mgroupntua'
scannerMode: 'MSBuild'
projectKey: 'mgroupntua_FEM'
extraProperties: 'sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/coverage/coverage.opencover.xml'
projectVersion: $(GitVersion.SemVer)
- task: DotNetCoreCLI@2
name: dotnetBuild
displayName: "Build projects"
inputs:
command: 'build'
arguments: '--no-restore --nologo --configuration $(buildConfiguration) /p:AssemblyVersion=$(GitVersion.AssemblySemVer) /p:Version=$(GitVersion.SemVer) /p:SourceLinkCreate=true'
versioningScheme: 'byEnvVar'
versionEnvVar: 'GitVersion.AssemblySemVer'
- task: DotNetCoreCLI@2
enabled: true
displayName: Runs Tests (develop)
condition: eq(variables['Build.SourceBranch'], 'refs/heads/develop')
inputs:
command: 'test'
projects: '**/*[Tt]ests/*.csproj'
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
publishTestResults: true
- task: PowerShell@2
enabled: true
displayName: Clone MSolve.Tests
inputs:
targetType: inline
script: mkdir integrationTests ; cd integrationTests ; git clone https://github.com/mgroupntua/MSolve.Tests.git ; cd MSolve.Tests
pwsh: true
- task: CopyFiles@2
enabled: true
displayName: Copy FEM project on MSolve.Tests
inputs:
sourceFolder: 'D:\a\1\s'
Contents: |
**/*
!integrationTests/**/*
targetFolder: 'D:\a\1\s\integrationTests\FEM'
cleanTargetFolder: true # Optional
- script: dotnet remove D:\a\1\s\integrationTests\MSolve.Tests\tests\MGroup.FEM.Structural.Tests\MGroup.FEM.Structural.Tests.csproj package MGroup.FEM.Structural
displayName: Remove Package FEM.Structural
- script: dotnet add D:\a\1\s\integrationTests\MSolve.Tests\tests\MGroup.FEM.Structural.Tests\MGroup.FEM.Structural.Tests.csproj reference D:\a\1\s\integrationTests\FEM\src\MGroup.FEM.Structural\MGroup.FEM.Structural.csproj
displayName: Add project ref FEM.Structural
- script: dotnet remove D:\a\1\s\integrationTests\MSolve.Tests\tests\MGroup.FEM.Thermal.Tests\MGroup.FEM.Thermal.Tests.csproj package MGroup.FEM.Thermal
displayName: Remove Package FEM.Thermal
- script: dotnet add D:\a\1\s\integrationTests\MSolve.Tests\tests\MGroup.FEM.Thermal.Tests\MGroup.FEM.Thermal.Tests.csproj reference D:\a\1\s\integrationTests\FEM\src\MGroup.FEM.Thermal\MGroup.FEM.Thermal.csproj
displayName: Add project ref FEM.Thermal
- script: dotnet remove D:\a\1\s\integrationTests\MSolve.Tests\tests\MGroup.FEM.ConvectionDiffusion.Tests\MGroup.FEM.ConvectionDiffusion.Tests.csproj package MGroup.FEM.ConvectionDiffusion
displayName: Remove Package FEM.ConvectionDiffusion
- script: dotnet add D:\a\1\s\integrationTests\MSolve.Tests\tests\MGroup.FEM.ConvectionDiffusion.Tests\MGroup.FEM.ConvectionDiffusion.Tests.csproj reference D:\a\1\s\integrationTests\FEM\src\MGroup.FEM.ConvectionDiffusion\MGroup.FEM.ConvectionDiffusion.csproj
displayName: Add project ref FEM.ConvectionDiffusion
- task: DotNetCoreCLI@2
enabled: true
displayName: Runs MSolve.Tests (master)
condition: eq(variables['Build.SourceBranch'], 'refs/heads/develop')
inputs:
command: 'test'
projects: |
D:\a\1\s\integrationTests\MSolve.Tests\tests\MGroup.FEM.Structural.Tests\MGroup.FEM.Structural.Tests.csproj
D:\a\1\s\integrationTests\MSolve.Tests\tests\MGroup.FEM.Thermal.Tests\MGroup.FEM.Thermal.Tests.csproj
D:\a\1\s\integrationTests\MSolve.Tests\tests\MGroup.FEM.ConvectionDiffusion.Tests\MGroup.FEM.ConvectionDiffusion.Tests.csproj
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
publishTestResults: true
- task: PublishSymbols@2
displayName: "Publish symbols to Azure Devops artifacts"
inputs:
DetailedLog: true
SearchPattern: '**/bin/**/*.pdb'
IndexSources: false
SymbolServerType: 'TeamServices'
- task: SonarCloudAnalyze@1
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: "Performs SonarCloud Analysis"
- task: SonarCloudPublish@1
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: 'Publish Quality Gate Results'
inputs:
pollingTimeoutSec: '300'
- task: PublishCodeCoverageResults@1
inputs:
summaryFileLocation: $(Build.SourcesDirectory)/coverage/Cobertura/Cobertura.xml
reportDirectory: $(Build.SourcesDirectory)/coverage/Cobertura
codecoverageTool: cobertura
- task: DeleteFiles@1
displayName: 'Remove integration tests dir'
inputs:
contents: |
**/integrationTests/*
- task: DotNetCoreCLI@2
name: dotnetPack
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: "Packages new nugets"
inputs:
command: 'pack'
arguments: '--nologo --no-restore'
nobuild: true
versioningScheme: 'byEnvVar'
versionEnvVar: 'GitVersion.SemVer'
verbosityPack: 'Normal'
- task: CopyFiles@2
enabled: false
displayName: "Copy everything in artifacts staging directory"
inputs:
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
name: publishToFeed
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: "Publishes to pipeline artifacts"
inputs:
ArtifactName: 'drop'
- task: DotNetCoreCLI@2
name: dotnetPushNugetPublic
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: "Push nugets to public feed"
inputs:
command: 'push'
packagesToPush: '$(build.artifactStagingDirectory)/*.nupkg'
verbosityPack: 'Normal'
feedPublish: 'MSolve/MGroup'
- task: DotNetCoreCLI@2
enabled: false
condition: ne(variables['Build.Reason'], 'PullRequest')
name: dotnetPushSymbolPublic
displayName: "Publishes symbol nugets"
inputs:
command: 'push'
searchPatternPush: '$(Build.ArtifactStagingDirectory)/*.snupkg'
feedPublish: 'MSolve/MGroup'