Added sonar #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v1 | |
- 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 | |
- 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 | |
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 |