Skip to content

Create sonarcloud.yml #28

Create sonarcloud.yml

Create sonarcloud.yml #28

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build
- name: Test
run: dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults/
- name: Convert coverage report to OpenCover format
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
reportgenerator -reports:./TestResults/*/coverage.cobertura.xml -targetdir:./TestResults/ -reporttypes:opencover
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ./TestResults/
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarCloud Scan
uses: sonarsource/[email protected] # Ex: v2.1.0, See the latest version at https://github.com/marketplace/actions/sonarcloud-scan
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}