forked from mgroupntua/LinearAlgebra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
155 lines (134 loc) · 4.56 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
# .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: 'Release'
testProject: 'tests/MGroup.LinearAlgebra.Tests'
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 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: 'LinearAlgebra'
extraProperties: |
sonar.cs.opencover.reportsPaths="$(Build.SourcesDirectory)/coverage/coverage.opencover.xml"
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-
- 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: PublishSymbols@2
displayName: "Publish symbols to Azure Devops artifacts"
inputs:
DetailedLog: true
SearchPattern: '**/bin/**/*.pdb'
IndexSources: false
SymbolServerType: 'TeamServices'
- task: DotNetCoreCLI@2
displayName: Run Tests (develop)
condition: eq(variables['Build.SourceBranch'], 'refs/heads/develop')
inputs:
command: 'test'
projects: '**/*[Tt]ests/*.csproj'
arguments: '--no-build --configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
publishTestResults: true
#- script: |
# dotnet test --logger trx --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$(Build.SourcesDirectory)/coverage/ $(testProject)
# displayName: 'Runs tests'
- 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: PublishTestResults@2
# inputs:
# testRunner: VSTest
# testResultsFiles: '**/*.trx'
- task: PublishCodeCoverageResults@1
inputs:
summaryFileLocation: $(Build.SourcesDirectory)/coverage/Cobertura/Cobertura.xml
reportDirectory: $(Build.SourcesDirectory)/coverage/Cobertura
codecoverageTool: cobertura
- 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'