forked from GregsStack/InputSimulatorStandard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
120 lines (102 loc) · 4.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
115
116
117
118
119
120
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
batch: true
branches:
include:
- master
- develop
- release/*
pr:
branches:
include:
- master
- release/*
pool:
vmImage: 'windows-latest'
variables:
Solution: '**/*.sln'
BuildPlatform: 'Any CPU'
BuildConfiguration: 'Release'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 'true'
steps:
- task: DotNetCoreInstaller@0
inputs:
version: '2.2.401'
- script: |
dotnet tool install -g GitVersion.Tool --version 5.0.2-beta1.37
displayName: 'Install global tools'
- script: dotnet-gitversion /output buildserver
displayName: 'Run GitVersion.Tool'
- powershell: Write-Output "##vso[task.setvariable variable=informationalVersion]$($env:GITVERSION_INFORMATIONALVERSION)"
displayName: 'Set assembly version variable'
- bash: printenv | sort
displayName: 'List environment variables'
- task: DotNetCoreCLI@2
displayName: 'Build source'
inputs:
command: 'build'
projects: '$(Solution)'
arguments: '-c $(BuildConfiguration) /p:Version=$(informationalVersion)'
- powershell: |
$testsDirectory = Join-Path -Path '$(Build.SourcesDirectory)' -ChildPath 'tests'
$testAssemblies = Get-ChildItem -Path "$testsDirectory" -Recurse -File -Filter '*.Tests.csproj' | Select-Object -ExpandProperty BaseName
Write-Output "##vso[task.setvariable variable=testAssemblies]$($testAssemblies -join '|')"
displayName: 'Set test assembly filter variable'
- task: DotNetCoreCLI@2
displayName: 'Run tests with coverage'
inputs:
command: test
projects: 'tests/**/*.Tests.csproj'
arguments: '-c $(BuildConfiguration) /p:Version=$(informationalVersion) /p:AltCover=true /p:AltCoverOpenCover=true /p:AltCoverAssemblyExcludeFilter="xunit|$(testAssemblies)"'
- powershell: |
$testsDirectory = Join-Path -Path '$(Build.SourcesDirectory)' -ChildPath 'tests'
$coverageFile = Get-ChildItem -Path "$testsDirectory" -Recurse -File -Filter 'coverage.xml' | Select-Object -First 1
$codecovExecutable = Get-ChildItem -Path "$ENV:USERPROFILE\.nuget\packages\codecov" -Recurse -File -Filter "codecov.exe" | Sort-Object -Descending -Property FullName | Select-Object -First 1
& "$($codecovExecutable.FullName)" -f "$($coverageFile.FullName)" -t '$(CODECOV_TOKEN)'
displayName: 'Upload coverage to codecov.io'
- task: DotNetCoreCLI@2
displayName: 'Pack projects'
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')))
inputs:
command: 'pack'
packagesToPack: '$(Solution)'
nobuild: true
includesymbols: true
versioningScheme: 'byEnvVar'
versionEnvVar: 'GITVERSION_NUGETVERSIONV2'
- task: NuGetToolInstaller@1
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')))
inputs:
versionSpec: '5.1.0'
checkLatest: true
- task: NuGetCommand@2
displayName: 'Push *.nupkg and *.snupkg to nuget.org'
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')))
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet.org'
allowPackageConflicts: true
- task: GitHubRelease@0
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
gitHubConnection: 'GithubOAuth'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'manual'
tag: 'v$(Build.BuildNumber)'
title: 'v$(Build.BuildNumber)'
- task: GitHubRelease@0
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/develop'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')))
inputs:
gitHubConnection: 'GithubOAuth'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'manual'
tag: 'v$(Build.BuildNumber)'
title: 'v$(Build.BuildNumber)'
isPreRelease: true