-
Notifications
You must be signed in to change notification settings - Fork 4
[NRL-1922] Get Sonarcloud reporting working as required #1146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mattdean3-nhs
merged 21 commits into
develop
from
feature/made14-NRL-1922-sonarcloud-config-update
Feb 25, 2026
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
84b9af9
[NRL-1922] Generate coverage report when running unit tests. Fixup so…
mattdean3-nhs 00bbefa
[NRL-1922] Add new workflow for PR checks
mattdean3-nhs b7230f1
[NRL-1922] Remove unused sonarcloud url config
mattdean3-nhs 3980a11
[NRL-1922] Fix pr-checks workflow issues
mattdean3-nhs f6f4dd3
[NRL-1922] Fix pr-checks workflow issues
mattdean3-nhs 094192f
[NRL-1922] Fix pr-checks workflow issues
mattdean3-nhs 17f9f31
[NRL-1922] Fix pr-checks workflow issues
mattdean3-nhs 3d5f28d
[NRL-1922] Fix pr-checks workflow issues
mattdean3-nhs 3c44d1b
[NRL-1922] Fix pr-checks workflow issues
mattdean3-nhs 2767b3d
[NRL-1922] Fix pr-checks workflow issues
mattdean3-nhs db55f84
[NRL-1922] Fix pr-checks workflow issues
mattdean3-nhs 31faaf5
[NRL-1922] Fix pr-checks workflow issues
mattdean3-nhs 1437ffc
[NRL-1922] Remove placeholder comments from pr-checks workflow
mattdean3-nhs 64db9ff
[NRL-1922] Set relative flag for coverage config. Rename workflow jobs
mattdean3-nhs 8e9587f
[NRL-1922] WIP add some workflow debug
mattdean3-nhs 3189872
[NRL-1922] Explicitly call our sonar sources and tests paths
mattdean3-nhs 7fa8b1b
[NRL-1922] Explicitly call our sonar sources and tests paths
mattdean3-nhs 709e704
[NRL-1922] Remove debug from pr-checks. Add linting to build job
mattdean3-nhs 27243cf
[NRL-1922] Add sonarqube scan to daily build. Trigger it on every pus…
mattdean3-nhs 8a60b37
[NRL-1922] Move workflow permissions from top-level to job-level
mattdean3-nhs 7e81f3d
Merge branch 'develop' into feature/made14-NRL-1922-sonarcloud-config…
mattdean3-nhs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| name: Run PR checks | ||
| run-name: "Running checks for PR #${{ github.event.pull_request.number }} (${{ github.event.pull_request.title }})" | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build and test | ||
| runs-on: codebuild-nhsd-nrlf-ci-build-project-${{ github.run_id }}-${{ github.run_attempt }} | ||
| environment: pull-request | ||
| permissions: | ||
| contents: read | ||
| actions: write | ||
|
|
||
| steps: | ||
| - name: Git clone - ${{ github.ref }} | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.ref }} | ||
|
|
||
| - name: Setup environment | ||
| run: | | ||
| echo "${HOME}/.asdf/bin" >> $GITHUB_PATH | ||
| poetry install --no-root | ||
|
|
||
| - name: Lint | ||
| run: make lint | ||
|
|
||
| - name: Build | ||
| run: make build | ||
|
|
||
| - name: Test | ||
| run: make test | ||
|
|
||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build-artifacts | ||
| path: dist | ||
|
|
||
| sonar: | ||
| name: SonarQube scan | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| environment: pull-request | ||
| permissions: | ||
| contents: read | ||
| actions: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.ref }} | ||
|
|
||
| - name: Get build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: build-artifacts | ||
| path: dist | ||
|
|
||
| - name: SonarQube scan | ||
| uses: sonarsource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 #v7.0.0 | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
|
|
||
| - name: SonarQube quality gate check | ||
| id: sonarqube-quality-gate-check | ||
| uses: sonarsource/sonarqube-quality-gate-action@cf038b0e0cdecfa9e56c198bbb7d21d751d62c3b #v1.2.0 | ||
| with: | ||
| pollingTimeoutSec: 600 | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,14 @@ | ||
| sonar.projectKey=NHSDigital_NRLF | ||
| sonar.organization=nhsdigital | ||
| sonar.projectName=NRLF | ||
| sonar.python.version=3.9.5 | ||
| sonar.terraform.provider.aws.version=4.63.0 | ||
| # TODO: Some paths here are outdated and perhaps we don't want to exclude everything | ||
| sonar.cpd.exclusions=api/tests/**, tests/**, api/**/tests/**, feature_tests/**, cron/seed_sandbox/tests/**, data_contracts/**/tests/**, firehose/**/tests/**, firehose/**/scripts/**, helpers/tests/**, mi/**/tests/** | ||
| sonar.exclusions=scripts/**, **/scripts/**, api/tests/**, tests/**, api/**/tests/**, feature_tests/**, cron/seed_sandbox/tests/**, data_contracts/**/tests/**, firehose/**/tests/**, firehose/**/scripts/**, helpers/tests/**, mi/**/tests/** | ||
|
|
||
| # Exclude snomed urls as being unsafe | ||
| sonar.issue.ignore.multicriteria=exclude_snomed_urls | ||
| sonar.issue.ignore.multicriteria.exclude_snomed_urls.ruleKey=python:S5332 | ||
| sonar.issue.ignore.multicriteria.exclude_snomed_urls.pattern=**http://snomed\.info(/sct)?** | ||
| sonar.python.version=3.12 | ||
|
|
||
| sonar.sources=. | ||
| sonar.exclusions=scripts/** | ||
| sonar.tests=. | ||
| sonar.tests.inclusions=**/tests/** | ||
| sonar.coverage.exclusions=scripts/**, tests/**, **/tests/** | ||
| sonar.cpd.exclusions=tests/**, **/tests/** | ||
|
|
||
| sonar.python.coverage.reportPaths=dist/test-coverage.xml |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.