|
44 | 44 | run: | |
45 | 45 | echo "PR_NUMBER=${{ inputs.targetEnvironment }}" >> $GITHUB_ENV |
46 | 46 |
|
47 | | - - name: Run component tests |
48 | | - if: inputs.testType == 'component' |
| 47 | + - name: Run test - ${{ inputs.testType }} |
49 | 48 | shell: bash |
50 | 49 | 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 }} |
0 commit comments