fix: SonarCloud issues and OpenSource documentations #91
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Scan with SonarCloud | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
scan-sonarcloud: | |
name: Build and analyze | |
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: Cache .NET dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.nuget/packages | |
~/.dotnet | |
key: ${{ runner.os }}-dotnet-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-dotnet- | |
- name: Install SonarQube scanner | |
shell: powershell | |
run: | | |
dotnet tool install --global dotnet-sonarscanner | |
- name: Install .NET coverage tool | |
shell: powershell | |
run: | | |
dotnet tool install --global dotnet-coverage | |
- name: Cache SonarCloud data | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar | |
key: ${{ runner.os }}-sonar-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-sonar- | |
- name: Analyze with SonarQube | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
shell: powershell | |
run: | | |
dotnet sonarscanner begin /k:"LuxoriaSoft_Luxoria" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /o:"luxoria" /d:sonar.coverage.exclusions="**/App.xaml.cs, **/MainWindow.xaml.cs, **/*.sqignore" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml | |
dotnet build Luxoria.App/Luxoria.App.sln --no-incremental | |
dotnet-coverage collect "dotnet test Luxoria.App/Luxoria.App.sln" -f xml -o "coverage.xml" | |
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |