diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 30ac108..bafb6df 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -26,7 +26,7 @@ # Feel free to take a look at our documentation (https://docs.sonarcloud.io/getting-started/github/) # or reach out to our community forum if you need some help (https://community.sonarsource.com/c/help/sc/9) -name: SonarCloud analysis +name: SonarCloud Analysis on: push: @@ -40,28 +40,28 @@ permissions: jobs: Analysis: + name: SonarCloud Analysis runs-on: ubuntu-latest - steps: + - name: Test Coverage + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install dependencies + run: npm install + - name: Test and Coverage + run: npm run coverage - name: Analyze with SonarCloud - - # You can pin the exact commit or the version. - # uses: SonarSource/sonarcloud-github-action@v2.2.0 uses: SonarSource/sonarcloud-github-action@4006f663ecaf1f8093e8e4abb9227f6041f52216 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) with: - # Additional arguments for the SonarScanner CLI args: - # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) - # mandatory -Dsonar.projectKey=Endava_climatiq-impactframework-plugin -Dsonar.organization=endava - # Comma-separated paths to directories containing main source files. - #-Dsonar.sources= # optional, default is project base directory - # Comma-separated paths to directories containing test source files. - #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ - # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. - #-Dsonar.verbose= # optional, default is false - # When you need the analysis to take place in a directory other than the one from which it was launched, default is . + -Dsonar.scm.provider=git + -Dsonar.sources=src + -Dsonar.tests=src/__tests__ + -Dsonar.test.inclusions=src/**/*.test*.ts + -Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info projectBaseDir: . diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100755 index 0000000..2ae73af --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.organization=endava +sonar.projectKey=Endava_climatiq-impactframework-plugin +sonar.projectVersion=1.0.0 +sonar.scm.provider=git +sonar.sources=src +sonar.tests=src/__tests__ +sonar.test.inclusions=src/**/*.test*.ts +sonar.javascript.lcov.reportPaths=./coverage/lcov.info \ No newline at end of file