Skip to content

Commit a4672be

Browse files
committed
Don't run e2e tests via internal workflow
1 parent a7ac008 commit a4672be

4 files changed

Lines changed: 91 additions & 49 deletions

File tree

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

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -44,53 +44,7 @@ runs:
4444
run: |
4545
echo "PR_NUMBER=${{ inputs.targetEnvironment }}" >> $GITHUB_ENV
4646
47-
- name: Run component tests
48-
if: inputs.testType == 'component'
47+
- name: Run test - ${{ inputs.testType }}
4948
shell: bash
5049
run: |
51-
make test-component
52-
53-
- name: Check if e2e tests should run
54-
if: inputs.testType == 'e2e'
55-
id: check_e2e
56-
shell: bash
57-
env:
58-
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
59-
run: |
60-
# Extract PR number from environment name (e.g., pr123 -> 123)
61-
if [[ "${{ inputs.targetEnvironment }}" =~ ^pr([0-9]+)$ ]]; then
62-
pr_number="${BASH_REMATCH[1]}"
63-
labels=$(gh pr view "$pr_number" --json labels --jq '.labels[].name' 2>/dev/null || echo "")
64-
65-
if echo "$labels" | grep -Fxq 'deploy-proxy'; then
66-
echo "deploy-proxy label found; e2e tests will run."
67-
echo "run_e2e=true" >> $GITHUB_OUTPUT
68-
else
69-
echo "deploy-proxy label not found; e2e tests will be skipped."
70-
echo "run_e2e=false" >> $GITHUB_OUTPUT
71-
fi
72-
else
73-
echo "Not a PR environment; e2e tests will run."
74-
echo "run_e2e=true" >> $GITHUB_OUTPUT
75-
fi
76-
77-
- name: Install poetry and e2e test dependencies
78-
if: inputs.testType == 'e2e' && steps.check_e2e.outputs.run_e2e == 'true'
79-
shell: bash
80-
run: |
81-
pipx install poetry
82-
cd tests/e2e-tests && poetry install
83-
84-
- name: Run e2e tests
85-
if: inputs.testType == 'e2e' && steps.check_e2e.outputs.run_e2e == 'true'
86-
shell: bash
87-
env:
88-
NON_PROD_API_KEY: ${{ secrets.NON_PROD_API_KEY }}
89-
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
90-
run: |
91-
echo "$APP_PEM_FILE" > internal-dev-test-1.pem
92-
chmod 600 internal-dev-test-1.pem
93-
export PROXY_NAME=nhs-notify-supplier--internal-dev--nhs-notify-supplier
94-
export API_ENVIRONMENT=internal-dev
95-
export NON_PROD_PRIVATE_KEY=internal-dev-test-1.pem
96-
make .internal-dev-test
50+
make test-${{ inputs.testType }}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Acceptance tests
2+
description: "Run acceptance tests for this repo"
3+
4+
inputs:
5+
6+
targetEnvironment:
7+
description: Name of the environment under test
8+
required: true
9+
10+
runs:
11+
using: "composite"
12+
13+
steps:
14+
15+
- name: "Repo setup"
16+
uses: ./.github/actions/node-install
17+
with:
18+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
19+
20+
- name: "Set PR NUMBER"
21+
shell: bash
22+
run: |
23+
echo "PR_NUMBER=${{ inputs.targetEnvironment }}" >> $GITHUB_ENV
24+
25+
- name: Check if e2e tests should run
26+
id: check_e2e
27+
shell: bash
28+
env:
29+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
30+
run: |
31+
# Extract PR number from environment name (e.g., pr123 -> 123)
32+
if [[ "${{ inputs.targetEnvironment }}" =~ ^pr([0-9]+)$ ]]; then
33+
pr_number="${BASH_REMATCH[1]}"
34+
labels=$(gh pr view "$pr_number" --json labels --jq '.labels[].name' 2>/dev/null || echo "")
35+
36+
if echo "$labels" | grep -Fxq 'deploy-proxy'; then
37+
echo "deploy-proxy label found; e2e tests will run."
38+
echo "run_e2e=true" >> $GITHUB_OUTPUT
39+
else
40+
echo "deploy-proxy label not found; e2e tests will be skipped."
41+
echo "run_e2e=false" >> $GITHUB_OUTPUT
42+
fi
43+
else
44+
echo "Not a PR environment; e2e tests will run."
45+
echo "run_e2e=true" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Install poetry and e2e test dependencies
49+
if: steps.check_e2e.outputs.run_e2e == 'true'
50+
shell: bash
51+
run: |
52+
pipx install poetry
53+
cd tests/e2e-tests && poetry install
54+
55+
- name: Run e2e tests
56+
if: steps.check_e2e.outputs.run_e2e == 'true'
57+
shell: bash
58+
run: |
59+
echo "$APP_PEM_FILE" > internal-dev-test-1.pem
60+
chmod 600 internal-dev-test-1.pem
61+
export PROXY_NAME=nhs-notify-supplier--internal-dev--nhs-notify-supplier
62+
export API_ENVIRONMENT=internal-dev
63+
export NON_PROD_PRIVATE_KEY=internal-dev-test-1.pem
64+
make .internal-dev-test

.github/actions/test-types.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[
2-
"e2e"
2+
"component"
33
]

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,27 @@ jobs:
7777
--targetEnvironment "$ENVIRONMENT" \
7878
--targetAccountGroup "nhs-notify-supplier-api-dev" \
7979
--targetComponent "api"
80+
81+
run-e2e-tests:
82+
name: Run End-to-End Tests
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v5.0.0
86+
87+
- name: "Set environment"
88+
shell: bash
89+
run: |
90+
if [ "${{ inputs.pr_number }}" != "" ]; then
91+
echo "ENVIRONMENT=pr${{ inputs.pr_number }}" >> $GITHUB_ENV
92+
else
93+
echo "ENVIRONMENT=main" >> $GITHUB_ENV
94+
fi
95+
96+
- name: "Run e2e tests"
97+
uses: ./.github/actions/e2e-tests
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
NON_PROD_API_KEY: ${{ secrets.NON_PROD_API_KEY }}
101+
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
102+
with:
103+
targetEnvironment: ${{ env.ENVIRONMENT }}

0 commit comments

Comments
 (0)