Skip to content

Commit

Permalink
ci: fix sonar configuration for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
ariwk committed Oct 20, 2024
1 parent df0a02b commit 8490ded
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/poetry-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
push:
branches: ['**/**']
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
jobs:
verify-with-tox:
runs-on: ubuntu-latest
Expand All @@ -24,15 +25,28 @@ jobs:
run: poetry install
- name: Run tests
run: poetry run tox
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v3
- name: SonarCloud Scan for PR
uses: sonarsource/sonarcloud-github-action@v3
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
with:
args: >
-Dsonar.branch.name=${{ env.BRANCH_NAME }}
args: |
-Dsonar.pullrequest.base=${{ github.base_ref }}
-Dsonar.pullrequest.branch=${{ BRANCH_NAME }}
-Dsonar.pullrequest.key=${{ github.event.issue.number }}
- name: SonarCloud Scan for Push
uses: sonarsource/sonarcloud-github-action@v3
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
with:
args: |
-Dsonar.branch.name=${{ BRANCH_NAME }}
release-please:
needs: verify-with-tox
runs-on: ubuntu-latest
Expand Down
7 changes: 4 additions & 3 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ sonar.sourceEncoding=UTF-8
# Additional parameters
sonar.python.xunit.reportPaths=junittest.xml
sonar.python.coverage.reportPaths=coverage.xml
sonar.branch.target = main
sonar.test.exclusions=tests/**
sonar.tests=tests/
#sonar.branch.target = main
#sonar.test.exclusions=tests/**
#sonar.tests=tests/
sonar.python.version=3.12
sonar.qualitygate.wait=true

0 comments on commit 8490ded

Please sign in to comment.