-
Notifications
You must be signed in to change notification settings - Fork 2
193 lines (187 loc) · 6.77 KB
/
regression-tests.yml
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Regression Tests
on:
workflow_dispatch:
schedule:
# Runs every morning at 06:00 (https://crontab.guru/#0_6_*_*_*)
- cron: '0 6 * * *'
env:
EDITOR_DIRECTORY: editor.planx.uk
jobs:
integration_tests:
name: Run Integration tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PIZZA_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PIZZA_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: Copy .env files from Staging S3 to the current working directory with AWS CLI
run: ./scripts/pull-secrets.sh
- name: Check if .env files exist
id: check_files
uses: andstor/file-existence-action@v2
with:
files: ".env, .env.staging, api.planx.uk/.env.test, hasura.planx.uk/.env.test"
fail: true
- name: Setup .gitconfig
run: mv .gitconfig ~/.gitconfig
- uses: pnpm/action-setup@v4.0.0
with:
version: ${{ vars.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- run: pnpm install --frozen-lockfile
working-directory: ${{ env.EDITOR_DIRECTORY }}
- name: Start test containers
run: ./scripts/start-containers-for-tests.sh
- name: Postgres Tests
run: ./hasura.planx.uk/run-postgres-tests.sh
- run: pnpm i -g hasura-cli@2.36.1
- name: Hasura Tests
run: pnpm install --frozen-lockfile && pnpm test
working-directory: hasura.planx.uk/tests
api_tests:
name: Run API Tests
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PIZZA_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PIZZA_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: Copy .env files from Staging S3 to the current working directory with AWS CLI
run: ./scripts/pull-secrets.sh
- name: Check if .env files exist
id: check_files
uses: andstor/file-existence-action@v2
with:
files: ".env, .env.staging, api.planx.uk/.env.test, hasura.planx.uk/.env.test"
fail: true
- uses: pnpm/action-setup@v4.0.0
with:
version: ${{ vars.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- name: Setup .gitconfig
run: mv .gitconfig ~/.gitconfig
- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: api.planx.uk
- name: Run API Tests
run: pnpm install --frozen-lockfile && pnpm check --quiet && pnpm test
working-directory: api.planx.uk
test_react:
name: Run React Tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PIZZA_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PIZZA_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: Copy .env files from Staging S3 to the current working directory with AWS CLI
run: ./scripts/pull-secrets.sh
- name: Check if .env files exist
id: check_files
uses: andstor/file-existence-action@v2
with:
files: ".env, .env.staging, api.planx.uk/.env.test, hasura.planx.uk/.env.test"
fail: true
- uses: pnpm/action-setup@v4.0.0
with:
version: ${{ vars.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- name: Setup .gitconfig
run: mv .gitconfig ~/.gitconfig
- run: pnpm install --frozen-lockfile
working-directory: ${{ env.EDITOR_DIRECTORY }}
- run: pnpm build
working-directory: ${{ env.EDITOR_DIRECTORY }}
- run: pnpm test:silent
working-directory: ${{ env.EDITOR_DIRECTORY }}
end_to_end_tests:
name: E2E tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PIZZA_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PIZZA_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: Copy .env files from Staging S3 to the current working directory with AWS CLI
run: ./scripts/pull-secrets.sh
- name: Setup PNPM
uses: pnpm/action-setup@v4.0.0
with:
version: ${{ vars.PNPM_VERSION }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- name: Setup .gitconfig
run: mv .gitconfig ~/.gitconfig
- name: PNPM Install
run: pnpm install --frozen-lockfile
working-directory: e2e
- name: Code checks
run: pnpm check
working-directory: e2e
- name: Install Playwright Dependencies
run: pnpm playwright install --with-deps
working-directory: e2e/tests/ui-driven
- name: Start test containers
run: ./scripts/start-containers-for-tests.sh
- name: End-to-end Tests
run: pnpm test:regression
working-directory: e2e
- name: Archive Playwright Test Results
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: e2e/tests/ui-driven/test-results/
retention-days: 3
notify:
name: Notify On Failure
runs-on: ubuntu-22.04
needs:
- integration_tests
- api_tests
- test_react
- end_to_end_tests
if: ${{ github.ref == 'refs/heads/main' && failure() }}
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: planx-notifications-internal
SLACK_USERNAME: Regression Tests
SLACK_MESSAGE: The regression test suite failed
SLACK_ICON_EMOJI: ":warning:"
SLACK_COLOR: "#FF5733"
SLACK_TITLE: Regression Test Failure
MSG_MINIMAL: "actions url,commit"
SLACK_WEBHOOK: ${{ secrets.SLACK_DEPLOYMENT_WEBHOOK }}