Skip to content

Commit 4e18dac

Browse files
committed
Add java sonar scanning
1 parent 8be4875 commit 4e18dac

File tree

5 files changed

+47
-0
lines changed

5 files changed

+47
-0
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
with:
1616
install_java: true
1717

18+
sonar_scan:
19+
uses: ./.github/workflows/sonar.yml
20+
needs: quality_checks
21+
1822
get_commit_id:
1923
runs-on: ubuntu-latest
2024
outputs:

.github/workflows/pull_request.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
with:
1616
install_java: true
1717

18+
sonar_scan:
19+
uses: ./.github/workflows/sonar.yml
20+
needs: quality_checks
21+
1822
pr_title_format_check:
1923
uses: ./.github/workflows/pr_title_check.yml
2024

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
with:
1515
install_java: true
1616

17+
sonar_scan:
18+
uses: ./.github/workflows/sonar.yml
19+
needs: quality_checks
20+
1721
get_commit_id:
1822
runs-on: ubuntu-latest
1923
outputs:

.github/workflows/sonar.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Run SonarCloud scan
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
BRANCH_NAME: ${{ github.event.ref.BRANCH_NAME }}
8+
9+
jobs:
10+
run_sonar_scan:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: run tests and Sonar scan
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
16+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
17+
run: |
18+
# shellcheck source=/dev/null
19+
. ~/.asdf/plugins/java/set-java-home.bash
20+
make download-dependencies
21+
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=NHSDigital_eps-FHIR-validator-lambda

sonar-project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.organization=nhsdigital
2+
sonar.projectKey=NHSDigital_eps-FHIR-validator-lambda
3+
sonar.sources=src/main
4+
sonar.tests=src/test
5+
sonar.java.binaries=target/classes
6+
sonar.java.test.binaries=target/test-classes
7+
8+
sonar.host.url=https://sonarcloud.io
9+
10+
sonar.coverage.exclusions=src/test/**
11+
sonar.cpd.exclusions=src/test/**
12+
13+
sonar.java.coveragePlugin=jacoco
14+
sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml

0 commit comments

Comments
 (0)