Skip to content

Commit ecd00ba

Browse files
Merge remote-tracking branch 'refs/remotes/origin/feature/CCM-12180-TestsOnPipeline' into feature/CCM-13151-PostEndpoint
2 parents 4b1a883 + c232df7 commit ecd00ba

44 files changed

Lines changed: 8771 additions & 8383 deletions

Some content is hidden

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

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ generated_code = true
7070

7171
[/internal/events/**/*.schema.json]
7272
insert_final_newline = unset
73+
74+
[/pact-contracts/pacts/**/*.json]
75+
insert_final_newline = unset

.github/actions/acceptance-tests/action.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,17 @@ runs:
2828
with:
2929
name: terraform-output-${{ inputs.targetComponent }}
3030

31-
- name: "Repo setup"
31+
- name: Get Node version
32+
id: nodejs_version
3233
shell: bash
3334
run: |
34-
npm ci
35+
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
36+
37+
- name: "Repo setup"
38+
uses: ./.github/actions/node-install
39+
with:
40+
node-version: ${{ steps.nodejs_version.outputs.nodejs_version }}
41+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
3542

3643
- name: "Set PR NUMBER"
3744
shell: bash
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'npm install and setup'
2+
description: 'Setup node, authenticate github package repository and perform clean npm install'
3+
4+
inputs:
5+
node-version:
6+
description: 'Node.js version'
7+
required: true
8+
GITHUB_TOKEN:
9+
description: "Token for access to github package registry"
10+
required: true
11+
12+
runs:
13+
using: 'composite'
14+
steps:
15+
- name: 'Use Node.js'
16+
uses: actions/setup-node@v6
17+
with:
18+
node-version: '${{ inputs.node-version }}'
19+
registry-url: 'https://npm.pkg.github.com'
20+
scope: '@nhsdigital'
21+
22+
- name: 'Install dependencies'
23+
shell: bash
24+
env:
25+
NODE_AUTH_TOKEN: ${{ inputs.GITHUB_TOKEN }}
26+
run: |
27+
npm ci

.github/workflows/pr_destroy_dynamic_env.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: PR Destroy Environment
33
on:
44
pull_request:
55
types: [closed]
6+
branches:
7+
- '*'
68

79
concurrency:
810
group: ${{ github.workflow }}-${{ github.ref }}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,16 @@ jobs:
152152
timeout-minutes: 10
153153
needs: detect-terraform-changes
154154
if: needs.detect-terraform-changes.outputs.terraform_changed == 'true'
155+
env:
156+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155157
steps:
156158
- name: "Checkout code"
157159
uses: actions/checkout@v5
160+
- name: Setup NodeJS
161+
uses: actions/setup-node@v4
162+
with:
163+
node-version: ${{ inputs.nodejs_version }}
164+
registry-url: 'https://npm.pkg.github.com'
158165
- name: "Setup ASDF"
159166
uses: asdf-vm/actions/setup@v4
160167
- name: "Perform Setup"

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

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ jobs:
5858
restore-keys: |
5959
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
6060
- name: "Repo setup"
61-
env:
62-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
run: |
64-
npm ci
61+
uses: ./.github/actions/node-install
62+
with:
63+
node-version: ${{ inputs.nodejs_version }}
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6565
- name: "Generate dependencies"
6666
run: |
6767
npm run generate-dependencies --workspaces --if-present
@@ -82,10 +82,10 @@ jobs:
8282
restore-keys: |
8383
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
8484
- name: "Repo setup"
85-
env:
86-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87-
run: |
88-
npm ci
85+
uses: ./.github/actions/node-install
86+
with:
87+
node-version: ${{ inputs.nodejs_version }}
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8989
- name: "Generate dependencies"
9090
run: |
9191
npm run generate-dependencies --workspaces --if-present
@@ -104,6 +104,37 @@ jobs:
104104
with:
105105
name: code-coverage-report
106106
path: ".reports/lcov.info"
107+
test-pact:
108+
name: "Pact tests"
109+
runs-on: ubuntu-latest
110+
timeout-minutes: 5
111+
env:
112+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
permissions:
114+
packages: write
115+
contents: read
116+
steps:
117+
- name: "Checkout code"
118+
uses: actions/checkout@v5
119+
- name: "Cache node_modules"
120+
uses: actions/cache@v4
121+
with:
122+
path: |
123+
**/node_modules
124+
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
125+
restore-keys: |
126+
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
127+
- name: "Repo setup"
128+
uses: ./.github/actions/node-install
129+
with:
130+
node-version: ${{ inputs.nodejs_version }}
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
- name: "Generate dependencies"
133+
run: npm run generate-dependencies --workspaces --if-present
134+
- name: "Run PACT tests"
135+
run: npm run test:pact --workspace tests
136+
- name: Publish Pact Contracts
137+
run: ./scripts/publish-pact-contracts.sh
107138
test-lint:
108139
name: "Linting"
109140
runs-on: ubuntu-latest
@@ -120,10 +151,10 @@ jobs:
120151
restore-keys: |
121152
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
122153
- name: "Repo setup"
123-
env:
124-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125-
run: |
126-
npm ci
154+
uses: ./.github/actions/node-install
155+
with:
156+
node-version: ${{ inputs.nodejs_version }}
157+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127158
- name: "Generate dependencies"
128159
run: |
129160
npm run generate-dependencies --workspaces --if-present
@@ -146,10 +177,10 @@ jobs:
146177
restore-keys: |
147178
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
148179
- name: "Repo setup"
149-
env:
150-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151-
run: |
152-
npm ci
180+
uses: ./.github/actions/node-install
181+
with:
182+
node-version: ${{ inputs.nodejs_version }}
183+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153184
- name: "Generate dependencies"
154185
run: |
155186
npm run generate-dependencies --workspaces --if-present

.github/workflows/stage-4-acceptance.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,19 @@ jobs:
4646
steps:
4747
- uses: actions/checkout@v5.0.0
4848

49+
- name: 'Use Node.js'
50+
uses: actions/setup-node@v6
51+
with:
52+
node-version: '${{ inputs.nodejs_version }}'
53+
registry-url: 'https://npm.pkg.github.com'
54+
scope: '@nhsdigital'
55+
4956
- name: Trigger Acceptance Tests
5057
shell: bash
5158
env:
5259
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
5360
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
61+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5462
run: |
5563
.github/scripts/dispatch_internal_repo_workflow.sh \
5664
--targetWorkflow "dispatch-contextual-tests-dynamic-env.yaml" \

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ dist
3333
/specification/api/components/security/security.yml
3434
/specification/api/components/parameters/authorization/authorization.yml
3535
/scripts/JWT/*.pem
36+
37+
# ignore PACTS
38+
.pacts

.gitleaksignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ d8aaf7e033bf78fff491caa148897be266b60f67:src/src.sln:ipv4:3
1818
e12407e09151898bfd8d049d57eee9db9977d56b:.github/copilot-instructions.md:generic-api-key:213
1919
4ad86108d4e08cd410061e8842dd3a2b3bee4867:scripts/JWT/README.md:generic-api-key:38
2020
504844c9838740c8c5235024919f0775ad817cde:pact-contracts/pacts/letter-rendering/supplier-api-letter-request-prepared.json:generic-api-key:10
21+
82cf3b2e89ea24b97c4ffc09e618700fb1b0aff3:pact-contracts/pacts/letter-rendering/supplier-api-letter-request-prepared.json:generic-api-key:10

infrastructure/terraform/components/api/module_lambda_get_letter.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module "get_letter" {
2525
handler_function_name = "getLetter"
2626
runtime = "nodejs22.x"
2727
memory = 128
28-
timeout = 5
28+
timeout = 29
2929
log_level = var.log_level
3030

3131
force_lambda_code_deploy = var.force_lambda_code_deploy

0 commit comments

Comments
 (0)