Skip to content

Added sonar

Added sonar #10

Workflow file for this run

name: Continuous Integration with SonarCloud
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Continuous Integration
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x.x'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-incremental --no-restore
- name: Test and scan
run: |
dotnet tool install --global dotnet-sonarscanner --add-source 'https://api.nuget.org/v3/index.json' --ignore-failed-sources
dotnet tool install --global dotnet-coverage --add-source 'https://api.nuget.org/v3/index.json' --ignore-failed-sources
dotnet sonarscanner begin /k:"adimiko_transactioncontext" /o:"adimiko" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.host.url="https://sonarcloud.io" /d:sonar.pullrequest.github.summary_comment="true"
dotnet build --no-incremental
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
shell: bash