Skip to content

Commit c3bde6b

Browse files
restore changes
1 parent 577b851 commit c3bde6b

224 files changed

Lines changed: 16634 additions & 14794 deletions

File tree

Some content is hidden

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

.env.template

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
ENVIRONMENT=$ENV_NAME
2-
API_KEY=
3-
HEADERAUTH=
41
PR_NUMBER=prxx # remove if needs to run against main
5-
NHSD_APIM_TOKEN=
6-
PROXY_NAME=
2+
GITHUB_TOKEN= # Your github Personal Access Token (PAT)
3+
4+
5+
# The variables below are used for End to End tests
6+
PROXY_NAME= # information about the proxy name can be found in the tests/e2e-tests/README.md
7+
8+
9+
710
# * nhs-notify-supplier--internal-dev--nhs-notify-supplier
811
# * nhs-notify-supplier--internal-dev--nhs-notify-supplier-PR-XX
912
# * nhs-notify-supplier--ref--nhs-notify-supplier -- ref env
@@ -18,6 +21,7 @@ PROXY_NAME=
1821
export NON_PROD_API_KEY=xxx
1922
export INTEGRATION_API_KEY=xxx
2023
export PRODUCTION_API_KEY=xxx
24+
export STATUS_ENDPOINT_API_KEY=xxx
2125

2226
# Private Keys
2327
# ============
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Acceptance tests - component
2+
description: "Run component acceptance tests for this repo"
3+
4+
inputs:
5+
testType:
6+
description: Type of test to run
7+
required: true
8+
9+
targetEnvironment:
10+
description: Name of the environment under test
11+
required: true
12+
13+
targetComponent:
14+
description: Name of the component under test
15+
required: true
16+
17+
runs:
18+
using: "composite"
19+
20+
steps:
21+
22+
- name: Repo setup
23+
uses: ./.github/actions/node-install
24+
with:
25+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
26+
27+
- name: Fetch terraform output
28+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
29+
with:
30+
name: terraform-output-${{ inputs.targetComponent }}
31+
32+
- name: Get Node version
33+
id: nodejs_version
34+
shell: bash
35+
run: |
36+
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
37+
38+
- name: Run test - ${{ inputs.testType }}
39+
shell: bash
40+
env:
41+
TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }}
42+
run: |
43+
make test-${{ inputs.testType }}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Acceptance tests - e2e
2+
description: "Run e2e acceptance tests for this repo"
3+
4+
inputs:
5+
targetEnvironment:
6+
description: Name of the environment under test
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
12+
steps:
13+
- name: "Set PR NUMBER"
14+
id: set_pr_number
15+
shell: bash
16+
run: |
17+
env="${{ inputs.targetEnvironment }}"
18+
if [[ "$env" == main ]]; then
19+
echo "pr_number=" >> $GITHUB_OUTPUT
20+
elif [[ "$env" == pr* ]]; then
21+
echo "pr_number=${env#pr}" >> $GITHUB_OUTPUT
22+
else
23+
echo "pr_number=$env" >> $GITHUB_OUTPUT
24+
fi
25+
26+
- name: Determine if proxy has been deployed
27+
id: check_proxy_deployed
28+
env:
29+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
30+
PR_NUMBER: ${{ steps.set_pr_number.outputs.pr_number }}
31+
shell: bash
32+
run: |
33+
if [[ -z "$PR_NUMBER" ]]; then
34+
echo "No pull request detected; proxy was deployed."
35+
echo "proxy_deployed=true" >> $GITHUB_OUTPUT
36+
exit 0
37+
fi
38+
39+
branch_name=${GITHUB_HEAD_REF:-$(echo $GITHUB_REF | sed 's#refs/heads/##')}
40+
41+
labels=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name')
42+
echo "Labels on PR #$PR_NUMBER: $labels"
43+
44+
if echo "$labels" | grep -Fxq 'deploy-proxy'; then
45+
echo "proxy_deployed=true" >> $GITHUB_OUTPUT
46+
else
47+
echo "proxy_deployed=false" >> $GITHUB_OUTPUT
48+
fi
49+
50+
- name: Repo setup
51+
if: ${{ steps.check_proxy_deployed.outputs.proxy_deployed == 'true' }}
52+
uses: ./.github/actions/node-install
53+
with:
54+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
55+
56+
- name: Install poetry and e2e test dependencies
57+
shell: bash
58+
run: |
59+
pipx install poetry
60+
cd tests/e2e-tests && poetry install
61+
62+
- name: Run tests
63+
if: ${{ steps.check_proxy_deployed.outputs.proxy_deployed == 'true' }}
64+
shell: bash
65+
env:
66+
TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }}
67+
PR_NUMBER: ${{ steps.set_pr_number.outputs.pr_number }}
68+
run: |
69+
echo "$DEV_E2E_KEYS_PRIVATE" > "${GITHUB_WORKSPACE}/internal-dev-test-1.pem"
70+
chmod 600 "${GITHUB_WORKSPACE}/internal-dev-test-1.pem"
71+
BASE_PROXY_NAME=nhs-notify-supplier--internal-dev--nhs-notify-supplier
72+
73+
export API_ENVIRONMENT=internal-dev
74+
if [[ -z "$PR_NUMBER" ]]; then
75+
export PROXY_NAME="${BASE_PROXY_NAME}"
76+
export NON_PROD_API_KEY="${DEV_E2E_KEYS_APIM_MAIN}"
77+
else
78+
export PROXY_NAME="${BASE_PROXY_NAME}-PR-${PR_NUMBER}"
79+
export NON_PROD_API_KEY="${DEV_E2E_KEYS_APIM_PR}"
80+
fi
81+
82+
export STATUS_ENDPOINT_API_KEY="${DEV_E2E_KEYS_APIM_STATUS}"
83+
export NON_PROD_PRIVATE_KEY="${GITHUB_WORKSPACE}/internal-dev-test-1.pem"
84+
make .internal-dev-test

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

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,17 @@ runs:
2323
using: "composite"
2424

2525
steps:
26-
- name: Fetch terraform output
27-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
28-
with:
29-
name: terraform-output-${{ inputs.targetComponent }}
30-
31-
- name: Get Node version
32-
id: nodejs_version
33-
shell: bash
34-
run: |
35-
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
3626

37-
- name: "Repo setup"
38-
uses: ./.github/actions/node-install
27+
- name: Run component tests
28+
if: ${{ inputs.testType != 'e2e' }}
29+
uses: ./.github/actions/acceptance-tests-component
3930
with:
40-
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
31+
testType: ${{ inputs.testType }}
32+
targetEnvironment: ${{ inputs.targetEnvironment }}
33+
targetComponent: ${{ inputs.targetComponent }}
4134

42-
- name: "Set PR NUMBER"
43-
shell: bash
44-
run: |
45-
echo "PR_NUMBER=${{ inputs.targetEnvironment }}" >> $GITHUB_ENV
46-
47-
- name: Run test - ${{ inputs.testType }}
48-
shell: bash
49-
run: |
50-
make test-${{ inputs.testType }}
35+
- name: Run e2e tests
36+
if: ${{ inputs.testType == 'e2e' && inputs.targetEnvironment == 'main' }}
37+
uses: ./.github/actions/acceptance-tests-e2e
38+
with:
39+
targetEnvironment: ${{ inputs.targetEnvironment }}

.github/actions/build-docs/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
using: "composite"
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1515
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1616
with:
1717
node-version: 22

.github/actions/build-libraries/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
using: "composite"
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1515
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1616
with:
1717
node-version: 22

.github/actions/build-oas-spec/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424

2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2828
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
2929
with:
3030
node-version: ${{ inputs.nodejs_version }}

.github/actions/build-sandbox/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ runs:
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
16+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1717
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1818
with:
1919
node-version: 22

.github/actions/build-sdk/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
using: "composite"
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1515
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1616
with:
1717
node-version: 22

.github/actions/build-server/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
using: "composite"
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1515
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1616
with:
1717
node-version: 22

0 commit comments

Comments
 (0)