Skip to content

Commit

Permalink
Add SonarCloud to CI pipeline (#85)
Browse files Browse the repository at this point in the history
- Add SonarCloud integration to pipeline
  • Loading branch information
BernieWhite authored Mar 26, 2019
1 parent 4d61b9e commit dc8acc8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 21 deletions.
23 changes: 12 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

/**/.vs/
/**/bin/
/**/obj/
/artifacts/
/build/
/reports/
/out/
/**/*.user
/src/**/*-help.xml
/src/**/*.help.txt
/BenchmarkDotNet.Artifacts/
**/.vs/
**/bin/
**/obj/
artifacts/
build/
reports/
out/
*.user
src/**/*-help.xml
src/**/*.help.txt
BenchmarkDotNet.Artifacts/
.sonarqube/
20 changes: 10 additions & 10 deletions PSRule.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ VisualStudioVersion = 15.0.28307.106
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule", "src\PSRule\PSRule.csproj", "{ACAFD790-980B-4B64-912F-9BAD91DFF749}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Benchmark", "src\PSRule.Benchmark\PSRule.Benchmark.csproj", "{0693DC93-1F72-410A-B77F-A81A92391995}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Benchmark", "src\PSRule.Benchmark\PSRule.Benchmark.csproj", "{B2764210-8B4B-4554-A000-5F3E3D9ECDD5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Tests", "tests\PSRule.Tests\PSRule.Tests.csproj", "{05D23A4D-BD15-4E41-9482-0CC083F5F447}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Tests", "tests\PSRule.Tests\PSRule.Tests.csproj", "{FAD69F5B-461E-44FF-8438-1F7BF0710660}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -19,14 +19,14 @@ Global
{ACAFD790-980B-4B64-912F-9BAD91DFF749}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACAFD790-980B-4B64-912F-9BAD91DFF749}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACAFD790-980B-4B64-912F-9BAD91DFF749}.Release|Any CPU.Build.0 = Release|Any CPU
{0693DC93-1F72-410A-B77F-A81A92391995}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0693DC93-1F72-410A-B77F-A81A92391995}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0693DC93-1F72-410A-B77F-A81A92391995}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0693DC93-1F72-410A-B77F-A81A92391995}.Release|Any CPU.Build.0 = Release|Any CPU
{05D23A4D-BD15-4E41-9482-0CC083F5F447}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05D23A4D-BD15-4E41-9482-0CC083F5F447}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05D23A4D-BD15-4E41-9482-0CC083F5F447}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05D23A4D-BD15-4E41-9482-0CC083F5F447}.Release|Any CPU.Build.0 = Release|Any CPU
{B2764210-8B4B-4554-A000-5F3E3D9ECDD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2764210-8B4B-4554-A000-5F3E3D9ECDD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2764210-8B4B-4554-A000-5F3E3D9ECDD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2764210-8B4B-4554-A000-5F3E3D9ECDD5}.Release|Any CPU.Build.0 = Release|Any CPU
{FAD69F5B-461E-44FF-8438-1F7BF0710660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAD69F5B-461E-44FF-8438-1F7BF0710660}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAD69F5B-461E-44FF-8438-1F7BF0710660}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAD69F5B-461E-44FF-8438-1F7BF0710660}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
18 changes: 18 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ strategy:
Windows:
imageName: 'vs2017-win2016'
publishModule: 'true'
analysis: 'true'

variables:
buildConfiguration: 'Release'
Expand All @@ -35,6 +36,23 @@ steps:
displayName: 'Benchmark'
condition: eq(variables['benchmark'], 'true')


- powershell: dotnet tool install --global dotnet-sonarscanner
displayName: 'Install Sonar scanner'
condition: eq(variables['analysis'], 'true')

- script: dotnet sonarscanner begin /k:"BernieWhite_PSRule" /o:"berniewhite-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login=$(sonarQubeToken)
displayName: 'Prepare SonarCloud'
condition: eq(variables['analysis'], 'true')

- script: dotnet build
displayName: 'Build solution for analysis'
condition: eq(variables['analysis'], 'true')

- script: dotnet sonarscanner end /d:sonar.login=$(sonarQubeToken)
displayName: 'Complete SonarCloud'
condition: eq(variables['analysis'], 'true')

# DotNet test results
- task: PublishTestResults@2
displayName: 'Publish unit test results'
Expand Down
2 changes: 2 additions & 0 deletions tests/PSRule.Tests/PSRule.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
<IsTestProject>true</IsTestProject>
<IsPackable>false</IsPackable>
<RootNamespace>PSRule</RootNamespace>
<DebugType>Full</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeCoverage" Version="15.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.1" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down

0 comments on commit dc8acc8

Please sign in to comment.