-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathazure-pipelines.yml
114 lines (95 loc) · 3.46 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
trigger:
branches:
include:
- master
- prerelease
tags:
include:
- v*
pool:
vmImage: 'ubuntu-latest'
variables:
BuildConfiguration: 'Release'
${{ if startsWith(variables['build.sourceBranch'], 'refs/tags/v') }}:
versionSuffixParam: ''
versionSuffixProp: ''
${{ if not(startsWith(variables['build.sourceBranch'], 'refs/tags/v')) }}:
versionSuffixParam: '--version-suffix "preview-$(Build.BuildId)"'
versionSuffixProp: 'VersionSuffix=preview-$(Build.BuildId)'
stages:
- stage: Build
jobs:
- job: Build
steps:
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: 'restore'
restoreArguments: '--locked-mode'
feedsToUse: 'select'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
arguments: '--configuration $(BuildConfiguration) --no-restore $(versionSuffixParam)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: 'test'
projects: '*.sln'
arguments: '--configuration $(BuildConfiguration) --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
- task: PublishCodeCoverageResults@1
displayName: Publish coverage results
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/Flexinets.Ldap.Core.Tests/coverage.cobertura.xml'
failIfCoverageEmpty: true
- task: DotNetCoreCLI@2
displayName: Pack
inputs:
command: 'pack'
arguments: --configuration $(BuildConfiguration) --no-restore --include-symbols --no-build
buildProperties: $(versionSuffixProp)
packDirectory: '$(Build.ArtifactStagingDirectory)/packages'
- publish: '$(Build.ArtifactStagingDirectory)/packages'
artifact: packages
- stage: Prerelease
dependsOn:
- Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/prerelease'))
jobs:
- job: Prerelease
steps:
- checkout: none
- download: current
artifact: packages
patterns: '**/*.nupkg'
- task: NugetAuthenticate@0
- task: NuGetCommand@2
displayName: Push to prerelease
inputs:
command: 'push'
allowPackageConflicts: true
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'fb196d03-ac55-45b1-a754-67c1cd5115c8'
- stage: Publish
dependsOn:
- Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- job: Publish
steps:
- checkout: none
- download: current
artifact: packages
patterns: '**/*.nupkg'
- task: NugetAuthenticate@0
- task: NuGetCommand@2
displayName: Push to prerelease
inputs:
command: 'push'
allowPackageConflicts: true
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'fb196d03-ac55-45b1-a754-67c1cd5115c8'