-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yml
80 lines (74 loc) · 2.24 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
trigger:
branches:
include:
- master
- release
- refs/tags/*
pr:
- master
pool:
vmImage: 'windows-2022'
variables:
BuildConfiguration: Release
Projects: '**/*.csproj'
steps:
# Install required SDKs and tools
- task: UseDotNet@2
displayName: 'Install .NET Core SDK'
inputs:
packageType: 'sdk'
version: '7.0.100'
# Patch preview project versions (only when on master branch)
- task: CmdLine@2
displayName: 'Install DNT'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
script: 'npm i -g dotnettools'
- task: CmdLine@2
displayName: 'Update project version patch'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
script: 'dnt bump-versions patch'
failOnStderr: true
- task: CmdLine@2
displayName: 'Patch project version preview'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
script: 'dnt bump-versions preview "$(Build.BuildNumber)"'
failOnStderr: true
# Build and test
- task: DotNetCoreCLI@2
displayName: 'Build solution'
inputs:
command: 'build'
projects: '$(Projects)'
arguments: '--configuration $(BuildConfiguration)'
feedsToUse: 'select'
versioningScheme: 'off'
- task: DotNetCoreCLI@2
displayName: 'Run tests'
inputs:
command: 'test'
projects: '$(Projects)'
arguments: '--configuration $(BuildConfiguration) --collect "Code Coverage" --settings "$(Build.SourcesDirectory)/src/CodeCoverage.runsettings"'
publishTestResults: true
feedsToUse: 'select'
versioningScheme: 'off'
env:
AzureBlobStorageConnectionString: $(AzureBlobStorageConnectionString)
FtpPassword: $(FtpPassword)
# Publish artifacts
- task: CopyFiles@2
displayName: 'Copy packages'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
Contents: '**/*.nupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'