-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines-csharp.yml
More file actions
111 lines (97 loc) · 3.27 KB
/
azure-pipelines-csharp.yml
File metadata and controls
111 lines (97 loc) · 3.27 KB
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
# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
name: Gravity.Core.$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
pool:
name: Default
trigger:
branches:
include:
- master
variables:
- group: browserstack.com
- name: 'Build.Configuration'
value: 'Release'
- name: 'Parallel.Workers'
value: '10'
steps:
- task: DotNetCoreCLI@2
displayName: restore dependencies
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'select'
vstsFeed: '6ed1caf9-de4f-48e8-8276-201533d86a19'
verbosityRestore: 'Diagnostic'
- task: DotNetCoreCLI@2
displayName: build projects
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(Build.Configuration)'
- powershell: |
# read test settings
[xml]$runSettings = Get-Content azure_settings_mstest.runsettings
#
# setup
$workers = $runSettings.SelectSingleNode("//MSTest//Workers")
#
# override with production settings
$workers.InnerText = '$(Parallel.Workers)'
#
# save settings
$runSettings.Save("azure_settings_mstest_prod.runsettings")
displayName: create test settings > override with production parameters
- task: DotNetCoreCLI@2
displayName: execute unit testing
inputs:
command: 'test'
projects: '**/*[Uu]nit*[Tt]ests/*.csproj'
arguments: '--configuration $(Build.Configuration) -s azure_settings_mstest_prod.runsettings'
testRunTitle: 'Unit Testing --- $(Build.BuildNumber)'
- task: DotNetCoreCLI@2
displayName: execute integration testing
inputs:
command: 'test'
projects: '**/*[Ii]ntegration*[Tt]ests/*.csproj'
arguments: '--configuration $(Build.Configuration) -s azure_settings_mstest_prod.runsettings'
testRunTitle: 'Integration Testing --- $(Build.BuildNumber)'
- powershell: |
Remove-Item azure_settings_mstest_prod.runsettings
displayName: cleanup
- task: DotNetCoreCLI@2
displayName: create package
inputs:
command: 'pack'
packagesToPack: '**/!(*[Tt]ests)/*.csproj'
versioningScheme: 'byBuildNumber'
verbosityPack: 'Diagnostic'
packDirectory: $(Build.ArtifactStagingDirectory)
- task: NuGetCommand@2
displayName: push package
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'nuget.org'
- task: PowerShell@2
displayName: 'parse build version for GitHub tag'
inputs:
targetType: 'inline'
script: |
# setup
[regex]$pattern = '(\d+.?)+'
$version = $pattern.Matches('$(Build.BuildNumber)') | foreach-object {$_.Value}
# set value
Write-Host "##vso[task.setvariable variable=buildVersion]$version"
- task: GitHubRelease@1
displayName: 'create GitHub tag'
inputs:
gitHubConnection: 'github.com'
repositoryName: 'gravity-api/gravity-core'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: 'v$(buildVersion)'
title: 'Production v$(buildVersion)'
releaseNotesSource: 'inline'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'