-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-release.yaml
102 lines (90 loc) · 2.88 KB
/
build-release.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
91
92
93
94
95
96
97
98
99
100
101
102
variables :
- name: 'configuration'
value: 'Release'
- name: 'Parameters.projects'
value: '**/*.csproj'
- name: 'Parameters.projects.tests'
value: '**/*Tests/*.csproj'
- name: 'majorVersion'
value: '1'
- name: 'minorVersion'
value: '0'
- name: 'patchVersion'
value: '0'
- name : 'projectName'
value: 'Queries'
- name: 'azureArtifactFeed'
value: 'Queries'
- group: Security
pr:
- master
trigger:
batch: true
branches:
include:
- master
- feature/*
- fix/*
- release/*
paths:
exclude:
- '**/*.md'
pool:
vmImage : windows-latest
#Your build pipeline references a secret variable named ‘github.apiKey’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '$(Parameters.projects)'
feedsToUse: config
nugetConfigPath: Nuget.config
verbosityRestore: Normal
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
projects: '$(Parameters.projects)'
arguments: '--no-restore -c $(configuration)'
- task: DotNetCoreCLI@2
displayName: 'Run tests and collect code coverage'
inputs:
command: test
projects: '$(Parameters.projects.tests)'
arguments: '--no-build -c $(configuration) /p:CoverletOutput=$(Agent.TempDirectory)\ /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install -g dotnet-reportgenerator-globaltool --ignore-failed-sources
displayName: Install ReportGenerator tool
- script: reportgenerator -reports:$(Agent.TempDirectory)\**\coverage.*.cobertura.xml -targetdir:$(Build.SourcesDirectory)\coverlet\reports -reporttypes:"Cobertura"
displayName: Create reports
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)\coverlet\reports\Cobertura.xml
- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: pack
nobuild: true
versioningScheme: byPrereleaseNumber
majorVersion: '$(majorVersion)'
minorVersion: '$(minorVersion)'
patchVersion: '$(patchVersion)'
condition: succeededOrFailed()
# the following step sync the repo with the Github repo
- task: nkdagility.gittasks.gitsync-task.gitsync@1
displayName: 'Git Publish to https://$(github.apiKey)@github.com/candoumbe/$(projectName).git'
inputs:
GitRepoUrl: 'https://$(github.apiKey)@github.com/candoumbe/$(projectName).git'
condition: succeededOrFailed()
enabled: false
- task: DotNetCoreCLI@2
displayName: 'dotnet push'
inputs:
command: push
publishVstsFeed: '$(azureArtifactFeed)'
enabled: true