-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.pipeline.yml
87 lines (72 loc) · 2.74 KB
/
build.pipeline.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
trigger:
batch: true
branches:
include:
- develop
resources:
repositories:
- repository: tpr_pipeline_snippets
type: git
name: TPR/Pipeline-Snippets
ref: refs/heads/release/1.0.0
- repository: pipelines
type: git
name: TPR/Tools-AzurePipelines
ref: develop
- repository: hooks
type: git
name: TPR/Tools-TPRGitHooks
ref: develop
pool:
vmImage: windows-2022
steps:
- checkout: self
- checkout: hooks
- checkout: pipelines
- template: ./file_system_debug.steps.yml@tpr_pipeline_snippets
- template: git-secrets.steps.yml@hooks
parameters:
repoPath: $(Build.SourcesDirectory)\url-protection
- task: DotNetCoreCLI@2
inputs:
command: restore
projects: $(Build.SourcesDirectory)\url-protection\TPR.UrlProtection.sln
displayName: dotnet restore
- template: security/check-nuget-packages.steps.yml@pipelines
parameters:
path: $(Build.SourcesDirectory)\url-protection\TPR.UrlProtection.sln
- task: DotNetCoreCLI@2
inputs:
command: test
projects: |
$(Build.SourcesDirectory)\url-protection\TPR.UrlProtection.Tests\TPR.UrlProtection.Tests.csproj
arguments: --configuration Release --collect:"XPlat Code Coverage"
displayName: dotnet test
continueOnError: false # Test failures should fail the build
# Generate the report using ReportGenerator (https://github.com/danielpalme/ReportGenerator)
# First install the tool on the machine, then run it
- script: |
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:$(Agent.TempDirectory)\**\coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:HtmlInline_AzurePipelines;Cobertura
displayName: Create code coverage report
# Publish the code coverage result (summary and web site)
# The summary allows to view the coverage percentage in the summary tab
# The web site allows to view which lines are covered directly in Azure Pipeline
- task: PublishCodeCoverageResults@1
displayName: "Publish code coverage"
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml"
reportDirectory: "$(Build.SourcesDirectory)/CodeCoverage"
- task: DotNetCoreCLI@2
inputs:
command: pack
outputDir: $(Build.ArtifactStagingDirectory)
configurationToPack: Release
verbosityPack: normal
packagesToPack: $(Build.SourcesDirectory)\url-protection\TPR.UrlProtection\TPR.UrlProtection.csproj
displayName: dotnet pack
- template: ./file_system_debug.steps.yml@tpr_pipeline_snippets
- publish: $(Build.ArtifactStagingDirectory)
displayName: Publish artifact
artifact: TPR.UrlProtection