-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (148 loc) · 5.7 KB
/
regression_tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Regression Tests
on:
workflow_dispatch:
inputs:
marker:
description: 'Test scenario tags'
required: false
type: string
default: ''
environment:
description: 'Environment to run tests against'
type: environment
required: true
default: "dev"
product:
description: 'The product we are testing'
type: choice
options:
- RAVS
required: false
default: RAVS
id:
description: 'Unique run identifier (Do not change this)'
required: false
default: "Manually Triggered Run"
pull_request_id:
description: 'The ID of the pull request. This should be in the format pr-xxxx where xxxx is the pull request id'
required: false
default: ""
github_tag:
description: 'The GitHub tag to run the test pack from'
required: false
default: "main"
push:
branches:
- '**' # Triggers on push to any branch
schedule:
# QA environment at 6:00 AM UTC
- cron: '0 6 * * *' # This will run the tests for the QA environment
# DEV environment at 6:30 AM UTC
- cron: '30 6 * * *' # This will run the tests for the DEV environment
jobs:
regression_tests:
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'push' && 'dev' || (github.event_name == 'schedule' && github.event.schedule == '0 6 * * *' && 'qa' || (github.event_name == 'workflow_dispatch' && inputs.environment || 'dev')) }} # Dynamically set environment based on event type
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Cache Python dependencies
- name: Cache Python dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up en_GB.UTF-8 locale
run: |
sudo apt-get update
sudo apt-get install -y locales
sudo locale-gen "en_GB.UTF-8"
sudo update-locale LANG=en_GB.UTF-8 LANGUAGE=en_GB:en LC_ALL=en_GB.UTF-8
env:
DEBIAN_FRONTEND: noninteractive
# Step 3: Set up Python 3.11
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Step 4: Install Python dependencies from requirements.txt
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Step 5: Cache Playwright binaries
- name: Cache Playwright binaries
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ inputs.environment }}
restore-keys: |
${{ runner.os }}-playwright-
# Step 6: Install Playwright dependencies
- name: Install Playwright dependencies
run: |
python -m pip install playwright
playwright install
playwright install-deps
# Step 7: Install Allure Commandline
- name: Install Allure Commandline
run: |
curl -o allure-commandline-2.17.3.tgz -Ls https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.17.3/allure-commandline-2.17.3.tgz && \
tar -zxvf allure-commandline-2.17.3.tgz -C /opt/ && \
sudo ln -s /opt/allure-2.17.3/bin/allure /usr/bin/allure && \
rm -rf allure-commandline-2.17.3.tgz
# Step 8: Verify Allure Installation
- name: Verify Allure Installation
run: allure --version
# Step 9: Debug tox.ini content for visibility
- name: Debug tox.ini
run: cat tox.ini
- name: Debug regression_tests.yaml
run: cat .github/workflows/regression_tests.yaml
- name: Debug locale settings
run: |
echo "Current Locale:"
locale
# Step 10: Run Tests using tox
- name: Run Tests
env:
TZ: "Europe/London"
LANG: "en_GB.UTF-8"
LANGUAGE: "en_GB:en"
LC_ALL: "en_GB.UTF-8"
TEST_ENVIRONMENT: ${{ github.event_name == 'push' && 'dev' || (github.event_name == 'schedule' && github.event.schedule == '0 6 * * *' && 'qa' || (github.event_name == 'workflow_dispatch' && inputs.environment || 'dev')) }}
RAVS_PASSWORD: ${{ secrets.RAVS_PASSWORD }}
HEADLESS_MODE: "true"
BROWSER: "edge"
MARKER: ${{ inputs.marker || '' }}
AGENTS: 3
run: |
tox -v
continue-on-error: true
# Step 11: Upload Allure Results as an artifact
- name: Upload Allure Results
uses: actions/upload-artifact@v4
with:
name: allure-results
path: allure-results
if-no-files-found: error
# Step 12: Generate a token and trigger report generation
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.EPS_REGRESSION_TESTING_APP_ID }}
private-key: ${{ secrets.EPS_REGRESSION_TESTING_PEM }}
owner: "NHSDigital"
repositories: "ravs-tests,ravs-test-reports"
- name: Trigger test report generation
run: |
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer ${{ steps.generate-token.outputs.token }}" \
-d '{"ref": "main", "inputs": {"run_id": "${{ github.run_id }}"}}' \
"https://api.github.com/repos/NHSDigital/ravs-test-reports/actions/workflows/publish_report.yml/dispatches"