Skip to content

Workflow file for this run

name: SonarCloud Analysis (C#)
on:
push:
branches:
- main
- feature/*
pull_request:
branches:
- main
jobs:
sonarcloud:
name: Analyze with SonarCloud
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Install SonarScanner for .NET
run: dotnet tool install --global dotnet-sonarscanner
- name: Install Coverlet.Console
run: dotnet tool install --global coverlet.console
- name: Build and Test with Coverage
run: |
dotnet build ./AutoGuru.KeyValuePush.sln
coverlet ./src/KeyValuePush.Tests/bin/Debug/net7.0/KeyValuePush.Tests.dll \
--target "dotnet" \
--targetargs "test ./src/KeyValuePush.Tests/KeyValuePush.Tests.csproj --no-build" \
--output ./TestResults/Coverage/ \
--format opencover
- name: Run SonarCloud analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet sonarscanner begin \
/k:"autoguru-au_kv-push" \
/o:"autoguru-au" \
/d:sonar.cs.opencover.reportsPaths="./TestResults/Coverage/coverage.opencover.xml" \
/d:sonar.scanner.skipJreProvisioning=true
dotnet build ./AutoGuru.KeyValuePush.sln
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"