-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
164 lines (145 loc) · 5.57 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
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- trunk
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
#TEXTANALYTIC_API_KEY: $(TEXTANALYTIC_API_KEY)
#COMPUTERVISION_API_KEY: $(ComputerVisionApiKey)
#FACE_API_KEY: $(FaceApiKey)
stages:
- stage: Build_Package
jobs:
- job: BuildAndPackage
pool:
vmImage: 'windows-latest'
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.3.0'
- task: DotNetCoreInstaller@1
displayName: 'Use .NET Core sdk 3.1.100'
inputs:
version: 3.1.100
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
projects: '**/*.csproj'
noCache: true
condition: succeeded()
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'Glavs SonarCloud'
organization: 'glav-github'
scannerMode: 'MSBuild'
projectKey: 'CognitiveFluentApi'
projectName: 'Azure Cognitive Services Fluent API'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions=**/*.bin
sonar.organization=glav-github
sonar.cs.vscoveragexml.reportsPaths=$(Agent.TempDirectory)/**/*.coveragexml
condition: succeeded()
- task: VSBuild@1
displayName: 'Build solution **\*.sln'
inputs:
solution: '**\*.sln'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
condition: succeeded()
- task: DotNetCoreCLI@2
displayName: 'Unit Tests'
inputs:
command: test
projects: 'Tests\Glav.CognitiveServices.UnitTests\Glav.CognitiveServices.UnitTests.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build --collect "Code Coverage"'
condition: succeeded()
- task: DotNetCoreCLI@2
displayName: 'Integration Tests'
inputs:
command: test
projects: 'Tests\Glav.CognitiveServices.IntegrationTests\Glav.CognitiveServices.IntegrationTests.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build --collect "Code Coverage" --verbosity normal'
condition: succeeded()
- task: AzurePowerShell@4
inputs:
azureSubscription: 'Azure Free Trial'
ScriptType: 'InlineScript'
Inline: |
$ver = (Get-ChildItem $env:USERPROFILE\.nuget\packages\Microsoft.CodeCoverage | Select-Object -Property Name | Sort-Object -Descending | Select-Object -First 1).Name
Get-ChildItem -Recurse -Filter "*.coverage" | % {
$outfile = "$([System.IO.Path]::GetFileNameWithoutExtension($_.FullName)).coveragexml"
$output = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($_.FullName), $outfile)
"Analyse [$($_.FullName)] with output [$output]..."
. $env:USERPROFILE\.nuget\packages\microsoft.codecoverage\$ver\build\netstandard1.0\CodeCoverage\CodeCoverage.exe analyze /output:$output $_.FullName
}
"Done"
azurePowerShellVersion: 'LatestVersion'
displayName: 'Convert Code coverage binary to XML'
condition: succeeded()
- task: SonarCloudAnalyze@1
displayName: 'Run Code Analysis'
condition: succeeded()
- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'
displayName: 'Publish Quality Gate Result'
condition: succeeded()
- task: PublishSymbols@1
displayName: 'Publish symbols path: '
inputs:
SearchPattern: '**\bin\**\*.pdb'
continueOnError: true
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(build.sourcesdirectory)'
Contents: '**\bin\$(BuildConfiguration)\**'
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeeded()
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: drop'
inputs:
targetPath: '$(build.artifactstagingdirectory)'
artifact: 'drop'
condition: succeeded()
- task: solidify-labs.chucknorris-build-enhancer.chuck-norris-task.ChuckNorrisTask@0
displayName: 'Chuck Norris Quotes'
- stage: Deployment
jobs:
- deployment: DeployJob
displayName: DeployPackageToFeed
pool:
vmImage: 'windows-latest'
environment: Feed
strategy:
runOnce:
deploy:
steps:
- task: AzurePowerShell@4
inputs:
azureSubscription: 'Azure Free Trial'
ScriptType: 'InlineScript'
Inline: 'Write-Output "Deploy stage WIP"'
azurePowerShellVersion: 'LatestVersion'
condition: succeeded()
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: '$(Pipeline.Workspace)'
artifactName: 'drop'
- task: NuGetCommand@2
inputs:
command: 'push'
feedsToUse: 'select'
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg;!$(Pipeline.Workspace)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'CognitiveServicesFluentApiInternal'
versioningScheme: 'off'
allowPackageConflicts: true
condition: succeeded()