-
Notifications
You must be signed in to change notification settings - Fork 8
/
azure-pipelines.yml
185 lines (168 loc) · 6.14 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
# Build, test and package pipeline for SpecFlow.Contrib.Variants package
# Versioning of package currently managed by variables
trigger:
- release
- develop
variables:
solution: '**\*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
packageVersion: '3.9.90'
packageVersionPre: '3.9.90-pre.2'
vmImage: 'windows-latest'
stages:
- stage: build_test_pack
displayName: "Build, run tests & pack"
pool:
vmImage: '$(vmImage)'
jobs:
# Build / run unit tests
- job: build
displayName: "Build & run unit tests"
steps:
# Restore / build
- task: NuGetCommand@2
displayName: "Restore UnitTests packages"
inputs:
restoreSolution: '**/SpecFlow.Contrib.Variants.UnitTests/packages.config'
restoreDirectory: '$(Build.Repository.LocalPath)\packages'
feedsToUse: 'select'
vstsFeed: '8cc48bdf-30e3-409a-9f50-1d2e6944e896/ee5c684a-40df-48ba-b303-1a8a5ca628e5'
- task: DotNetCoreCLI@2
displayName: "Build unit tests cproj"
inputs:
command: 'build'
projects: '**\SpecFlow.Contrib.Variants.UnitTests.csproj'
# Run unit tests
- task: VSTest@2
displayName: "Run unit tests"
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*UnitTests.dll
!**\*TestAdapter.dll
!**\obj\**
# Pack develop
- job: pack_prerelease
displayName: "Pack nupkg for DevOps feed"
dependsOn: build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
steps:
# Pack and publish
- task: DotNetCoreCLI@2
displayName: "Pack main csproj"
inputs:
command: 'pack'
packagesToPack: '**/SpecFlow.Contrib.Variants.csproj'
versioningScheme: 'byEnvVar'
packDirectory: '$(Build.ArtifactStagingDirectory)'
versionEnvVar: 'packageVersionPre'
- task: PublishBuildArtifacts@1
displayName: "Publish nupkg as artifact"
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: prerelease
# Run integration tests / pack release
- job: pack_test_release
displayName: "Integration tests, pack nupkg for Nuget feed"
dependsOn: build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
steps:
# Use specific core sdk for azure piplines build to work
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
#version: 5.0.100
#installationPath: $(Agent.ToolsDirectory)/dotnet
# Restore integration tests projects
- task: NuGetCommand@2
displayName: "Restore SharedBindings packages"
inputs:
restoreSolution: '**/SpecFlow.Contrib.Variants.IntegrationTests.SharedBindings/packages.config'
restoreDirectory: '$(Build.Repository.LocalPath)\packages'
feedsToUse: 'select'
vstsFeed: '8cc48bdf-30e3-409a-9f50-1d2e6944e896/ee5c684a-40df-48ba-b303-1a8a5ca628e5'
- task: NuGetCommand@2
displayName: "Restore framework integration tests projects"
inputs:
restoreSolution: '**/SpecFlow.Contrib.Variants.*Provider.IntegrationTests/packages.config'
restoreDirectory: '$(Build.Repository.LocalPath)\packages'
feedsToUse: 'select'
vstsFeed: '8cc48bdf-30e3-409a-9f50-1d2e6944e896/ee5c684a-40df-48ba-b303-1a8a5ca628e5'
- task: DotNetCoreCLI@2
displayName: "Restore core integration tests projects"
inputs:
command: 'restore'
projects: '**\*Core.*.IntegrationTests.csproj'
feedsToUse: 'select'
vstsFeed: '8cc48bdf-30e3-409a-9f50-1d2e6944e896/ee5c684a-40df-48ba-b303-1a8a5ca628e5'
# Build / run integration tests
- task: DotNetCoreCLI@2
displayName: "Build core integration tests projects"
inputs:
command: 'build'
projects: '**\*.IntegrationTests.csproj'
- task: DotNetCoreCLI@2
displayName: "Run integration tests"
inputs:
command: 'test'
projects: '**\*.IntegrationTests.csproj'
# Pack
- task: DotNetCoreCLI@2
displayName: "Pack main csproj"
inputs:
command: 'pack'
packagesToPack: '**/SpecFlow.Contrib.Variants.csproj'
versioningScheme: 'byEnvVar'
packDirectory: '$(Build.ArtifactStagingDirectory)'
versionEnvVar: 'packageVersion'
- task: PublishBuildArtifacts@1
displayName: "Publish nupkg as artifact"
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: release
- stage: deploy_package
displayName: "Push nupkg to feed"
pool:
vmImage: '$(vmImage)'
jobs:
# Push to Azure Devops
- job: deploy_prerelease
displayName: "Push nupkg to DevOps feed"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
steps:
- task: DownloadBuildArtifacts@0
displayName: "Download nupkg artifact"
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'prerelease'
downloadPath: '$(System.ArtifactsDirectory)'
- task: NuGetCommand@2
displayName: "Push to feed"
inputs:
command: 'push'
packagesToPush: '$(System.ArtifactsDirectory)\prerelease\*.nupkg;!$(System.ArtifactsDirectory)\prerelease\*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '8cc48bdf-30e3-409a-9f50-1d2e6944e896/ee5c684a-40df-48ba-b303-1a8a5ca628e5'
allowPackageConflicts: true
# Push to nuget
- job: deploy_release
displayName: "Push nupkg to Nuget feed"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
steps:
- task: DownloadBuildArtifacts@0
displayName: "Download nupkg artifact"
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'release'
downloadPath: '$(System.ArtifactsDirectory)'
- task: NuGetCommand@2
displayName: "Push to feed"
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)\release\*.nupkg;!$(Build.ArtifactStagingDirectory)\release\*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'Nuget'