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 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 @@ - + 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 @@ - +