-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathazure-pipeline.template.yaml
84 lines (71 loc) · 2.91 KB
/
azure-pipeline.template.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
parameters:
name: ''
displayName: ''
vmImage: ''
outputDirectory: ''
artifactName: ''
timeoutInMinutes: 120
jobs:
- job: ${{ parameters.name }}
displayName: ${{ parameters.displayName }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
pool:
vmImage: ${{ parameters.vmImage }}
steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
clean: false # whether to fetch clean each time
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
persistCredentials: true
- task: UseDotNet@2
displayName: 'Use .NET'
inputs:
packageType: 'sdk'
useGlobalJson: true
- pwsh: |
.\build.ps1
displayName: 'Update Release Notes'
continueOnError: false
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
arguments: '-c Release'
continueOnError: false
- script: dotnet test -c Release --no-build --logger:trx --collect:"XPlat Code Coverage" --results-directory TestResults --settings coverlet.runsettings
displayName: 'Run tests'
continueOnError: true # Allow continuation even if tests fail
- task: PublishTestResults@2
inputs:
testResultsFormat: VSTest
testResultsFiles: '**/*.trx' #TestResults folder usually
testRunTitle: ${{ parameters.name }}
mergeTestResults: true
failTaskOnFailedTests: false
publishRunAttachments: true
- task: reportgenerator@5
displayName: ReportGenerator
condition: always() # Run this step regardless of previous step outcomes
continueOnError: true
inputs:
reports: '$(Build.SourcesDirectory)/TestResults/**/*.cobertura.xml'
targetdir: '$(Build.SourcesDirectory)/coveragereport'
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges'
assemblyfilters: '-xunit*'
publishCodeCoverageResults: true
- publish: $(Build.SourcesDirectory)/coveragereport
displayName: 'Publish Coverage Report'
condition: and(always(), eq(variables['Agent.OS'], 'Windows_NT'))
continueOnError: true
artifact: 'CoverageReports-$(Build.BuildId)'
- script: dotnet pack -c Release -o $(Build.ArtifactStagingDirectory)/nuget
displayName: 'Create packages'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/nuget'
ArtifactName: 'nuget-$(Build.BuildId)'
publishLocation: 'Container'
- script: 'echo 1>&2'
failOnStderr: true
displayName: 'If above is partially succeeded, then fail'
condition: eq(variables['Agent.JobStatus'], 'SucceededWithIssues')