-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
77 lines (69 loc) · 2.73 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
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
name: $(Major).$(Minor).$(Patch)
trigger:
- main
pool:
vmImage: ubuntu-latest
variables:
Sonarcloud.ProjectKey: $(Build.Repository.Name)
tag: '$(Build.BuildId)' #'live'
version: $(Build.BuildNumber)
# appName: 'keshavsingh4522/my-portfolio'
# appName: 'my-portfolio'
appName: 'MyPortfolioAPI'
dockerfile: 'src/$(Build.Repository.Name).API/Dockerfile'
BuildConfiguration: 'Release'
Major: 1
Minor: 0
Patch: "$[counter(format('{0}.{1}', variables['Major'], variables['Minor']), 0)]"
stages:
- stage: Build_Test_Analyse
displayName: Build, Test and Analyse
jobs:
- job:
displayName: Build, Test and Analyse
steps:
- task: SonarCloudPrepare@1
displayName: "Prepare SonarCloud for Code Analysis"
inputs:
SonarCloud: "PD SonarCloud"
organization: "keshavsingh4522-01"
scannerMode: "MSBuild"
projectKey: "keshavsingh4522_BasicConcept"
extraProperties: "|
sonar.cs.vscoveragexml.reportsPaths=**/coverage.cobertura.xml #**/*.coveragexml
sonar.dotnet.excludeGeneratedCode=true
sonar.coverage.exclusions=**/*.html,**/*.css"
projectVersion: $(version)
projectName: Basic Concept $(version)
- task: DotNetCoreCLI@2
displayName: "Restore Nuget Packages"
inputs:
command: "restore"
feedsToUse: "select"
- task: DotNetCoreCLI@2
displayName: "Build all projects in repo"
inputs:
command: "build"
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: "Execute Unit Test Projects"
inputs:
command: "test"
# arguments: '--collect "Code Coverage"'
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage results'
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.cobertura.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/TestResults'
- task: SonarCloudAnalyze@1
displayName: "Run SonarCloud Code Analysis"
- task: SonarCloudPublish@1
displayName: "Publish SonarCloud Code Analysis"
inputs:
pollingTimeoutSec: "300"