Skip to content

Commit

Permalink
Merge pull request #739 from samsmithnz/UpdateToSonarAction
Browse files Browse the repository at this point in the history
Updating to Sonar Action
  • Loading branch information
samsmithnz authored Dec 17, 2022
2 parents da937c1 + 6918f68 commit 4ef19b0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 46 deletions.
53 changes: 9 additions & 44 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,53 +128,18 @@ jobs:

sonarCloud:
name: Run SonarCloud analysis
runs-on: windows-latest
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install .NET 7 SDK
uses: actions/[email protected]
- name: Run Sonarcloud test
uses: samsmithnz/[email protected]
with:
dotnet-version: 7.0.x
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
projects: 'src/DevOpsMetrics.Core/DevOpsMetrics.Core.csproj,src/DevOpsMetrics.Function/DevOpsMetrics.Function.csproj,src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj,src/DevOpsMetrics.Service/DevOpsMetrics.Service.csproj,src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj,src/DevOpsMetrics.Web/DevOpsMetrics.Web.csproj'
dotnet-version: '7.0.x'
sonarcloud-organization: samsmithnz-github
sonarcloud-project: samsmithnz_DevOpsMetrics
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"samsmithnz_DevOpsMetrics" /o:"samsmithnz-github" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build src/DevOpsMetrics.Core/DevOpsMetrics.Core.csproj
dotnet build src/DevOpsMetrics.Function/DevOpsMetrics.Function.csproj
dotnet build src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj
dotnet build src/DevOpsMetrics.Service/DevOpsMetrics.Service.csproj
dotnet build src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj
dotnet build src/DevOpsMetrics.Web/DevOpsMetrics.Web.csproj
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"


#Disabling PROBOT for 2021 reboot to focus on website
#Deploy the probot artifacts to Azure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.0" />
<PackageReference Include="coverlet.collector" Version="3.2.0">
Expand Down
2 changes: 1 addition & 1 deletion src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.24" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.18.3" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.0" />
Expand Down

0 comments on commit 4ef19b0

Please sign in to comment.