|
| 1 | +name: SonarCloud |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - develop |
| 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 11 |
| 14 | + uses: actions/setup-java@v1 |
| 15 | + with: |
| 16 | + java-version: 1.11 |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis |
| 20 | + - name: Cache SonarCloud packages |
| 21 | + uses: actions/cache@v1 |
| 22 | + with: |
| 23 | + path: ~\sonar\cache |
| 24 | + key: ${{ runner.os }}-sonar |
| 25 | + restore-keys: ${{ runner.os }}-sonar |
| 26 | + - name: Cache SonarCloud scanner |
| 27 | + id: cache-sonar-scanner |
| 28 | + uses: actions/cache@v1 |
| 29 | + with: |
| 30 | + path: .\.sonar\scanner |
| 31 | + key: ${{ runner.os }}-sonar-scanner |
| 32 | + restore-keys: ${{ runner.os }}-sonar-scanner |
| 33 | + - name: Install SonarCloud scanner |
| 34 | + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' |
| 35 | + shell: powershell |
| 36 | + run: | |
| 37 | + New-Item -Path .\.sonar\scanner -ItemType Directory |
| 38 | + dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner |
| 39 | + - name: Build and analyze |
| 40 | + env: |
| 41 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
| 42 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 43 | + shell: powershell |
| 44 | + run: | |
| 45 | + .\.sonar\scanner\dotnet-sonarscanner begin /k:"Flexberry_NewPlatform.Flexberry.ORM" /o:"flexberry" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" |
| 46 | + dotnet restore "Flexberry ORM.sln" |
| 47 | + dotnet build --no-restore -v q /p:WarningLevel=0 -c Debug "Flexberry ORM.sln" |
| 48 | + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" |
0 commit comments