Skip to content
Merged
48 changes: 46 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,51 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet.version }}

- name: Setup Java
if: matrix.platform.name == 'MacOS'
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'

- name: Cache SonarCloud packages
if: matrix.platform.name == 'MacOS'
uses: actions/cache@v4
with:
path: ~/sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarCloud scanner
if: matrix.platform.name == 'MacOS'
id: cache-sonar-scanner
uses: actions/cache@v4
with:
path: ./.sonar/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' && matrix.platform.name == 'MacOS'
shell: pwsh
run: |
dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner

- name: Enforce SDK Version
run: dotnet new globaljson --sdk-version ${{ steps.setup-dotnet.outputs.dotnet-version }} --force
- name: Build

- name: build and analyze
if: matrix.platform.name == 'MacOS'
run: |
dotnet restore
dotnet tool update --global dotnet-coverage
./.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
dotnet build --no-incremental
dotnet-coverage collect 'dotnet test --no-build' -f xml -o 'coverage.xml'
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

- name: Build Release
run: dotnet build -c Release
- name: Test
if: matrix.platform.name == 'MacOS'
Expand All @@ -45,7 +87,7 @@ jobs:
reportgenerator -reports:test-result.cobertura.xml -targetdir:coverage-report -reporttypes:"Html;JsonSummary;MarkdownSummaryGithub;Badges"
cat coverage-report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY

- name: ReportGenerator
- name: ReportGenerator_CoverageReport
if: matrix.platform.name == 'MacOS'
uses: danielpalme/ReportGenerator-GitHub-Action@5.3.11
with:
Expand Down Expand Up @@ -84,6 +126,8 @@ jobs:
run: |
echo "![Coverage](./coverage-report/badge_combined.svg)" > coverage-badge.md
cat coverage-badge.md >> README.md



publish_badge:
runs-on: ubuntu-24.04
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@
/codeql*
/*.dot
/*snyk*

# Mac OS
.DS_Store
.AppleDouble
Loading