-
Notifications
You must be signed in to change notification settings - Fork 32
/
azure-pipelines.yml
126 lines (122 loc) · 3.89 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
variables:
Major: '5'
Minor: '1'
Patch: '0'
BuildConfiguration: Release
trigger:
branches:
include:
- master
paths:
exclude:
- README.md
- CHANGELOG.md
- LATEST_CHANGE.md
- azure-pipelines.yml
pr:
branches:
include:
- master
paths:
exclude:
- README.md
- CHANGELOG.md
- LATEST_CHANGE.md
- azure-pipelines.yml
pool:
vmImage: 'windows-latest'
stages:
- stage: generate_package
displayName: Build Artifact
jobs:
- job: create_artifact
displayName: Build Package
steps:
- task: NuGetToolInstaller@1
displayName: Install NuGet
inputs:
versionSpec:
checkLatest: true
- task: NuGetCommand@2
displayName: Restore Packages
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'select'
- task: MSBuild@1
displayName: Build Solution
inputs:
solution: '**/*.sln'
configuration: $(BuildConfiguration)
- task: VSTest@2
displayName: Run Unit Tests
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*Shared.Tests.dll
!**\*TestAdapter.dll
!**\obj\**
!**\xunit.runner.visualstudio.testadapter.dll
!**\xunit.runner.visualstudio.dotnetcore.testadapter.dll
searchFolder: '$(System.DefaultWorkingDirectory)'
minimumExpectedTests: 1,
failOnMinTestsNotRun: true
- task: PublishTestResults@2
displayName: Publish Unit Tests
inputs:
testResultsFormat: 'XUnit'
testResultsFiles: '*.trx'
searchFolder: '$(Agent.TempDirectory)\TestResults'
buildConfiguration: '$(BuildConfiguration)'
- task: MSBuild@1
displayName: Build Package
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
solution: '**/src/**/*.csproj'
configuration: $(BuildConfiguration)
msbuildArguments: '/t:restore;build;pack /p:PackageVersion=$(Major).$(Minor).$(Patch) /p:AssemblyFileVersion=$(Major).$(Minor).$(Patch) /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: Copy Release Notes
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '**/LATEST_CHANGE.md'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: Push Artifact
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- stage: release_public_feed
dependsOn: generate_package
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
displayName: Release
jobs:
- deployment: push
displayName: Release Package
environment: NuGet
strategy:
runOnce:
deploy:
steps:
- task: NuGetCommand@2
displayName: Push to NuGet
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/**/drop/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet - HTML Label'
- task: GitHubRelease@1
inputs:
gitHubConnection: 'GitHub connection 1'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'gitTag'
tagPattern: 'v$(Major).$(Minor).$(Patch)'
title: 'v$(Major).$(Minor).$(Patch)'
releaseNotesFilePath: '$(Pipeline.Workspace)/**/drop/LATEST_CHANGE.md'
assets: '$(Pipeline.Workspace)/**/drop/*.nupkg'
addChangeLog: false