Skip to content

Commit

Permalink
Fix issues with #97 related to SonarCloud migration (#99)
Browse files Browse the repository at this point in the history
- Data not showing in the SonarCloud dashboard is now fixed 🔧
- Implement SonarCloud task for test.yml and deploy.yml GitHub actions
  • Loading branch information
mayank1211 authored Nov 29, 2023
1 parent 5d92cd9 commit 3ea156a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ jobs:
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build:production
- name: Analyze with SonarQube
uses: SonarSource/sonarqube-scan-action@7295e71c9583053f5bf40e9d4068a0c974603ec8
- name: Sonar analysis
uses: sonarsource/sonarcloud-github-action@master
with:
projectBaseDir: .
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
with:
args:
-Dsonar.projectKey=nhsuk-user-feedback-form
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
-Dsonar.coverage.exclusions=**/*.config.js,**/coverage/**
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# Only trigger if it's release tag.
- name: Create Release
if: ${{ endsWith(github.ref, 'master') == false }}
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,12 @@ jobs:
uses: actions/upload-artifact@master
with:
name: Depcheck report
path: ${{github.workspace}}/reports
path: ${{github.workspace}}/reports
- name: Sonar analysis
uses: sonarsource/sonarcloud-github-action@master
with:
projectBaseDir: .
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
24 changes: 24 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SonarQube properties
sonar.projectKey=nhsuk-user-feedback-form
sonar.organization=nhsdigital

# Project language
sonar.language=js

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

# Add file exclusions
sonar.exclusions=reports/**

# Add coverage exclusions
sonar.coverage.exclusions=**/*.config.js,**/coverage/**,**/*check-report.html

# Adding the dependency-check parameter
sonar.dependencyCheck.htmlReportPath=reports/dependency-check/dependency-check-report.html

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

# Adding the coverage analysis parameter
sonar.javascript.lcov.reportPaths=./coverage/lcov.info

0 comments on commit 3ea156a

Please sign in to comment.