-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathazure-pipelines-code-quality.yml
140 lines (130 loc) · 4.25 KB
/
azure-pipelines-code-quality.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
pr:
- master
name: code quality pipeline
trigger:
branches:
include:
- releases/*
exclude:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '*.sln'
builPdlatform: 'Any CPU'
buildConfiguration: 'Release'
DOCKER_DRIVER: overlay
CONTAINER_IMAGE: codeclimate/codeclimate
CONTAINER_TAG: '0.85.2'
RESHARPER_CLI_NAME: 'JetBrains.ReSharper.CommandLineTools.Unix'
RESHARPER_CLI_VERSION: "2019.2.3"
# set RESHARPER_CLI_VERSION=2019.2.3
jobs:
# doesn't work
- job: SonarCloudQualityGate
steps:
- task: NuGetToolInstaller@1
enabled: false
- task: NuGetCommand@2
enabled: false
inputs:
restoreSolution: '$(solution)'
- task: eshopworld.SonarCloudQualityGate.SonarCloudQualityGate.SonarCloudQualityGate@1
displayName: SonarCloudQualityGate
continueOnError: true
enabled: false
# sometimes works but can't save output besides log
- job: ResharperCli
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: alanwales.resharper-code-analysis.custom-build-task.ResharperCli@2
displayName: 'Automated code quality checks'
inputs:
solutionOrProjectPath: 'MyProject.sln'
additionalArguments: '/disable-settings-layers:SolutionPersonal --output=inspectcodeReport.html --format=Html'
continueOnError: true
# works great, also works on linux
- job: ResharperCliInspectCode
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: CmdLine@2
continueOnError: true
inputs:
script: |
curl -LO "https://download.jetbrains.com/resharper/ReSharperUltimate.$(RESHARPER_CLI_VERSION)/$(RESHARPER_CLI_NAME).$(RESHARPER_CLI_VERSION).zip"
echo | dir
- task: ExtractFiles@1
continueOnError: true
inputs:
archiveFilePatterns: '$(RESHARPER_CLI_NAME).$(RESHARPER_CLI_VERSION).zip'
destinationFolder: resharper
- task: CmdLine@2
displayName: 'inspectcode'
continueOnError: true
inputs:
script: |
mkdir -p code_quality
resharper\inspectcode.exe "MyProject.sln" --output=code_quality\inspectcodeReport.html --format=Html
resharper\dupfinder.exe "MyProject.sln" --output=code_quality\dupfinderReport.html --format=Html
- task: PublishBuildArtifacts@1
continueOnError: true
inputs:
PathtoPublish: 'code_quality'
ArtifactName: 'Code_Quality'
publishLocation: 'Container'
# works not much output
- job: BuildQualityChecks
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@6
displayName: 'Check build quality'
continueOnError: true
# works only on linux
- job: codeclimate
pool:
vmImage: 'Ubuntu-16.04'
variables:
DOCKER_DRIVER: overlay
CONTAINER_IMAGE: codeclimate/codeclimate
CONTAINER_TAG: '0.85.2'
steps:
- task: DockerInstaller@0
displayName: 'Install Docker 17.09.0-ce'
continueOnError: false
- task: CmdLine@2
displayName: 'Pull codeclimate docker image'
continueOnError: false
inputs:
script: |
docker pull codeclimate/codeclimate
- task: CmdLine@2
displayName: ' mkdir -p CodeQuality'
continueOnError: false
inputs:
script: |
mkdir -p CodeQuality
- task: CmdLine@2
displayName: 'run code codeclimate'
continueOnError: false
inputs:
script: |
docker run --env CODECLIMATE_DEBUG=1 --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate:0.85.2 analyze -f html > codeclimateReport.html
- task: PublishBuildArtifacts@1
continueOnError: true
inputs:
PathtoPublish: 'codeclimateReport.html'
ArtifactName: 'Code_Quality'
publishLocation: 'Container'