-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines.yml
105 lines (91 loc) · 3.03 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
name: $(BuildID)
schedules:
- cron: "1 0 * * 1"
displayName: 'Weekly build'
always: true
branches:
include:
- main
variables:
SdkVersion: '8.0.x'
stages:
- stage: CI
displayName: 'CI'
jobs:
- job: ci
displayName: 'CI'
strategy:
maxParallel: 3
matrix:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: 'macOS-latest'
windows:
imageName: 'windows-latest'
pool:
vmImage: $(imageName)
variables:
disable.coverage.autogenerate: 'true'
EscapedComma: '%2c'
TestResults: '$(Agent.TempDirectory)'
CoverageResults: '$(Build.SourcesDirectory)/CoverageResults'
steps:
- task: UseDotNet@2
displayName: 'Use .NET sdk v$(SdkVersion)'
inputs:
packageType: sdk
version: '$(SdkVersion)'
- task: DotNetCoreCLI@2
displayName: 'Restore'
inputs:
command: restore
arguments: '--configuration Release'
projects: './FileParserSolution.sln'
- task: DotNetCoreCLI@2
displayName: 'Build'
inputs:
command: build
arguments: '--configuration Release --no-restore /p:DeterministicBuild=true'
projects: './FileParserSolution.sln'
- task: DotNetCoreCLI@2
displayName: 'Run tests'
inputs:
command: test
arguments: --configuration Release --no-build --collect:"XPlat Code Coverage"
nobuild: true
projects: '**/FileParser.Test.csproj'
publishTestResults: true
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
displayName: 'Generate tests report'
condition: and(succeeded(), eq(variables['imageName'], 'ubuntu-latest'))
inputs:
reports: '$(Agent.TempDirectory)/**/*.cobertura.xml'
targetdir: '$(CoverageResults)'
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges'
assemblyfilters: '-xunit*'
classfilters: '+*;-*Exception'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
condition: and(succeeded(), eq(variables['imageName'], 'ubuntu-latest'))
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(CoverageResults)/Cobertura.xml'
reportDirectory: '$(CoverageResults)'
pathToSources: '$(Build.SourcesDirectory)'
- task: DotNetCoreCLI@2
displayName: 'Generate NuGet package'
condition: and(succeeded(), eq(variables['imageName'], 'ubuntu-latest'))
inputs:
command: 'pack'
arguments: '--configuration Release'
configuration: 'Release'
packagesToPack: '**/FileParser.csproj'
nobuild: true
packDirectory: '$(Build.SourcesDirectory)/FileParser/Artifacts'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifact with NuGet package and its symbols'
condition: and(succeeded(), eq(variables['imageName'], 'ubuntu-latest'))
inputs:
pathtoPublish: '$(Build.SourcesDirectory)/FileParser/Artifacts/'
artifactName: 'FileParser'