From 59e7f76e45e0f376fb8f92e2b182ff679934f5d9 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Sat, 13 Aug 2022 22:33:31 +0100 Subject: [PATCH] Switch to SonarCloud --- .../merge-to-main.yml | 0 .../workflows/{pull-request.yml => ci.yml} | 23 ++++++++++++------- sonar-project.properties | 6 ++++- 3 files changed, 20 insertions(+), 9 deletions(-) rename .github/{workflows => workflows-disabled}/merge-to-main.yml (100%) rename .github/workflows/{pull-request.yml => ci.yml} (55%) diff --git a/.github/workflows/merge-to-main.yml b/.github/workflows-disabled/merge-to-main.yml similarity index 100% rename from .github/workflows/merge-to-main.yml rename to .github/workflows-disabled/merge-to-main.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/ci.yml similarity index 55% rename from .github/workflows/pull-request.yml rename to .github/workflows/ci.yml index 43144b9..163ebdc 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,9 @@ name: CI on: + push: + branches: [ main ] pull_request: + types: [opened, synchronize, reopened] paths-ignore: - 'README.md' - 'LICENSE.md' @@ -15,7 +18,6 @@ jobs: - name: Check out repository code uses: actions/checkout@v3 with: - ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 - name: Setup Python uses: actions/setup-python@v4 @@ -29,11 +31,16 @@ jobs: run: | coverage run -m py.test -v --junitxml=testresults.xml coverage xml - - uses: sonarsource/sonarqube-scan-action@master + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master env: - 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 }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CLOUD }} + # - uses: sonarsource/sonarqube-scan-action@master + # env: + # 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 index 4ffb8ad..15aefe9 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,4 +1,8 @@ -sonar.projectKey=luketainton_pypilot_AYHo1eOKSbMjdyWLhHhP +sonar.organization=luketainton +sonar.projectKey=luketainton_pypilot +# sonar.projectKey=luketainton_pypilot_AYHo1eOKSbMjdyWLhHhP +sonar.projectName=pypilot +sonar.projectVersion=1.0 sonar.python.version=3.10 sonar.python.coverage.reportPaths=coverage.xml sonar.python.pylint.reportPaths=lintreport.txt -- 2.47.2