diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f91d1aa..09aae2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,3 +37,32 @@ jobs: - name: npm Build run: npm run build + + - name: SonarQube Scan (Push) + if: github.event_name == 'push' + uses: SonarSource/sonarqube-scan-action@v7 + env: + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + SONAR_HOST_URL: ${{ vars.SONARQUBE_HOST }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + projectBaseDir: . + args: > + -Dsonar.host.url=${{ env.SONAR_HOST_URL }} + -Dsonar.projectVersion=${{ env.VERSION }} + + - name: SonarQube Scan (Pull Request) + if: github.event_name == 'pull_request' + uses: SonarSource/sonarqube-scan-action@v7 + env: + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + SONAR_HOST_URL: ${{ vars.SONARQUBE_HOST }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + projectBaseDir: . + args: > + -Dsonar.host.url=${{ env.SONAR_HOST_URL }} + -Dsonar.projectVersion=${{ env.VERSION }} + -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} + -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} + -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..6d51985 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,10 @@ +sonar.projectName=react-native-client +sonar.projectKey=react-native-client +sonar.sources=src +sonar.inclusions=**/*.ts,**/*.tsx +sonar.tests=src +sonar.test.inclusions=**/*.spec.ts,**/*.spec.tsx +sonar.javascript.lcov.reportPaths=coverage/lcov.info +sonar.coverage.exclusions=**/__tests__/**/* +sonar.links.ci=https://github.com/splitio/react-native-client +sonar.links.scm=https://github.com/splitio/react-native-client/actions