|
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 |
36 | | - - name: Build |
| 67 | + |
| 68 | + - name: build and analyze |
| 69 | + if: matrix.platform.name == 'MacOS' |
| 70 | + run: | |
| 71 | + dotnet restore |
| 72 | + dotnet tool update --global dotnet-coverage |
| 73 | + ./.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 /d:sonar.scanner.scanAll=false |
| 74 | + dotnet build --no-incremental |
| 75 | + dotnet-coverage collect 'dotnet test --no-build' -f xml -o 'coverage.xml' |
| 76 | + ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |
| 77 | + |
| 78 | + - name: Build Release |
37 | 79 | run: dotnet build -c Release |
38 | 80 | - name: Test |
39 | 81 | if: matrix.platform.name == 'MacOS' |
|
45 | 87 | reportgenerator -reports:test-result.cobertura.xml -targetdir:coverage-report -reporttypes:"Html;JsonSummary;MarkdownSummaryGithub;Badges" |
46 | 88 | cat coverage-report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY |
47 | 89 | |
48 | | - - name: ReportGenerator |
| 90 | + - name: ReportGenerator_CoverageReport |
49 | 91 | if: matrix.platform.name == 'MacOS' |
50 | 92 | uses: danielpalme/ReportGenerator-GitHub-Action@5.3.11 |
51 | 93 | with: |
|
84 | 126 | run: | |
85 | 127 | echo "" > coverage-badge.md |
86 | 128 | cat coverage-badge.md >> README.md |
| 129 | + |
| 130 | + |
87 | 131 |
|
88 | 132 | publish_badge: |
89 | 133 | runs-on: ubuntu-24.04 |
|
0 commit comments