forked from mgroupntua/Constitutive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
240 lines (204 loc) · 9.01 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# .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'
steps:
- task: PowerShell@2
displayName: Install gitversion.tool
inputs:
targetType: inline
script: dotnet tool install --tool-path .. gitversion.tool
pwsh: true
- task: PowerShell@2
displayName: Set SemVer from git history
inputs:
targetType: inline
script: ../dotnet-gitversion /output buildserver
pwsh: true
- task: SonarCloudPrepare@1
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: "Prepare SonarCloud analysis"
inputs:
SonarCloud: 'SonarCloud'
organization: 'mgroupntua'
scannerMode: 'MSBuild'
projectKey: 'MSolve.Constitutive'
extraProperties: 'sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/coverage/coverage.opencover.xml'
- task: DotNetCoreCLI@2
name: dotnetRestore
displayName: "Restore nugets"
inputs:
command: 'restore'
verbosityRestore: 'Normal'
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
- 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: Run 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;
pwsh: true
- task: CopyFiles@2
enabled: true
displayName: Copy Constitutive project on MSolve.Tests
inputs:
sourceFolder: 'D:\a\1\s'
Contents: |
**/*
!integrationTests/**/*
targetFolder: 'D:\a\1\s\integrationTests\Constitutive'
cleanTargetFolder: true # Optional
- task: PowerShell@2
enabled: true
displayName: Clone FEM in Integration Tests
inputs:
targetType: inline
script: cd integrationTests ; git clone https://github.com/mgroupntua/FEM.git ; dir ;
pwsh: true
- script: dotnet remove D:\a\1\s\integrationTests\FEM\src\MGroup.FEM.Structural\MGroup.FEM.Structural.csproj package MGroup.Constitutive.Structural
displayName: Remove Package Constitutive.Structural from FEM.Structural
enabled: true
- script: dotnet add D:\a\1\s\integrationTests\FEM\src\MGroup.FEM.Structural\MGroup.FEM.Structural.csproj reference D:\a\1\s\integrationTests\Constitutive\src\MGroup.Constitutive.Structural\MGroup.Constitutive.Structural.csproj
displayName: Add project ref Constitutive.Structural to FEM.Structural
enabled: true
- script: dotnet remove D:\a\1\s\integrationTests\FEM\src\MGroup.FEM.Thermal\MGroup.FEM.Thermal.csproj package MGroup.Constitutive.Thermal
displayName: Remove Package Constitutive.Thermal from FEM.Thermal
enabled: true
- script: dotnet add D:\a\1\s\integrationTests\FEM\src\MGroup.FEM.Thermal\MGroup.FEM.Thermal.csproj reference D:\a\1\s\integrationTests\Constitutive\src\MGroup.Constitutive.Thermal\MGroup.Constitutive.Thermal.csproj
displayName: Add project ref Constitutive.Thermal to FEM.Thermal
enabled: true
- script: dotnet remove D:\a\1\s\integrationTests\FEM\src\MGroup.FEM.ConvectionDiffusion\MGroup.FEM.ConvectionDiffusion.csproj package MGroup.Constitutive.ConvectionDiffusion
displayName: Remove Package Constitutive.ConvectionDiffusion from FEM.ConvectionDiffusion
enabled: true
- script: dotnet add D:\a\1\s\integrationTests\FEM\src\MGroup.FEM.ConvectionDiffusion\MGroup.FEM.ConvectionDiffusion.csproj reference D:\a\1\s\integrationTests\Constitutive\src\MGroup.Constitutive.ConvectionDiffusion\MGroup.Constitutive.ConvectionDiffusion.csproj
displayName: Add project ref Constitutive.ConvectionDiffusion to FEM.ConvectionDiffusion
enabled: true
- 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 from MSolve.Tests
enabled: true
- 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 to MSolve.Tests
enabled: true
- 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 from MSolve.Tests
enabled: true
- 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 to MSolve.Tests
enabled: true
- 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 from MSolve.Tests
enabled: true
- 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 to MSolve.Tests
enabled: true
- 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: "Perform SonarCloud Analysis"
- task: SonarCloudPublish@1
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: 'Publish Quality Gate results'
inputs:
pollingTimeoutSec: '300'
- task: PublishCodeCoverageResults@1
enabled: false
displayName: 'Publish code coverage results'
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: "Package new nugets"
inputs:
command: 'pack'
arguments: '--nologo --no-restore'
nobuild: true
# includesymbols: true
# includesource: 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: "Publish 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: 'Minimal'
feedPublish: 'MSolve/MGroup'
- task: DotNetCoreCLI@2
enabled: false
condition: ne(variables['Build.Reason'], 'PullRequest')
name: dotnetPushSymbolPublic
displayName: "Publish symbol nugets"
inputs:
command: 'push'
searchPatternPush: '$(Build.ArtifactStagingDirectory)/*.snupkg'
feedPublish: 'MSolve/MGroup'