Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #427 from DFE-Digital/add-sonarcloud-scanning
Browse files Browse the repository at this point in the history
Use dotnet test for coverage collection, reportgenerator to output to SonarCloud
  • Loading branch information
cshnimble authored Nov 10, 2022
2 parents 32dde0f + 4c21daf commit ab24aac
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
restore-keys: ${{ runner.os }}-sonar
- name: Install SonarCloud scanners
run: dotnet tool install --global dotnet-sonarscanner
- name: Install dotnet-coverage
run: dotnet tool install --global dotnet-coverage
- name: Install dotnet reportgenerator
run: dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Restore dependencies
run: dotnet restore
- name: Setup node.js
Expand All @@ -48,7 +48,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet-sonarscanner begin /k:"DFE-Digital_academy-transfers-api" /o:"dfe-digital" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet-sonarscanner begin /k:"DFE-Digital_academy-transfers-api" /o:"dfe-digital" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=CoverageReport/SonarQube.xml
dotnet build -c Release --no-restore
dotnet test -c Release --no-build --verbosity normal
dotnet test -c Release --no-build --verbosity normal --collect:"XPlat Code Coverage"
reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:./CoverageReport -reporttypes:SonarQube
dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

0 comments on commit ab24aac

Please sign in to comment.