Skip to content

Commit 083b0d6

Browse files
committed
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-template-management into feature/CCM-11148_create-message-plan-screen
2 parents 82dcd59 + d7a5885 commit 083b0d6

File tree

239 files changed

+12481
-3245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+12481
-3245
lines changed

.github/workflows/cicd-1-pull-request.yaml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
1212
cancel-in-progress: false
1313

14+
permissions:
15+
id-token: write
16+
contents: write
17+
packages: read
1418

1519
jobs:
1620
metadata:
@@ -77,9 +81,23 @@ jobs:
7781
export DOES_PULL_REQUEST_EXIST="${{ steps.pr_exists.outputs.does_pull_request_exist }}"
7882
export IS_VERSION_PRERELEASE="${{ steps.variables.outputs.is_version_prerelease }}"
7983
make list-variables
84+
85+
dependencies:
86+
name: Install / cache dependencies
87+
needs: [metadata]
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: "Checkout code"
91+
uses: actions/checkout@v5.0.0
92+
- name: "Install / cache node_modules"
93+
uses: ./.github/actions/node-modules-cache
94+
with:
95+
node_version: "${{ inputs.nodejs_version }}"
96+
skip_restore: true
97+
8098
commit-stage: # Recommended maximum execution time is 2 minutes
8199
name: "Commit stage"
82-
needs: [metadata]
100+
needs: [metadata, dependencies]
83101
uses: ./.github/workflows/stage-1-commit.yaml
84102
with:
85103
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
@@ -92,7 +110,7 @@ jobs:
92110
secrets: inherit
93111
test-stage: # Recommended maximum execution time is 5 minutes
94112
name: "Test stage"
95-
needs: [metadata, commit-stage]
113+
needs: [metadata, dependencies, commit-stage]
96114
uses: ./.github/workflows/stage-2-test.yaml
97115
with:
98116
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
@@ -105,7 +123,7 @@ jobs:
105123
secrets: inherit
106124
acceptance-stage: # Recommended maximum execution time is 10 minutes
107125
name: "Acceptance stage"
108-
needs: [metadata, test-stage]
126+
needs: [metadata, dependencies, test-stage]
109127
uses: ./.github/workflows/stage-4-acceptance.yaml
110128
if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')) || (github.event_name == 'push' && github.ref == 'refs/heads/main')
111129
secrets: inherit

.github/workflows/pr_closed.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,29 @@ jobs:
9999
echo "version_changed=true" >> $GITHUB_OUTPUT
100100
fi
101101
102+
test-contract-provider:
103+
name: "Test contracts (provider)"
104+
needs: check-event-schemas-version-change
105+
if: needs.check-event-schemas-version-change.outputs.version_changed == 'true'
106+
runs-on: ubuntu-latest
107+
permissions:
108+
contents: read
109+
packages: read
110+
steps:
111+
- name: "Checkout code"
112+
uses: actions/checkout@v5.0.0
113+
- name: "Install dependencies"
114+
run: npm ci
115+
- name: "Run provider contract tests"
116+
run: make test-contract-provider
117+
env:
118+
GITHUB_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
102120
publish-event-schemas:
103121
name: Publish event schemas package to GitHub package registry
104-
needs: check-event-schemas-version-change
122+
needs:
123+
- check-event-schemas-version-change
124+
- test-contract-provider
105125
if: needs.check-event-schemas-version-change.outputs.version_changed == 'true'
106126
runs-on: ubuntu-latest
107127
permissions:

.github/workflows/stage-1-commit.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
needs: detect-terraform-changes
7373
if: needs.detect-terraform-changes.outputs.terraform_changed == 'true'
7474
permissions:
75-
contents: write
75+
contents: write
7676
steps:
7777
- name: "Checkout code"
7878
uses: actions/checkout@v5.0.0
@@ -149,7 +149,7 @@ jobs:
149149
trivy:
150150
name: "Trivy Scan"
151151
runs-on: ubuntu-latest
152-
timeout-minutes: 5
152+
timeout-minutes: 10
153153
needs: detect-terraform-changes
154154
if: needs.detect-terraform-changes.outputs.terraform_changed == 'true'
155155
steps:
@@ -248,8 +248,10 @@ jobs:
248248
- name: "Checkout code"
249249
uses: actions/checkout@v4
250250

251-
- name: Install dependencies
252-
run: npm ci
251+
- name: "Restore node_modules from cache"
252+
uses: ./.github/actions/node-modules-cache
253+
with:
254+
node_version: "${{ inputs.nodejs_version }}"
253255

254256
- name: Re-generate schemas
255257
run: npm --workspace packages/event-schemas run generate-json-schemas

.github/workflows/stage-2-test.yaml

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,6 @@ permissions:
4141
contents: read # This is required for actions/checkout
4242

4343
jobs:
44-
install-dependencies:
45-
name: "Install dependencies"
46-
runs-on: ubuntu-latest
47-
timeout-minutes: 5
48-
steps:
49-
- name: "Checkout code"
50-
uses: actions/checkout@v5.0.0
51-
- name: "Restore node_modules from cache"
52-
uses: ./.github/actions/node-modules-cache
53-
with:
54-
node_version: "${{ inputs.nodejs_version }}"
55-
skip_restore: true
56-
5744
discover-workspaces:
5845
runs-on: ubuntu-latest
5946
outputs:
@@ -70,7 +57,6 @@ jobs:
7057
name: "Check generated dependencies"
7158
runs-on: ubuntu-latest
7259
timeout-minutes: 5
73-
needs: [install-dependencies]
7460
steps:
7561
- name: "Checkout code"
7662
uses: actions/checkout@v5.0.0
@@ -87,7 +73,7 @@ jobs:
8773
name: "Unit tests"
8874
runs-on: ubuntu-latest
8975
timeout-minutes: 5
90-
needs: [install-dependencies, discover-workspaces]
76+
needs: [discover-workspaces]
9177
strategy:
9278
fail-fast: false
9379
matrix:
@@ -130,7 +116,6 @@ jobs:
130116
name: "Linting"
131117
runs-on: ubuntu-latest
132118
timeout-minutes: 5
133-
needs: [install-dependencies]
134119
steps:
135120
- name: "Checkout code"
136121
uses: actions/checkout@v5.0.0
@@ -149,7 +134,6 @@ jobs:
149134
name: "Typecheck"
150135
runs-on: ubuntu-latest
151136
timeout-minutes: 5
152-
needs: [install-dependencies]
153137
steps:
154138
- name: "Checkout code"
155139
uses: actions/checkout@v5.0.0
@@ -164,6 +148,25 @@ jobs:
164148
run: |
165149
make test-typecheck
166150
151+
test-contract-provider:
152+
name: "Test contracts (provider)"
153+
runs-on: ubuntu-latest
154+
permissions:
155+
contents: read
156+
packages: read
157+
steps:
158+
- name: "Checkout code"
159+
uses: actions/checkout@v5.0.0
160+
- name: "Restore node_modules from cache"
161+
uses: ./.github/actions/node-modules-cache
162+
with:
163+
node_version: "${{ inputs.nodejs_version }}"
164+
- name: "Run provider contract tests"
165+
run: make test-contract-provider
166+
env:
167+
GITHUB_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168+
169+
167170
merge-coverage:
168171
name: "Merge coverage"
169172
runs-on: ubuntu-latest
@@ -195,26 +198,26 @@ jobs:
195198
name: code-coverage-report
196199
path: .reports/lcov.info
197200

198-
perform-static-analysis:
199-
name: "Perform static analysis"
200-
needs: [test-unit, merge-coverage]
201-
runs-on: ubuntu-latest
202-
permissions:
203-
id-token: write
204-
contents: read
205-
timeout-minutes: 5
206-
steps:
207-
- name: "Checkout code"
208-
uses: actions/checkout@v5.0.0
209-
with:
210-
fetch-depth: 0 # Full history is needed to improving relevancy of reporting
211-
- name: "Download coverage report for SONAR"
212-
uses: actions/download-artifact@v5
213-
with:
214-
name: code-coverage-report
215-
- name: "Perform static analysis"
216-
uses: ./.github/actions/perform-static-analysis
217-
with:
218-
sonar_organisation_key: "${{ vars.SONAR_ORGANISATION_KEY }}"
219-
sonar_project_key: "${{ vars.SONAR_PROJECT_KEY }}"
220-
sonar_token: "${{ secrets.SONAR_TOKEN }}"
201+
# perform-static-analysis:
202+
# name: "Perform static analysis"
203+
# needs: [test-unit, merge-coverage]
204+
# runs-on: ubuntu-latest
205+
# permissions:
206+
# id-token: write
207+
# contents: read
208+
# timeout-minutes: 5
209+
# steps:
210+
# - name: "Checkout code"
211+
# uses: actions/checkout@v5.0.0
212+
# with:
213+
# fetch-depth: 0 # Full history is needed to improving relevancy of reporting
214+
# - name: "Download coverage report for SONAR"
215+
# uses: actions/download-artifact@v5
216+
# with:
217+
# name: code-coverage-report
218+
# - name: "Perform static analysis"
219+
# uses: ./.github/actions/perform-static-analysis
220+
# with:
221+
# sonar_organisation_key: "${{ vars.SONAR_ORGANISATION_KEY }}"
222+
# sonar_project_key: "${{ vars.SONAR_PROJECT_KEY }}"
223+
# sonar_token: "${{ secrets.SONAR_TOKEN }}"

.gitleaksignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ b19d88d1d92b0530f065feefcf25d8cdd82a876a:tests/test-team/auth/user.json:jwt:15
77
b19d88d1d92b0530f065feefcf25d8cdd82a876a:tests/test-team/auth/user.json:jwt:25
88
bc79df4f82052918ae6bf69d36279e5dd391d61e:tests/test-team/auth/user.json:jwt:15
99
bc79df4f82052918ae6bf69d36279e5dd391d61e:tests/test-team/auth/user.json:jwt:25
10+
306d9ec55d3498b86d5506da9a90ac486fc66563:frontend/src/components/molecules/MessagePlanFallbackConditions/MessagePlanFallbackConditions.tsx:ipv4:92

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terraform 1.10.1
77
terraform-docs 0.19.0
88
trivy 0.61.0
99
vale 3.6.0
10-
# python 3.13.2
10+
python 3.13.2
1111

1212
# ==============================================================================
1313
# The section below is reserved for Docker image versions.

frontend/src/__tests__/app/preview-email-template/page.test.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@ import {
1616
SMS_TEMPLATE,
1717
} from '../../helpers';
1818
import content from '@content/content';
19+
import { serverIsFeatureEnabled } from '@utils/server-features';
1920

2021
const { pageTitle } = content.components.previewEmailTemplate;
2122

2223
jest.mock('@utils/form-actions');
2324
jest.mock('next/navigation');
2425
jest.mock('@forms/PreviewEmailTemplate');
26+
jest.mock('@utils/server-features');
2527

2628
const redirectMock = jest.mocked(redirect);
2729
const getTemplateMock = jest.mocked(getTemplate);
30+
const serverIsFeatureEnabledMock = jest.mocked(serverIsFeatureEnabled);
2831

2932
describe('PreviewEmailTemplatePage', () => {
30-
beforeEach(jest.resetAllMocks);
33+
beforeEach(() => {
34+
jest.resetAllMocks();
35+
serverIsFeatureEnabledMock.mockResolvedValueOnce(true);
36+
});
3137

3238
it('should load page', async () => {
3339
const templateDTO = {
@@ -59,7 +65,12 @@ describe('PreviewEmailTemplatePage', () => {
5965
expect(await generateMetadata()).toEqual({
6066
title: pageTitle,
6167
});
62-
expect(page).toEqual(<PreviewEmailTemplate initialState={emailTemplate} />);
68+
expect(page).toEqual(
69+
<PreviewEmailTemplate
70+
initialState={emailTemplate}
71+
routingEnabled={true}
72+
/>
73+
);
6374
});
6475

6576
it('should redirect to invalid-template when no templateId is found', async () => {

frontend/src/__tests__/app/preview-nhs-app-template/page.test.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@ import {
1616
SMS_TEMPLATE,
1717
} from '../../helpers';
1818
import content from '@content/content';
19+
import { serverIsFeatureEnabled } from '@utils/server-features';
1920

2021
const { pageTitle } = content.components.previewNHSAppTemplate;
2122

2223
jest.mock('@utils/form-actions');
2324
jest.mock('next/navigation');
2425
jest.mock('@forms/PreviewNHSAppTemplate/PreviewNHSAppTemplate');
26+
jest.mock('@utils/server-features');
2527

2628
const redirectMock = jest.mocked(redirect);
2729
const getTemplateMock = jest.mocked(getTemplate);
30+
const serverIsFeatureEnabledMock = jest.mocked(serverIsFeatureEnabled);
2831

2932
describe('PreviewNhsAppTemplatePage', () => {
30-
beforeEach(jest.resetAllMocks);
33+
beforeEach(() => {
34+
jest.resetAllMocks();
35+
serverIsFeatureEnabledMock.mockResolvedValueOnce(true);
36+
});
3137

3238
it('should load page', async () => {
3339
const templateDTO = {
@@ -58,7 +64,10 @@ describe('PreviewNhsAppTemplatePage', () => {
5864
title: pageTitle,
5965
});
6066
expect(page).toEqual(
61-
<PreviewNHSAppTemplate initialState={nhsAppTemplate} />
67+
<PreviewNHSAppTemplate
68+
initialState={nhsAppTemplate}
69+
routingEnabled={true}
70+
/>
6271
);
6372
});
6473

frontend/src/__tests__/app/preview-text-message-template/page.test.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@ import {
1616
SMS_TEMPLATE,
1717
} from '../../helpers';
1818
import content from '@content/content';
19+
import { serverIsFeatureEnabled } from '@utils/server-features';
1920

2021
const { pageTitle } = content.components.previewSMSTemplate;
2122

2223
jest.mock('@utils/form-actions');
2324
jest.mock('next/navigation');
2425
jest.mock('@forms/PreviewSMSTemplate');
26+
jest.mock('@utils/server-features');
2527

2628
const redirectMock = jest.mocked(redirect);
2729
const getTemplateMock = jest.mocked(getTemplate);
30+
const serverIsFeatureEnabledMock = jest.mocked(serverIsFeatureEnabled);
2831

2932
describe('PreviewSMSTemplatePage', () => {
30-
beforeEach(jest.resetAllMocks);
33+
beforeEach(() => {
34+
jest.resetAllMocks();
35+
serverIsFeatureEnabledMock.mockResolvedValueOnce(true);
36+
});
3137

3238
it('should load page', async () => {
3339
const templateDTO = {
@@ -57,7 +63,9 @@ describe('PreviewSMSTemplatePage', () => {
5763
expect(await generateMetadata()).toEqual({
5864
title: pageTitle,
5965
});
60-
expect(page).toEqual(<PreviewSMSTemplate initialState={smsTemplate} />);
66+
expect(page).toEqual(
67+
<PreviewSMSTemplate initialState={smsTemplate} routingEnabled={true} />
68+
);
6169
});
6270

6371
it('should redirect to invalid-template when no template is found', async () => {

0 commit comments

Comments
 (0)