Skip to content

Commit da99ff7

Browse files
committed
Sonar qube support
1 parent 1649722 commit da99ff7

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

.github/workflows/check-pull-request.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,9 @@ jobs:
8888
- name: Run integration tests
8989
run: dotnet test ./working-dir/KeeperData.Bridge.sln --filter "Dependence=docker&testtype!=performance"
9090

91-
## SonarCloud
92-
## Uncomment to unable SonarCloud scan
93-
## Requires project to be set up in SonarCloud
94-
## and the SonarCloud token to be set in the repository secrets
95-
# sonarcloud-scan:
96-
# name: CDP SonarCloud Scan
97-
# uses: ./.github/workflows/sonarcloud.yml
98-
# needs: pr-validator
99-
# secrets: inherit
91+
sonarcloud-scan:
92+
name: CDP SonarCloud Scan
93+
uses: ./.github/workflows/sonarcloud.yml
94+
needs: pr-validator
95+
secrets:
96+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/sonarcloud.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Run SonarCloud coverage scan
22

33
on:
44
workflow_call:
5+
secrets:
6+
SONAR_TOKEN:
7+
description: "SonarCloud token used for authentication"
8+
required: true
59

610
permissions:
711
id-token: write
@@ -64,7 +68,7 @@ jobs:
6468
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
6569
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6670
run: |
67-
./.sonar/scanner/dotnet-sonarscanner begin /k:"DEFRA_cdp-dotnet-backend-template" /o:"defra" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
68-
dotnet build --no-incremental
69-
./.sonar/coverage/dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
70-
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
71+
./.sonar/scanner/dotnet-sonarscanner begin /k:"DEFRA_ls-keeper-data-bridge-backend" /o:"defra" /d:sonar.token="$SONAR_TOKEN" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
72+
dotnet build KeeperData.Bridge.sln --no-incremental
73+
./.sonar/coverage/dotnet-coverage collect "dotnet test KeeperData.Bridge.sln --filter \"Dependence!=docker&testtype!=performance\"" -f xml -o "coverage.xml"
74+
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN"

0 commit comments

Comments
 (0)