From 9eb7ba306502a2ed9cf0a4cea8a2f6c5de85988d Mon Sep 17 00:00:00 2001 From: Jeroen van Warmerdam Date: Sun, 25 Aug 2024 14:11:42 +0200 Subject: [PATCH] SonarCloud improvements --- .github/workflows/ci.yml | 26 ++++++++++++++++++++------ cspell.json | 3 ++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71b015e..e66e1a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,19 +57,24 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 - sonarcloud: + analyze_sonarcloud: name: Run SonarCloud scanning runs-on: windows-latest steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: "zulu" java-version: 21 - - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + dotnet-version: "8" - name: Cache SonarCloud packages uses: actions/cache@v4 @@ -99,9 +104,18 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} shell: powershell run: | - .\.sonar\scanner\dotnet-sonarscanner begin /k:"jerone_Jvw.DevToys.SemverCalculator" /o:"jerone" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" + .\.sonar\scanner\dotnet-sonarscanner begin ` + /k:"jerone_Jvw.DevToys.SemverCalculator" ` + /o:"jerone" ` + /d:sonar.token="${{ secrets.SONAR_TOKEN }}" ` + /d:sonar.host.url="https://sonarcloud.io" ` + /d:sonar.exclusions="**/Pack/**/*" ` + /d:sonar.verbose=true + dotnet build - .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + + .\.sonar\scanner\dotnet-sonarscanner end ` + /d:sonar.token="${{ secrets.SONAR_TOKEN }}" nuget_pack: name: Pack NuGet package @@ -159,7 +173,7 @@ jobs: nuget_publish: name: Publish NuGet package runs-on: ubuntu-latest - needs: [nuget_validate, build_test, analyze_codeql, sonarcloud] + needs: [nuget_validate, build_test, analyze_codeql, analyze_sonarcloud] if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') steps: - name: Setup .NET diff --git a/cspell.json b/cspell.json index c596338..06ee151 100644 --- a/cspell.json +++ b/cspell.json @@ -20,7 +20,8 @@ "pwsh", "sonarcloud", "sonarsource", - "temurin" + "temurin", + "zulu" ], "ignoreWords": [], "import": []