|
1 |
| -name: Build ConnyConsole |
2 |
| -permissions: |
3 |
| - contents: read |
4 |
| - pull-requests: write |
| 1 | +name: Build and analyze |
5 | 2 |
|
6 | 3 | on:
|
7 | 4 | push:
|
8 |
| - branches: |
9 |
| - - "develop" |
10 |
| - - "master" |
11 |
| - pull_request: |
12 |
| - branches: |
13 |
| - - "develop" |
14 |
| - - "master" |
| 5 | + branches: [develop, master] |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened] |
| 8 | + branches: [develop, master] |
15 | 9 | workflow_dispatch:
|
16 | 10 |
|
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + pull-requests: write |
| 14 | + |
17 | 15 | env:
|
18 | 16 | solutionPath: './src/ConnyConsole.sln'
|
19 | 17 |
|
20 | 18 | jobs:
|
21 | 19 | build:
|
22 |
| - |
| 20 | + name: Build and analyze |
23 | 21 | runs-on: windows-latest
|
24 |
| - |
25 | 22 | steps:
|
26 | 23 | - uses: actions/checkout@v4
|
| 24 | + with: |
| 25 | + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis |
27 | 26 | - name: Setup .NET
|
28 | 27 | uses: actions/setup-dotnet@v4
|
29 | 28 | with:
|
30 | 29 | dotnet-version: 9.0.x
|
31 |
| - - name: Restore dependencies |
| 30 | + - name: Set up JDK 17 |
| 31 | + uses: actions/setup-java@v4 |
| 32 | + with: |
| 33 | + java-version: 17 |
| 34 | + distribution: 'zulu' |
| 35 | + - name: Cache SonarQube Cloud packages |
| 36 | + uses: actions/cache@v4 |
| 37 | + with: |
| 38 | + path: ~\sonar\cache |
| 39 | + key: ${{ runner.os }}-sonar |
| 40 | + restore-keys: ${{ runner.os }}-sonar |
| 41 | + - name: Cache SonarQube Cloud scanner |
| 42 | + id: cache-sonar-scanner |
| 43 | + uses: actions/cache@v4 |
| 44 | + with: |
| 45 | + path: .\.sonar\scanner |
| 46 | + key: ${{ runner.os }}-sonar-scanner |
| 47 | + restore-keys: ${{ runner.os }}-sonar-scanner |
| 48 | + - name: Install SonarQube Cloud scanner |
| 49 | + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' |
| 50 | + shell: powershell |
| 51 | + run: | |
| 52 | + New-Item -Path .\.sonar\scanner -ItemType Directory |
| 53 | + dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner |
| 54 | + - name: Restore ${{ env.solutionPath }} dependencies |
32 | 55 | run: dotnet restore ${{ env.solutionPath }}
|
33 |
| - - name: Build |
| 56 | + - name: Prepare SonarQube analyze |
| 57 | + env: |
| 58 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 59 | + shell: powershell |
| 60 | + run: | |
| 61 | + .\.sonar\scanner\dotnet-sonarscanner begin /k:"HaGGi13_ConnyConsole" /o:"haggi13" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" |
| 62 | + - name: Build ${{ env.solutionPath }} |
34 | 63 | run: dotnet build --no-restore ${{ env.solutionPath }}
|
| 64 | + - name: Run SonarQube analyze |
| 65 | + env: |
| 66 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 67 | + shell: powershell |
| 68 | + run: | |
| 69 | + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |
0 commit comments