-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathazure-pipelines.yml
65 lines (57 loc) · 1.94 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
parameters:
- name: DOTNET_PUBLISH
type: boolean
default: false
trigger:
- main
stages:
- stage: build
displayName: Build
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
jobs:
- job: build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
projects: '**/*.sln'
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: 'build'
projects: '**/*.sln'
arguments: '--configuration $(buildConfiguration)'
# Add coverlet.collector nuget package to test project - 'dotnet add <TestProject.cspoj> package coverlet.collector'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: 'test'
projects: '**/*.Tests.csproj'
arguments: '--configuration $(buildConfiguration) --collect:"XPlat Code Coverage"'
publishTestResults: true
# Publish code coverage report to the pipeline
# - task: PublishCodeCoverageResults@1 # using @v2 instead
# displayName: 'Publish code coverage'
# inputs:
# codeCoverageTool: Cobertura
# summaryFileLocation: $(Agent.TempDirectory)/*/coverage.cobertura.xml # using ** instead of * finds duplicate coverage files
- task: PublishCodeCoverageResults@2
displayName: 'Publish code coverage'
inputs:
summaryFileLocation: $(Agent.TempDirectory)/*/coverage.cobertura.xml # using ** instead of * finds duplicate coverage files
- ${{ if eq(parameters.DOTNET_PUBLISH, true) }}:
- task: DotNetCoreCLI@2
displayName: 'dotnet publish'
inputs:
command: 'publish'
projects: '**/*.sln'
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
publishWebProjects: True
zipAfterPublish: True