From f3d7fc9a404ff43ebc2253f093ae0dda5a09cc6a Mon Sep 17 00:00:00 2001 From: Edouard Date: Thu, 2 Mar 2023 17:37:06 +0100 Subject: [PATCH] ci: add setup for Sonar analysis --- .github/workflows/test.yml | 21 +++++++++++++++------ sonar-project.properties | 10 ++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 97010ba..a2336eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,9 +36,18 @@ jobs: with: from: ${{ steps.set-shas.outputs.base }} - # TODO: - # - name: SonarCloud Scan - # uses: sonarsource/sonarcloud-github-action@master - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # for now we just have one lib in the monorepo, so we can just use its version to qualify the sonar quality gate new code + - name: Get nx-heroku version + id: nx-heroku-version + uses: martinbeentjes/npm-get-version-action@main + with: + path: packages/nx-heroku + + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + args: > + -Dsonar.projectVersion=${{ steps.nx-heroku-version.outputs.current-version }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..273a661 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,10 @@ +sonar.organization=getlarge +sonar.projectKey=getlarge_nx-heroku +sonar.projectName=nx-heroku +sonar.sourceEncoding=UTF-8 +sonar.sources=. +sonar.inclusions=**/*.ts +sonar.exclusions=dist/*,**/fixtures/*,**/cache/*,**/*spec.ts +sonar.cpd.exclusions=**/*spec.ts +sonar.coverage.exclusions=**/*spec.ts +sonar.javascript.lcov.reportPaths=coverage/lcov.info