|
| 1 | +name: Build |
1 | 2 | on:
|
2 |
| - # Trigger analysis when pushing in master or pull requests, and when creating |
3 |
| - # a pull request. |
4 | 3 | push:
|
5 | 4 | branches:
|
6 | 5 | - master
|
7 |
| -name: Main Workflow |
| 6 | + # pull_request: |
| 7 | + # types: [opened, synchronize, reopened] |
8 | 8 | jobs:
|
9 |
| - sonarcloud: |
10 |
| - runs-on: ubuntu-latest |
| 9 | + build: |
| 10 | + name: Build |
| 11 | + runs-on: windows-latest |
11 | 12 | steps:
|
| 13 | + - name: Set up JDK 11 |
| 14 | + uses: actions/setup-java@v1 |
| 15 | + with: |
| 16 | + java-version: 1.11 |
12 | 17 | - uses: actions/checkout@v2
|
13 | 18 | with:
|
14 |
| - # Disabling shallow clone is recommended for improving relevancy of reporting |
15 |
| - fetch-depth: 0 |
16 |
| - - name: SonarCloud Scan |
17 |
| - uses: sonarsource/sonarcloud-github-action@master |
| 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 |
18 | 40 | env:
|
19 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
20 | 42 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
| 43 | + shell: powershell |
| 44 | + run: | |
| 45 | + .\.sonar\scanner\dotnet-sonarscanner begin /k:"unity-korea-community_unity-builder" /o:"unity-korea-community" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" |
| 46 | + <your build command> |
| 47 | + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" |
0 commit comments