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