name: Sonar Scanner on: workflow_dispatch: jobs: sonarcloud: name: SonarCloud runs-on: windows-latest steps: - uses: actions/checkout@v2 with: # Shallow clones should be disabled for a better relevancy of analysis fetch-depth: 0 # Speed-up analysis by caching the scanner workspace - name: Cache SonarCloud workspace uses: actions/cache@v1 with: path: ~\.sonar\cache key: ${{ runner.os }}-sonar-cache restore-keys: ${{ runner.os }}-sonar-cache # Speed-up analysis by caching the scanner installation - name: Cache SonarCloud scanner id: cache-sonar-scanner uses: actions/cache@v1 with: path: .\.sonar\scanner key: ${{ runner.os }}-sonar-scanner restore-keys: ${{ runner.os }}-sonar-scanner - name: Install SonarCloud scanner if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' shell: powershell # The --version argument is optional. If it is omitted the latest version will be installed. run: | New-Item -Path .\.sonar\scanner -ItemType Directory dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner --version 4.8.0 - name: Build shell: powershell env: # Needed to get some information about the pull request, if any GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # The secret referenced in the command-line by SONAR_TOKEN should be generated # from https://sonarcloud.io/account/security/ # The organization and project arguments (see /o and /k) are displayed # on the project dashboard in SonarCloud. run: | .\.sonar\scanner\dotnet-sonarscanner begin /k:"Ombi-app_Ombi" /o:"ombi-app" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" dotnet build src/Ombi.sln .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"