diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 6b766dff0a..8be6410f01 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -78,4 +78,29 @@ jobs: uses: actions/upload-artifact@v4 with: name: backend-coverage-report - path: coverage/ \ No newline at end of file + path: coverage/ + + sonar: + name: SonarCloud Scan + runs-on: ubuntu-latest + needs: test + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Use Node.js 20.17.0 + uses: actions/setup-node@v4 + with: + node-version: 20.17.0 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: SonarCloud Scan + uses: SonarSource/sonarqube-scan-action@v4 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000..eb680e0588 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,7 @@ +sonar.projectKey=OneCommunityGlobal_HGNRest +sonar.organization=onecommunityglobal + +sonar.sources=src +sonar.exclusions=**/node_modules/**,**/coverage/**,**/dist/**,**/build/**,**/*.test.js,**/*.spec.js,**/test/**,**/__tests__/** + +sonar.javascript.lcov.reportPaths=coverage/lcov.info \ No newline at end of file