Skip to content

Commit b7b1417

Browse files
committed
try to parallelize workflow
1 parent a021c54 commit b7b1417

File tree

3 files changed

+125
-1
lines changed

3 files changed

+125
-1
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: prototype tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
device:
7+
description: 'Device to test (exact name)'
8+
required: false
9+
default: 'Desktop Chrome'
10+
programmes:
11+
description: 'Programmes to use (HPV, MENACWY, TD_IPV, FLU)'
12+
required: false
13+
default: 'HPV,MENACWY,TD_IPV,FLU'
14+
environment:
15+
description: 'Environment to run tests on (qa, test, training)'
16+
required: false
17+
default: 'qa'
18+
set_feature_flags:
19+
description: 'Enable feature flags to be changed in the flipper page (true/false)'
20+
required: false
21+
default: 'false'
22+
additional_feature_flags:
23+
description: '(If enabled above) Additional feature flags to set. api, basic_auth, dev_tools will be set by default'
24+
required: false
25+
default: ''
26+
pull_request:
27+
28+
jobs:
29+
test:
30+
name: prototype tests
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
partition: [0, 1, 2, 3]
35+
fail-fast: false
36+
37+
permissions:
38+
contents: write
39+
40+
env:
41+
TZ: "Europe/London"
42+
43+
steps:
44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v6
46+
47+
- name: Install Playwright
48+
run: uv run playwright install --with-deps
49+
shell: bash
50+
51+
- name: Install Node.js
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: '20'
55+
56+
- name: Set variables
57+
id: set-variables
58+
run: |
59+
declare -A env_map=(
60+
[qa]="https://qa.mavistesting.com"
61+
[test]="https://test.mavistesting.com"
62+
[training]="https://training.manage-vaccinations-in-schools.nhs.uk"
63+
)
64+
if [ "${{ github.event_name }}" = "pull_request" ]; then
65+
echo "device=Desktop Chrome" >> $GITHUB_OUTPUT
66+
echo "environment=${env_map[qa]}" >> $GITHUB_OUTPUT
67+
echo "programmes=HPV,MENACWY,TD_IPV,FLU" >> $GITHUB_OUTPUT
68+
echo "set_feature_flags=false" >> $GITHUB_OUTPUT
69+
echo "additional_feature_flags=" >> $GITHUB_OUTPUT
70+
echo "deploy_report=false" >> $GITHUB_OUTPUT
71+
else
72+
echo "device=${{ github.event.inputs.device }}" >> $GITHUB_OUTPUT
73+
74+
input_env="${{ github.event.inputs.environment }}"
75+
url="${env_map[$input_env]:-${env_map[qa]}}"
76+
echo "environment=$url" >> $GITHUB_OUTPUT
77+
78+
echo "programmes=${{ github.event.inputs.programmes }}" >> $GITHUB_OUTPUT
79+
echo "set_feature_flags=${{ github.event.inputs.set_feature_flags }}" >> $GITHUB_OUTPUT
80+
echo "additional_feature_flags=${{ github.event.inputs.additional_feature_flags }}" >> $GITHUB_OUTPUT
81+
echo "deploy_report=true" >> $GITHUB_OUTPUT
82+
fi
83+
84+
- uses: actions/checkout@v4
85+
86+
- name: Run tests
87+
run: |
88+
uv run pytest tests/ \
89+
--splits 4 --group ${{ matrix.partition }} \ # Split into groups
90+
with:
91+
device: ${{ steps.set-variables.outputs.device }}
92+
base_url: ${{ steps.set-variables.outputs.environment }}
93+
programmes_enabled: ${{ steps.set-variables.outputs.programmes }}
94+
set_feature_flags: ${{ steps.set-variables.outputs.set_feature_flags }}
95+
additional_feature_flags: ${{ steps.set-variables.outputs.additional_feature_flags }}
96+
env:
97+
BASIC_AUTH_TOKEN: ${{ secrets.HTTP_AUTH_TOKEN_FOR_TESTS }}
98+
IMMS_BASE_URL: ${{ vars.IMMS_BASE_URL }}
99+
IMMS_API_KEY: ${{ secrets.IMMS_API_KEY }}
100+
IMMS_API_KID: ${{ secrets.IMMS_API_KID }}
101+
IMMS_API_PEM: ${{ secrets.IMMS_API_PEM }}
102+
103+
# - name: Process reports
104+
# if: always() && steps.set-variables.outputs.deploy_report == 'true'
105+
# uses: ./.github/actions/deploy-reports
106+
# with:
107+
# device: ${{ steps.set-variables.outputs.device }}
108+
# env:
109+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dependencies = [
1919
"pytest-dotenv==0.5.2",
2020
"pytest-playwright==0.7.0",
2121
"pytest-rerunfailures==15.1",
22+
"pytest-split==0.10.0",
2223
"pytest-xdist==3.8.0",
2324
"requests==2.32.4",
2425
"requests-oauthlib==2.0.0",

uv.lock

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)