From 79a5047100c0a8839bffac3a62f965c7a04f8b75 Mon Sep 17 00:00:00 2001 From: Andy Bridges Date: Fri, 25 Oct 2024 09:43:48 +0100 Subject: [PATCH] add sonarcloud --- .github/workflows/main.yml | 7 +++++++ .github/workflows/sonarcloud.yml | 20 ++++++++++++++++++++ sonar-project.properties | 15 +++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 .github/workflows/sonarcloud.yml create mode 100644 sonar-project.properties diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0577bbc909b..a1310370222 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,6 +46,12 @@ jobs: SENTRY_KEY: ${{ secrets.SENTRY_KEY }} GF_SURVEY_KEY: ${{ secrets.GF_SURVEY_KEY }} + sonarcloud: + name: Sonarcloud + uses: ./.github/workflows/sonarcloud.yml + secrets: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + all-jobs-completed: name: All jobs completed runs-on: ubuntu-latest @@ -54,6 +60,7 @@ jobs: - build - lint - case + - sonarcloud outputs: PASSED: ${{ steps.set-output.outputs.PASSED }} steps: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 00000000000..b2471100348 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,20 @@ +name: Sonarcloud + +on: + workflow_call: + secrets: + SONAR_TOKEN: + required: true + +jobs: + sonarcloud: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@5875562561d22a34be0c657405578705a169af6c + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000000..f74d299d524 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,15 @@ +# Unique sonar data by project +sonar.projectKey=metamask-docs +sonar.organization=metamask + +# Source +sonar.sources=src +# sonar.exclusions= + +# Tests +# sonar.tests=src,test +# sonar.test.inclusions=**/*.test.ts +# sonar.javascript.lcov.reportPaths=coverage/coverage/unit/lcov.info + +# Block PRs with quality gate failures +sonar.qualitygate.wait=false \ No newline at end of file