Skip to content

Commit 67f0b74

Browse files
authored
Build: [AEA-4506] - Add communal Qc. Fix pr-link (#203)
## Summary - 🤖 Operational or Infrastructure Change ### Details Replace the `quality-checks.yml` file in the repo with the communal one shared across all EPS projects
1 parent 3b8f23e commit 67f0b74

File tree

7 files changed

+75
-84
lines changed

7 files changed

+75
-84
lines changed

.gitallowed

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Allow GitHub workflow secrets and tokens
2+
token: ?"?\$\{\{\s*secrets\.GITHUB_TOKEN\s*\}\}"?
3+
github-token: ?"?\$\{\{\s*secrets\.GITHUB_TOKEN\s*\}\}"?
4+
token: ?"?\$\{\{\s*secrets\.DEPENDABOT_TOKEN\s*\}\}"?
5+
id-token: write
6+
--token=\$\{\{\s*steps\.generate-token\.outputs\.token\s*\}\}
7+
--token=\$GITHUB-TOKEN
8+
9+
# Allow CIDR blocks in CloudFormation templates and related files
10+
CidrBlock: "10\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2}"
11+
DestinationCidrBlock: "0\.0\.0\.0/0"
12+
13+
# Java corretto is not a secret
14+
.*java corretto.*
15+
16+
# Allow standard code in JSON files for FHIR compliance testing
17+
"code": "1\.2\.840\.10065\.1\.12\.1\.1"
18+
19+
# Allow IP in X-Forwarded-For header in test files
20+
.*\"X-Forwarded-For\": \"86\.5\.218\.71\".*
21+
22+
# Allow version for AspectJ in pom.xml
23+
<aspectj\.version>1\.9\.22\.1</aspectj\.version>
24+
25+
^.*pom\.xml:.*<version>([^<]+)</version>.*$
26+
^.*Gemfile\.lock:.*$
27+
^.*\.java:.*\\"id\\":\\"([0-9a-f\-]+)\\".*$
28+
29+
# General ones
30+
.*\.gitallowed.*
31+
.*nhsd-rules-deny.txt.*
32+
.*\.venv.*
33+
.*node_modules.*

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ env:
99

1010
jobs:
1111
quality_checks:
12-
uses: ./.github/workflows/quality_checks.yml
12+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/quality-checks.yml@v4.0.0
1313
secrets:
1414
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
15+
with:
16+
install_java: true
1517

1618
get_commit_id:
1719
runs-on: ubuntu-latest

.github/workflows/pr-link.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,25 @@ jobs:
1414

1515
- name: Grab ticket name
1616
if: contains(github.event.pull_request.head.ref, 'aea-') || contains(github.event.pull_request.head.ref, 'AEA-') || contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-') || contains(github.event.pull_request.head.ref, 'amb-') || contains(github.event.pull_request.head.ref, 'AMB-')
17-
run: echo name=TICKET_NAME::"$(echo "$REF" | grep -i -o '\(aea-[0-9]\+\)\|\(apm-[0-9]\+\)\|\(apmspii-[0-9]\+\)\|\(adz-[0-9]\+\)|\(amb-[0-9]\+\)' | tr '[:lower:]' '[:upper:]')" >> "$GITHUB_ENV"
1817
continue-on-error: true
19-
env:
20-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
18+
run: |
19+
# Match ticket name patterns
20+
REGEX='
21+
(aea-[0-9]+)|
22+
(apm-[0-9]+)|
23+
(apmspii-[0-9]+)|
24+
(adz-[0-9]+)|
25+
(amb-[0-9]+)
26+
'
27+
28+
# Remove whitespace and newlines from the regex
29+
REGEX=$(echo "$REGEX" | tr -d '[:space:]')
30+
31+
# Extract the ticket name and convert to uppercase
32+
TICKET_NAME=$(echo "$REF" | grep -i -E -o "$REGEX" | tr '[:lower:]' '[:upper:]')
33+
34+
# Set the environment variable
35+
echo "TICKET_NAME=$TICKET_NAME" >> "$GITHUB_ENV"
2136
2237
- name: Comment on PR with link to JIRA ticket
2338
if: contains(github.event.pull_request.head.ref, 'aea-') || contains(github.event.pull_request.head.ref, 'AEA-') || contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-') || contains(github.event.pull_request.head.ref, 'amb-') || contains(github.event.pull_request.head.ref, 'AMB-')
@@ -27,5 +42,5 @@ jobs:
2742
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2843
with:
2944
msg: |
30-
This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:
45+
This branch is work on a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket:
3146
# [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME }})

.github/workflows/pull_request.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ env:
99

1010
jobs:
1111
quality_checks:
12-
uses: ./.github/workflows/quality_checks.yml
12+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/quality-checks.yml@v4.0.0
1313
secrets:
1414
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
15+
with:
16+
install_java: true
1517

1618
pr_title_format_check:
1719
uses: ./.github/workflows/pr_title_check.yml

.github/workflows/quality_checks.yml

Lines changed: 0 additions & 77 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ env:
88

99
jobs:
1010
quality_checks:
11-
uses: ./.github/workflows/quality_checks.yml
11+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/quality-checks.yml@v4.0.0
1212
secrets:
1313
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
14+
with:
15+
install_java: true
1416

1517
get_commit_id:
1618
runs-on: ubuntu-latest

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)