From ba14974478a9842dee4b55fb03e8d6db1dc83fa3 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Sat, 17 Dec 2022 12:16:47 -0500 Subject: [PATCH 1/3] Updating to Sonar Action --- .github/workflows/dotnetcore.yml | 53 ++++++-------------------------- 1 file changed, 9 insertions(+), 44 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index c7135089..c7b34227 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -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/setup-dotnet@v3.0.3 + - name: Run Sonarcloud test + uses: samsmithnz/SamsDotNetSonarCloudAction@1.0.5 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 From b5ab099a2490c3b2205ba823dc7bed65dfc1d719 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Sat, 17 Dec 2022 12:17:43 -0500 Subject: [PATCH 2/3] Update DevOpsMetrics.Tests.csproj --- src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj b/src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj index 04b1c9ae..e163f3a4 100644 --- a/src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj +++ b/src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj @@ -27,7 +27,7 @@ - + From 6918f68b70bc545a94968a9be99b5231231e7255 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Sat, 17 Dec 2022 12:17:58 -0500 Subject: [PATCH 3/3] Update DevOpsMetrics.FunctionalTests.csproj --- .../DevOpsMetrics.FunctionalTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj b/src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj index 73bac4e7..bf5be6ef 100644 --- a/src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj +++ b/src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj @@ -7,7 +7,7 @@ - +