Another version number fix (#2561) #1151
This file contains hidden or 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
| # This workflow will build a .NET project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
| name: .SonarQube | |
| on: | |
| push: | |
| branches: [ "master", "main" ] | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: windows-latest | |
| steps: | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: 1.17 | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
| submodules: recursive # allows us to download kni and fna linked submodules | |
| - name: Set up .NET 9 | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Install workloads | |
| # android is included so SonarQube analyzes the MonoGameGum / KniGum Android | |
| # TFM assemblies (which carry the #if ANDROID code for native keyboard support). | |
| # KniGum uses opt-in for Android (IncludeAndroid=true); see KniGum.csproj for why. | |
| run: dotnet workload install ios maui android | |
| - name: Cache SonarQube packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~\.sonar\cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Cache SonarQube scanner | |
| id: cache-sonar-scanner | |
| uses: actions/cache@v4 | |
| with: | |
| path: .\.sonar\scanner | |
| key: ${{ runner.os }}-sonar-scanner | |
| restore-keys: ${{ runner.os }}-sonar-scanner | |
| - name: Install SonarQube scanner | |
| # Remove caching for now, this is to make sure we are on the newest version of the scanner | |
| #if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
| shell: powershell | |
| run: | | |
| $dir = ".\.sonar\scanner" | |
| if (-not (Test-Path $dir)) { New-Item -Path $dir -ItemType Directory | Out-Null } | |
| dotnet tool update dotnet-sonarscanner --tool-path $dir | |
| - name: Install dotnet-coverage | |
| run: dotnet tool install --global dotnet-coverage | |
| - name: Build and analyze | |
| shell: powershell | |
| run: | | |
| echo "::group::Start and Configure Scan" | |
| .\.sonar\scanner\dotnet-sonarscanner begin /o:"kaltinril" /k:"kaltinril_gum" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml | |
| echo "::endgroup::" | |
| echo "::group::Build" | |
| dotnet build .\AllLibraries.sln -p:IncludeAndroid=true | |
| echo "::endgroup::" | |
| echo "::group::Test Coverage" | |
| dotnet-coverage collect "dotnet test ./MonoGameGum.Tests/MonoGameGum.Tests.csproj --no-build" -f xml -o "coverage.xml" | |
| echo "::endgroup::" | |
| echo "::group::Process Scan and Upload" | |
| .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
| echo "::endgroup::" |