Skip to content

Commit b34139a

Browse files
committed
Run E2E tests if proxy deployed
1 parent 7028aa6 commit b34139a

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: E2E tests
2+
description: "Run end-to-end tests for this repo"
3+
4+
inputs:
5+
pr_number:
6+
required: true
7+
type: string
8+
9+
runs:
10+
using: "composite"
11+
12+
steps:
13+
- name: Check if e2e tests should run
14+
id: check_e2e
15+
shell: bash
16+
env:
17+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
18+
run: |
19+
if [[ -n "${{ inputs.pr_number }}" ]]; then
20+
labels=$(gh pr view "${{ inputs.pr_number }}" --json labels --jq '.labels[].name' 2>/dev/null || echo "")
21+
22+
if echo "$labels" | grep -Fxq 'deploy-proxy'; then
23+
echo "deploy-proxy label found; e2e tests will run."
24+
echo "run_e2e=true" >> $GITHUB_OUTPUT
25+
else
26+
echo "deploy-proxy label not found; e2e tests will be skipped."
27+
echo "run_e2e=false" >> $GITHUB_OUTPUT
28+
fi
29+
else
30+
echo "Not a PR environment; e2e tests will run."
31+
echo "run_e2e=true" >> $GITHUB_OUTPUT
32+
fi
33+
34+
- name: Install poetry and e2e test dependencies
35+
if: steps.check_e2e.outputs.run_e2e == 'true'
36+
shell: bash
37+
run: |
38+
pipx install poetry
39+
cd tests/e2e-tests && poetry install
40+
41+
- name: Run e2e tests
42+
if: steps.check_e2e.outputs.run_e2e == 'true'
43+
shell: bash
44+
run: |
45+
echo "$INTERNAL_DEV_TEST_PEM" > "${GITHUB_WORKSPACE}/internal-dev-test-1.pem"
46+
chmod 600 "${GITHUB_WORKSPACE}/internal-dev-test-1.pem"
47+
export PROXY_NAME=nhs-notify-supplier--internal-dev--nhs-notify-supplier
48+
export API_ENVIRONMENT=internal-dev
49+
export NON_PROD_PRIVATE_KEY="${GITHUB_WORKSPACE}/internal-dev-test-1.pem"
50+
make .internal-dev-test

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,18 @@ 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: "Run e2e tests"
88+
uses: ./.github/actions/e2e-tests
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
NON_PROD_API_KEY: ${{ secrets.NON_PROD_API_KEY }}
92+
INTERNAL_DEV_TEST_PEM: ${{ secrets.INTERNAL_DEV_TEST_PEM }}
93+
with:
94+
pr_number: ${{ inputs.pr_number }}

0 commit comments

Comments
 (0)