-
Notifications
You must be signed in to change notification settings - Fork 19
175 lines (158 loc) · 5.56 KB
/
regression.yml
File metadata and controls
175 lines (158 loc) · 5.56 KB
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
168
169
170
171
172
173
174
175
---
name: Regression Testing
on:
push:
branches:
- develop
- integration
paths:
- frontend/**
- .github/workflows/regression.yml
pull_request:
branches:
- develop
- integration
paths:
- frontend/**
- .github/workflows/frontend.yml
defaults:
run:
working-directory: ./playwright
jobs:
test_staging:
runs-on: ubuntu-latest
environment: staging
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Run Playwright tests
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PW_XFD_2FA_ISSUER: ${{ secrets.PW_XFD_2FA_ISSUER }}
PW_XFD_2FA_SECRET: ${{ secrets.PW_XFD_2FA_SECRET }}
PW_XFD_PASSWORD: ${{ secrets.PW_XFD_PASSWORD }}
PW_XFD_USERNAME: ${{ secrets.PW_XFD_USERNAME }}
run: |
aws ecs run-task \
--cluster crossfeed-playwright-staging-cd-ecs-cluster \
--task-definition crossfeed-staging-cd-playwright-worker \
--launch-type FARGATE \
--network-configuration \
"awsvpcConfiguration={subnets=[\"${{ secrets.AWS_SUBNET }}\"], \
securityGroups=[\"${{ secrets.AWS_SECURITY_GROUP }}\"], \
assignPublicIp=\"ENABLED\"}" \
--region ${{ secrets.AWS_REGION }} \
--overrides '{
"containerOverrides": [
{
"name": "main",
"command": [
"sh",
"-c",
"echo 'Cloning Playwright tests from GitHub...'; \
git clone https://github.com/cisagov/xfd.git /app/xfd; \
cd /app/xfd/playwright && \
echo 'Running Playwright tests'; \
npx playwright test"
]
}
]
}'
continue-on-error: false # Ensure it stops if the ECS task fails
- name: Upload test results as artifact
uses: actions/upload-artifact@v4
with:
name: playwright-test-results
path: ./test-results/*.json
- name: Upload HTML report to S3
run: |
aws s3 cp ./playwright-report/html \
s3://${{ vars.AUTOMATED_TEST_REPORT_BUCKET_NAME }}/\
playwright-reports/html/ --recursive || \
{ echo "HTML report upload failed"; exit 1; }
- name: Upload JSON report to S3
run: |
if aws s3 cp ./playwright-report/results.json \
s3://${{ vars.AUTOMATED_TEST_REPORT_BUCKET_NAME }}/\
playwright-reports/results.json; then \
echo "JSON report uploaded successfully."; \
else \
echo "Failed to upload JSON report to S3." >&2; \
exit 1; \
fi
test_integration:
runs-on: ubuntu-latest
environment: integration
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Run Playwright tests
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PW_XFD_2FA_ISSUER: ${{ secrets.PW_XFD_2FA_ISSUER }}
PW_XFD_2FA_SECRET: ${{ secrets.PW_XFD_2FA_SECRET }}
PW_XFD_PASSWORD: ${{ secrets.PW_XFD_PASSWORD }}
PW_XFD_USERNAME: ${{ secrets.PW_XFD_USERNAME }}
run: |
aws ecs run-task \
--cluster crossfeed-playwright-integration-ecs-cluster \
--task-definition crossfeed-integration-playwright-worker \
--launch-type FARGATE \
--network-configuration \
"awsvpcConfiguration={subnets=[\"${{ secrets.AWS_SUBNET }}\"], \
securityGroups=[\"${{ secrets.AWS_SECURITY_GROUP }}\"], \
assignPublicIp=\"ENABLED\"}" \
--region ${{ secrets.AWS_REGION }} \
--overrides '{
"containerOverrides": [
{
"name": "main",
"command": [
{
"name": "main",
"command": [
"sh",
"-c",
"echo 'Cloning Playwright tests from GitHub...'; \
git clone https://github.com/cisagov/xfd.git /app/xfd; \
cd /app/xfd/playwright && \
echo 'Running Playwright tests'; \
npx playwright test"
]
}
]
}'
continue-on-error: false # Ensure it stops if the ECS task fails
- name: Upload test results as artifact
uses: actions/upload-artifact@v4
with:
name: playwright-test-results
path: ./test-results/*.json
- name: Upload HTML report to S3
run: |
aws s3 cp ./playwright-report/ \
s3://${{ vars.AUTOMATED_TEST_REPORT_BUCKET_NAME }}/\
playwright-reports/html/ --recursive || \
{ echo "HTML report upload failed"; exit 1; }
- name: Upload JSON report to S3
run: |
if aws s3 cp ./playwright-report/results.json \
s3://${{ vars.AUTOMATED_TEST_REPORT_BUCKET_NAME }}/\
playwright-reports/results.json; then \
echo "JSON report uploaded successfully."; \
else \
echo "Failed to upload JSON report to S3." >&2; \
exit 1; \
fi