Skip to content

Commit c2794f1

Browse files
committed
chore: run SonarCloud analysis immediately on PRs
1 parent e4dfc98 commit c2794f1

3 files changed

Lines changed: 27 additions & 12 deletions

File tree

.github/workflows/_test.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ on:
2727
required: false
2828
CODECOV_TOKEN:
2929
required: false
30-
SONAR_TOKEN:
31-
required: false
3230
SENTRY_DSN:
3331
required: false
3432

@@ -264,13 +262,6 @@ jobs:
264262
with:
265263
token: ${{ secrets.CODECOV_TOKEN }}
266264

267-
- name: SonarQube Scan
268-
if: ${{ !cancelled() && (env.GITHUB_WORKFLOW_RUNTIME != 'ACT') && matrix.runner == 'ubuntu-latest' }}
269-
uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # v7.0.0
270-
env:
271-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
272-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
273-
274265
- name: Assert no test failures
275266
# Single gate that fails the job if any test suite failed. Kept last so
276267
# that all reporting steps (Codecov, SonarQube, artifact upload) always

.github/workflows/ci-cd.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ jobs:
112112
AIGNOSTICS_REFRESH_TOKEN_PRODUCTION: ${{ secrets.AIGNOSTICS_REFRESH_TOKEN_PRODUCTION }}
113113
GCP_CREDENTIALS_PRODUCTION: ${{ secrets.GCP_CREDENTIALS_PRODUCTION }}
114114
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
115-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
116115
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} # For metrics
117116

118117
codeql:
@@ -130,8 +129,34 @@ jobs:
130129
packages: read
131130
security-events: write
132131

132+
sonarcloud:
133+
needs: [get-commit-message]
134+
if: |
135+
(!contains(needs.get-commit-message.outputs.commit_message, 'skip:ci')) &&
136+
(!contains(needs.get-commit-message.outputs.commit_message, 'build:native:only')) &&
137+
!(github.ref_type == 'branch' && startsWith(needs.get-commit-message.outputs.commit_message, 'Bump version:')) &&
138+
(!contains(github.event.pull_request.labels.*.name, 'skip:ci')) &&
139+
(!contains(github.event.pull_request.labels.*.name, 'build:native:only'))
140+
runs-on: ubuntu-latest
141+
permissions:
142+
contents: read
143+
pull-requests: write
144+
statuses: write
145+
steps:
146+
- name: Checkout
147+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
148+
with:
149+
fetch-depth: 0
150+
151+
- name: SonarQube Scan
152+
if: ${{ env.GITHUB_WORKFLOW_RUNTIME != 'ACT' }}
153+
uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # v7.0.0
154+
env:
155+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
157+
133158
ketryx_report_and_check:
134-
needs: [get-commit-message, lint, audit, test, codeql]
159+
needs: [get-commit-message, lint, audit, test, codeql, sonarcloud]
135160
if: |
136161
github.actor != 'dependabot[bot]' &&
137162
(!contains(needs.get-commit-message.outputs.commit_message, 'skip:ci')) &&

sonar-project.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ sonar.links.homepage=https://aignostics.readthedocs.io/en/latest/
66
sonar.links.scm=https://github.com/aignostics/python-sdk
77
sonar.links.ci=https://github.com/aignostics/python-sdk/actions
88
sonar.links.issues=https://github.com/aignostics/python-sdk/issues
9-
sonar.python.coverage.reportPaths=reports/coverage.xml
109
sonar.python.version=3.11, 3.12, 3.13
1110
sonar.coverage.exclusions=noxfile.py, template/**, tests/**, examples/**, docs/**, dist/**, dist_vercel/**, dist_native/**, **/third_party/**, codegen/**, **/_notebook.py, **/_pydicom_handler.py, **/_openslide_handler.py
1211
sonar.exclusions=template/**, examples/**, docs/**, dist/**, dist_vercel/**, dist_native/**, **/third_party/**, codegen/**, **/_notebook.py

0 commit comments

Comments
 (0)