Skip to content

Commit

Permalink
configurue code coverage for sonarcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
italopessoa committed Sep 17, 2024
1 parent 14db5fa commit 1fe5c69
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,41 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --logger trx --results-directory coverage --settings tests/coverage.runsettings

- name: Sonarcloud
if: github.event_name != 'pull_request' || github.ref == 'refs/heads/main'
uses: sonarsource/[email protected]
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: 'coverage/*/coverage.cobertura.xml'
badge: true
format: 'markdown'
output: 'both'

- name: Add Coverage PR Comment
continue-on-error: true
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md

- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

sonarcloud:
needs: [build]
if: github.event_name != 'pull_request' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarCloud Scan
uses: sonarsource/[email protected]
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

build-docker-image:
if: github.ref == 'refs/heads/main'
needs: [build]
Expand Down
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sonar.projectKey=soat-fiap_FIAP.TechChallenge.ByteMeBurger
sonar.organization=soat-fiap
sonar.projectName=Byte me burger API
sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml

0 comments on commit 1fe5c69

Please sign in to comment.