Skip to content

Commit

Permalink
SonarCloud improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jerone committed Aug 25, 2024
1 parent 5bc42c6 commit 9eb7ba3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"pwsh",
"sonarcloud",
"sonarsource",
"temurin"
"temurin",
"zulu"
],
"ignoreWords": [],
"import": []
Expand Down

0 comments on commit 9eb7ba3

Please sign in to comment.