-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
80 lines (67 loc) · 2.37 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
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
Major: '1'
Minor: '0'
PackVersion: '$(Major).$(Minor).$(Patch)'
FullVersion: '$(Major).$(Minor).$(Patch).$(Build.BuildId)'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
jobs:
- job: 'Build_and_Test'
steps:
- script: echo Starting Release Build!
displayName: 'Starting Release'
- task: NuGetCommand@2
displayName: 'Restore'
inputs:
command: restore
packagesToPack: '**\*.csproj'
- task: DotNetCoreCLI@2
displayName: 'Run dotnet build $(FullVersion) $(buildConfiguration)'
inputs:
command: build
arguments: '--configuration $(buildConfiguration) --version $(PackVersion) --verbosity detailed'
- task: DotNetCoreCLI@2
displayName: 'Execute unit tests'
inputs:
command: test
publishTestResults: true
projects: '**\*Test*.csproj'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
- task: PublishTestResults@2
displayName: 'Execute unit tests results'
inputs:
searchFolder: '$(Agent.TempDirectory)'
testRunner: VSTest
testResultsFiles: '**\*.trx'
- job: 'Pack_and_Push'
dependsOn: 'Build_and_Test'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
steps:
- task: DotNetCoreCLI@2
displayName: 'Pack the package $(PackVersion)'
inputs:
command: 'pack'
configuration: '$(configuration)'
packagesToPack: '**\*.csproj'
versioningScheme: 'byEnvVar'
versionEnvVar: 'PackVersion'
verbosityPack: 'Detailed'
- task: PublishBuildArtifacts@1
displayName: 'Publish the package'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- task: PowerShell@2
displayName: nuget push $(Build.SourceBranch)
inputs:
targetType: 'inline'
script: 'nuget push $(Build.ArtifactStagingDirectory)\**\*.nupkg -ApiKey $(nuget.key) -Source https://api.nuget.org/v3/index.json -NoServiceEndpoint -NonInteractive true -Verbosity detailed'