From 843b8d9fe1f952474bae68d902bc897b35bda883 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Sun, 10 Jul 2022 17:02:40 +0100 Subject: [PATCH] Add Sonar --- .deepsource.toml => .github/archive/.deepsource.toml | 0 codecov.yml => .github/archive/codecov.yml | 0 .github/workflows/merge-to-main.yml | 12 +++++++----- .github/workflows/pull-request.yml | 12 +++++++----- sonar-project.properties | 6 ++++++ 5 files changed, 20 insertions(+), 10 deletions(-) rename .deepsource.toml => .github/archive/.deepsource.toml (100%) rename codecov.yml => .github/archive/codecov.yml (100%) create mode 100644 sonar-project.properties diff --git a/.deepsource.toml b/.github/archive/.deepsource.toml similarity index 100% rename from .deepsource.toml rename to .github/archive/.deepsource.toml diff --git a/codecov.yml b/.github/archive/codecov.yml similarity index 100% rename from codecov.yml rename to .github/archive/codecov.yml diff --git a/.github/workflows/merge-to-main.yml b/.github/workflows/merge-to-main.yml index ed9402e..53fe898 100644 --- a/.github/workflows/merge-to-main.yml +++ b/.github/workflows/merge-to-main.yml @@ -20,12 +20,14 @@ jobs: run: | coverage run -m py.test -v coverage xml - - name: Report results to DeepSource - run: | - curl https://deepsource.io/cli | sh - ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml + - uses: sonarsource/sonarqube-scan-action@master env: - DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + - uses: sonarsource/sonarqube-quality-gate-action@master + timeout-minutes: 5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} build: needs: coverage diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index f3f442f..7385e4e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -28,9 +28,11 @@ jobs: run: | coverage run -m py.test -v coverage xml - - name: Report results to DeepSource - run: | - curl https://deepsource.io/cli | sh - ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml + - uses: sonarsource/sonarqube-scan-action@master env: - DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + - uses: sonarsource/sonarqube-quality-gate-action@master + timeout-minutes: 5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..497d331 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=luketainton_pypilot_AYHo1eOKSbMjdyWLhHhP +sonar.python.version=3.10 +sonar.python.coverage.reportPaths=coverage.xml +sonar.sources=app +sonar.tests=tests +sonar.exclusions=,.github/**,.gitignore,CODEOWNERS,CHANGELOG.md,LICENSE.md,README.md,renovate.json,requirements-dev.txt,requirements.txt \ No newline at end of file