Skip to content

Commit 7ff30b4

Browse files
authored
VED-808 (Child of VED-720) Refactor quality check pipeline (#843)
1 parent 202f0a3 commit 7ff30b4

File tree

7 files changed

+71
-43
lines changed

7 files changed

+71
-43
lines changed

.github/workflows/continuous-integration.yml renamed to .github/workflows/create-release-tag.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
name: Create Release
2-
on: push
1+
name: Create Release Tag
2+
on:
3+
push:
4+
branches:
5+
- master
36

47
jobs:
58
create_release:
6-
name: build
9+
name: Create Release
710
runs-on: ubuntu-latest
8-
if: github.ref == 'refs/heads/master'
911
steps:
1012
- name: Checkout
1113
uses: actions/checkout@v5
@@ -40,4 +42,4 @@ jobs:
4042
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4143
with:
4244
tag_name: ${{ env.SPEC_VERSION }}
43-
release_name: ${{ env.SPEC_VERSION }}
45+
release_name: ${{ env.SPEC_VERSION }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Create PR JIRA Link
2+
on:
3+
pull_request:
4+
types: [opened]
5+
6+
jobs:
7+
link-ticket:
8+
runs-on: ubuntu-latest
9+
env:
10+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
11+
steps:
12+
- name: Check ticket name conforms to requirements
13+
run: echo $BRANCH_NAME | grep -i -E -q "(ved-[0-9]+)|(dependabot\/)"
14+
continue-on-error: true
15+
16+
- name: Grab ticket name
17+
run: echo "TICKET_NAME=$(echo $BRANCH_NAME | grep -i -o '\(ved-[0-9]\+\)' | tr '[:lower:]' '[:upper:]')" >> $GITHUB_ENV
18+
continue-on-error: true
19+
20+
- name: Comment on PR with link to JIRA ticket
21+
if: contains(env.TICKET_NAME, 'VED-')
22+
continue-on-error: true
23+
uses: unsplash/comment-on-pr@a9bf050e744c8282dee4bb0dbcf063186d8316c4
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
msg: |
28+
This branch is working on a ticket in the NHS England VED JIRA Project. Here's a handy link to the ticket:
29+
# [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME}})

.github/workflows/pr-lint.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: SonarCloud
1+
name: Quality Checks
22

33
on:
44
push:
@@ -12,14 +12,40 @@ env:
1212
LAMBDA_PATH: ${{ github.workspace }}/lambdas
1313

1414
jobs:
15-
sonarcloud:
16-
name: SonarCloud
15+
lint:
16+
name: Lint specification and Python projects
1717
runs-on: ubuntu-latest
1818

1919
steps:
2020
- uses: actions/checkout@v5
21+
22+
- name: Install poetry
23+
run: pip install poetry==2.1.4
24+
25+
# Base linting requires 3.8 due to APIM package dependencies. See root README for details under linting.
26+
# Consider upgrading this and poetry deps if we move away from Azure DevOps to using the Proxygen tool.
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: 3.8
30+
cache: 'poetry'
31+
32+
- uses: actions/setup-node@v5
2133
with:
22-
fetch-depth: 0
34+
node-version: '23.11.0'
35+
cache: 'npm'
36+
37+
- name: Install linting dependencies
38+
run: make install-node && poetry install --no-root
39+
40+
- name: Lint
41+
run: make lint
42+
43+
testcoverage_and_sonarcloud:
44+
name: Test Coverage and SonarCloud
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- uses: actions/checkout@v5
2349

2450
- name: Install poetry
2551
run: pip install poetry==2.1.4
@@ -184,7 +210,7 @@ jobs:
184210
fi
185211
186212
- name: SonarCloud Scan
187-
uses: SonarSource/sonarqube-scan-action@master
213+
uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602
188214
env:
189215
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
190216
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ It is not necessary to activate the virtual environment (using `source .venv/bin
175175
The root-level virtual environment is primarily used for linting, as we create separate virtual environments for each folder that contains Lambda functions.
176176
Steps:
177177
1. Follow instructions above to [install dependencies](#install-dependencies) & [set up a virtual environment](#setting-up-a-virtual-environment-with-poetry).
178-
**Note: While this project uses Python 3.10 (e.g. for Lambdas), the NHSDigital/api-management-utils repository — which orchestrates setup and linting — defaults to Python 3.8.
178+
**Note: While this project uses Python 3.11 (e.g. for Lambdas), the NHSDigital/api-management-utils repository — which orchestrates setup and linting — defaults to Python 3.8.
179179
The linting command is executed from within that repo but calls the Makefile in this project, so be aware of potential Python version mismatches when running or debugging locally or in the pipeline.**
180180
2. Run `make lint`. This will:
181181
- Check the linting of the API specification yaml.

README.specification.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ To get started developing your API use this template repo alongside guidance pro
102102
This folder contains templates that can be customised for items such as opening pull requests or issues within the repo
103103

104104
`/.github/workflows`: This folder contains templates for github action workflows such as:
105-
- `pr-lint.yaml`: This workflow template shows how to link Pull Request's to Jira tickets and runs when a pull request is opened.
106-
- `continuous-integration.yml`: This workflow template shows how to publish a Github release when pushing to master.
105+
- `pr-jira-link.yaml`: This workflow template links Pull Requests to Jira tickets and runs when a pull request is opened.
106+
- `create-release-tag.yml`: This workflow template shows how to publish a Github release when pushing to master.
107107

108108
#### `/azure`:
109109

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[project]
2+
name = "immunisation-fhir-api"
23
python = "^3.8"
34

45
[tool.poetry]

0 commit comments

Comments
 (0)