|
31 | 31 | uses: actions/setup-dotnet@v4 |
32 | 32 | with: |
33 | 33 | dotnet-version: ${{ matrix.dotnet.version }} |
| 34 | + |
| 35 | + - name: Setup Java |
| 36 | + if: matrix.platform.name == 'MacOS' |
| 37 | + uses: actions/setup-java@v4 |
| 38 | + with: |
| 39 | + distribution: 'zulu' |
| 40 | + java-version: '21' |
| 41 | + |
| 42 | + - name: Cache SonarCloud packages |
| 43 | + if: matrix.platform.name == 'MacOS' |
| 44 | + uses: actions/cache@v4 |
| 45 | + with: |
| 46 | + path: ~/sonar/cache |
| 47 | + key: ${{ runner.os }}-sonar |
| 48 | + restore-keys: ${{ runner.os }}-sonar |
| 49 | + |
| 50 | + - name: Cache SonarCloud scanner |
| 51 | + if: matrix.platform.name == 'MacOS' |
| 52 | + id: cache-sonar-scanner |
| 53 | + uses: actions/cache@v4 |
| 54 | + with: |
| 55 | + path: ./.sonar/scanner |
| 56 | + key: ${{ runner.os }}-sonar-scanner |
| 57 | + restore-keys: ${{ runner.os }}-sonar-scanner |
| 58 | + |
| 59 | + - name: Install SonarCloud scanner |
| 60 | + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' && matrix.platform.name == 'MacOS' |
| 61 | + shell: pwsh |
| 62 | + run: | |
| 63 | + dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner |
| 64 | +
|
34 | 65 | - name: Enforce SDK Version |
35 | 66 | run: dotnet new globaljson --sdk-version ${{ steps.setup-dotnet.outputs.dotnet-version }} --force |
| 67 | + |
| 68 | + - name: pre_build |
| 69 | + if: matrix.platform.name == 'MacOS' |
| 70 | + run: ./.sonar/scanner/dotnet-sonarscanner begin /k:"magic5644_codeLineCounter" /o:"magic5644" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml |
| 71 | + |
36 | 72 | - name: Build |
37 | 73 | run: dotnet build -c Release |
38 | 74 | - name: Test |
|
44 | 80 | dotnet tool install --global dotnet-reportgenerator-globaltool |
45 | 81 | reportgenerator -reports:test-result.cobertura.xml -targetdir:coverage-report -reporttypes:"Html;JsonSummary;MarkdownSummaryGithub;Badges" |
46 | 82 | cat coverage-report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY |
| 83 | +
|
| 84 | + - name: post_build |
| 85 | + if: matrix.platform.name == 'MacOS' |
| 86 | + run: ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |
47 | 87 |
|
48 | 88 | - name: ReportGenerator |
49 | 89 | if: matrix.platform.name == 'MacOS' |
@@ -85,20 +125,7 @@ jobs: |
85 | 125 | echo "" > coverage-badge.md |
86 | 126 | cat coverage-badge.md >> README.md |
87 | 127 | |
88 | | - sonarcloud: |
89 | | - name: SonarCloud |
90 | | - runs-on: ubuntu-24.04 |
91 | | - needs: build |
92 | | - steps: |
93 | | - - uses: actions/checkout@v4 |
94 | | - with: |
95 | | - # Disabling shallow clone is recommended for improving relevancy of reporting |
96 | | - fetch-depth: 0 |
97 | | - - name: SonarCloud Scan |
98 | | - uses: SonarSource/sonarcloud-github-action@v2 |
99 | | - env: |
100 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
101 | | - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 128 | + |
102 | 129 |
|
103 | 130 | publish_badge: |
104 | 131 | runs-on: ubuntu-24.04 |
|
0 commit comments