|
| 1 | +name: SonarQube |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened] |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build and analyze |
| 11 | + runs-on: windows-latest |
| 12 | + steps: |
| 13 | + - name: Set up JDK 21 |
| 14 | + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 |
| 15 | + with: |
| 16 | + java-version: 21 |
| 17 | + distribution: "zulu" # Alternative distribution options are available. |
| 18 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 |
| 19 | + with: |
| 20 | + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis |
| 21 | + - name: Cache SonarQube Cloud packages |
| 22 | + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 |
| 23 | + with: |
| 24 | + path: ~\sonar\cache |
| 25 | + key: ${{ runner.os }}-sonar |
| 26 | + restore-keys: ${{ runner.os }}-sonar |
| 27 | + - name: Cache SonarQube Cloud scanner |
| 28 | + id: cache-sonar-scanner |
| 29 | + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 |
| 30 | + with: |
| 31 | + path: ${{ runner.temp }}\scanner |
| 32 | + key: ${{ runner.os }}-sonar-scanner |
| 33 | + restore-keys: ${{ runner.os }}-sonar-scanner |
| 34 | + - name: Install SonarQube Cloud scanner |
| 35 | + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' |
| 36 | + shell: powershell |
| 37 | + run: | |
| 38 | + New-Item -Path ${{ runner.temp }}\scanner -ItemType Directory |
| 39 | + dotnet tool update dotnet-sonarscanner --tool-path ${{ runner.temp }}\scanner |
| 40 | + - name: Build and analyze |
| 41 | + env: |
| 42 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 43 | + shell: powershell |
| 44 | + run: | |
| 45 | + ${{ runner.temp }}\scanner\dotnet-sonarscanner begin /k:"CheatEngineNet_CheatEngine.Client" /o:"cheatenginenet" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |
| 46 | + dotnet build |
| 47 | + ${{ runner.temp }}\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |
0 commit comments