-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathazure-build.yaml
90 lines (77 loc) · 2.28 KB
/
azure-build.yaml
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
trigger:
branches:
include:
- main
- refs/tags/*
pr:
- main
pool:
vmImage: 'windows-2019'
variables:
buildConfiguration: 'Release'
buildPlatform: 'Any CPU'
solution: '**/*.sln'
steps:
# Prepare
- task: DotNetCoreCLI@2
displayName: 'dotnet info'
inputs:
command: custom
custom: '--info'
- task: DotNetCoreCLI@2
displayName: 'dotnet version'
inputs:
command: custom
custom: '--version'
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 5.9.0'
inputs:
versionSpec: 5.9.0
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
# Build
- task: DotNetCoreCLI@2
inputs:
command: 'build'
arguments: '--configuration $(BuildConfiguration)'
outputDir: '$(Build.ArtifactStagingDirectory)'
projects: '$(solution)'
# projects: |
# src/SmartAnnotations/SmartAnnotations.csproj
# SmartAnnotations.sln
# Run tests and create coverage report
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
projects: 'tests/**/*.csproj'
nobuild: true
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
displayName: ReportGenerator
inputs:
reports: '$(Build.SourcesDirectory)/tests/**/coverage.cobertura.xml'
targetdir: '$(Build.SourcesDirectory)/CodeCoverage'
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges'
assemblyfilters: '-xunit*'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
# reportDirectory: '$(Build.SourcesDirectory)/CodeCoverage'
- task: CopyFiles@2
displayName: 'Copy *.nupkg Files'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: 'src/**/*.nupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)\Package'
flattenFolders: true
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
# Publish
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\Package'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))