|
| 1 | +name: Sonar |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened] |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build |
| 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: check out commons |
| 21 | + uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + repository: equipognoss/Gnoss.Commons.OpenCORE |
| 24 | + path: ./Gnoss.Commons |
| 25 | + ref: main |
| 26 | + - name: change folder |
| 27 | + run: | |
| 28 | + cd .. |
| 29 | + mv Gnoss.BackgroundTask.CacheRefresh.OpenCORE/Gnoss.Commons Gnoss.Commons |
| 30 | + cd Gnoss.BackgroundTask.CacheRefresh.OpenCORE |
| 31 | + - name: Cache SonarCloud packages |
| 32 | + uses: actions/cache@v1 |
| 33 | + with: |
| 34 | + path: ~\sonar\cache |
| 35 | + key: ${{ runner.os }}-sonar |
| 36 | + restore-keys: ${{ runner.os }}-sonar |
| 37 | + - name: Cache SonarCloud scanner |
| 38 | + id: cache-sonar-scanner |
| 39 | + uses: actions/cache@v1 |
| 40 | + with: |
| 41 | + path: .\.sonar\scanner |
| 42 | + key: ${{ runner.os }}-sonar-scanner |
| 43 | + restore-keys: ${{ runner.os }}-sonar-scanner |
| 44 | + - name: Install SonarCloud scanner |
| 45 | + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' |
| 46 | + shell: powershell |
| 47 | + run: | |
| 48 | + New-Item -Path .\.sonar\scanner -ItemType Directory |
| 49 | + dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner |
| 50 | + - name: Build and analyze |
| 51 | + env: |
| 52 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 53 | + shell: powershell |
| 54 | + run: | |
| 55 | + .\.sonar\scanner\dotnet-sonarscanner begin /k:"equipognoss_Gnoss.BackgroundTask.CacheRefresh.OpenCORE" /o:"equipognoss" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" |
| 56 | + dotnet build |
| 57 | + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" |
0 commit comments