|
1 | | -name: SonarCloud |
| 1 | +name: .NET |
2 | 2 | on: |
3 | 3 | push: |
4 | 4 | branches: [ "main" ] |
|
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 | build: |
10 | | - name: Build and analyze |
11 | | - runs-on: windows-latest |
| 10 | + name: Build |
| 11 | + runs-on: ubuntu-latest |
12 | 12 | steps: |
13 | | - - name: Set up JDK 17 |
14 | | - uses: actions/setup-java@v3 |
15 | | - with: |
16 | | - java-version: 17 |
17 | | - distribution: 'zulu' # Alternative distribution options are available. |
18 | | - |
19 | 13 | - name: Setup .NET |
20 | 14 | uses: actions/setup-dotnet@v4 |
21 | 15 | with: |
22 | | - dotnet-version: 9.0.x |
| 16 | + dotnet-version: 10.0.x |
23 | 17 |
|
24 | 18 | - uses: actions/checkout@v3 |
25 | | - with: |
26 | | - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis |
27 | 19 |
|
28 | | - - name: Cache SonarCloud packages |
29 | | - uses: actions/cache@v3 |
30 | | - with: |
31 | | - path: ~\sonar\cache |
32 | | - key: ${{ runner.os }}-sonar |
33 | | - restore-keys: ${{ runner.os }}-sonar |
34 | | - |
35 | | - - name: Cache SonarCloud scanner |
36 | | - id: cache-sonar-scanner |
37 | | - uses: actions/cache@v3 |
38 | | - with: |
39 | | - path: .\.sonar\scanner |
40 | | - key: ${{ runner.os }}-sonar-scanner |
41 | | - restore-keys: ${{ runner.os }}-sonar-scanner |
| 20 | + - name: Restore dependencies |
| 21 | + run: dotnet restore |
42 | 22 |
|
43 | | - - name: Install SonarCloud scanner |
44 | | - if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' |
45 | | - shell: powershell |
46 | | - run: | |
47 | | - New-Item -Path .\.sonar\scanner -ItemType Directory |
48 | | - dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner |
49 | | - |
50 | | - - name: Install dotnet coverage |
51 | | - shell: powershell |
52 | | - run: dotnet tool install dotnet-coverage --global |
| 23 | + - name: Build |
| 24 | + run: dotnet build --no-restore |
53 | 25 |
|
54 | | - - name: Build and analyze |
55 | | - env: |
56 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
57 | | - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
58 | | - shell: powershell |
59 | | - run: | |
60 | | - .\.sonar\scanner\dotnet-sonarscanner begin /k:"Top2000app_data" /o:"top2000app" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml |
61 | | - dotnet build |
62 | | - dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml" |
63 | | - .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |
| 26 | + - name: Test |
| 27 | + run: dotnet test --no-build --verbosity normal |
0 commit comments