Repository navigation
Compose Client through DI and plugin Hosting #29
Workflow file for this run
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
| name: SonarQube | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build and analyze | |
| runs-on: windows-latest | |
| steps: | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 | |
| with: | |
| java-version: 21 | |
| distribution: "zulu" # Alternative distribution options are available. | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
| - name: Set up .NET SDK | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| dotnet-version: 10.0.401 | |
| - name: Cache SonarQube Cloud packages | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~\sonar\cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Cache SonarQube Cloud scanner | |
| id: cache-sonar-scanner | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ${{ runner.temp }}\scanner | |
| key: ${{ runner.os }}-sonar-scanner | |
| restore-keys: ${{ runner.os }}-sonar-scanner | |
| - name: Install SonarQube Cloud scanner | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false | |
| shell: powershell | |
| run: | | |
| $scannerPath = Join-Path $env:RUNNER_TEMP 'scanner' | |
| $scannerExecutable = Join-Path $scannerPath 'dotnet-sonarscanner.exe' | |
| New-Item -Path $scannerPath -ItemType Directory -Force | Out-Null | |
| if (-not (Test-Path $scannerExecutable)) { | |
| dotnet tool update dotnet-sonarscanner --tool-path $scannerPath | |
| } | |
| - name: Begin SonarQube Cloud analysis | |
| id: sonar_begin | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| shell: powershell | |
| run: | | |
| & "$env:RUNNER_TEMP\scanner\dotnet-sonarscanner.exe" begin /k:"CheatEngineNet_CheatEngine.Client" /o:"cheatenginenet" "/d:sonar.token=$env:SONAR_TOKEN" /d:sonar.cs.cobertura.reportsPaths="artifacts/sonar-test-results/**/*.cobertura.xml" | |
| - name: Build | |
| shell: powershell | |
| run: | | |
| dotnet build CheatEngine.Client.slnx --configuration Release | |
| - name: Test | |
| shell: powershell | |
| run: | | |
| # The stacked branches deliberately introduce some test projects before their first tests. MTP reports exit | |
| # code 8 for those empty intermediate projects; ignore only that code while genuine test failures still fail. | |
| dotnet test --solution CheatEngine.Client.slnx --configuration Release --no-build --coverage --coverage-output-format cobertura --results-directory artifacts/sonar-test-results --ignore-exit-code 8 | |
| - name: End SonarQube Cloud analysis | |
| if: ${{ always() && steps.sonar_begin.outcome == 'success' }} | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| shell: powershell | |
| run: | | |
| & "$env:RUNNER_TEMP\scanner\dotnet-sonarscanner.exe" end "/d:sonar.token=$env:SONAR_TOKEN" |