-
Notifications
You must be signed in to change notification settings - Fork 53
284 lines (266 loc) · 9.42 KB
/
testingWorkflow.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
name: Testing Workflow
on:
workflow_dispatch:
inputs:
platforms:
description: "Build additional architectures (linux/arm64). linux/amd64 is built by default."
required: false
force_build:
description: "Force build the docker images"
required: true
default: true
pull_request:
branches:
- "**"
merge_group:
types:
- checks_requested
push:
branches:
- main
permissions:
contents: read
packages: write
jobs:
# Check for changes in the backend, cypress, database, frontend, and nginx directories
workflow_changes:
with:
what_to_check: ./.github
uses: ./.github/workflows/checkForChanges.yml
backend_changes:
with:
what_to_check: ./backend
uses: ./.github/workflows/checkForChanges.yml
cypress_changes:
with:
what_to_check: ./cypress
uses: ./.github/workflows/checkForChanges.yml
database_changes:
with:
what_to_check: ./backend/db-setup
uses: ./.github/workflows/checkForChanges.yml
frontend_changes:
with:
what_to_check: ./frontend
uses: ./.github/workflows/checkForChanges.yml
nginx_changes:
with:
what_to_check: ./nginx
uses: ./.github/workflows/checkForChanges.yml
# Build Docker Images for the backend, cypress, database, frontend, and nginx
build_backend_image:
if: needs.workflow_changes.outputs.has_changes == 'true' || needs.backend_changes.outputs.has_changes == 'true' || inputs.force_build == 'true' || github.ref == 'refs/heads/main'
needs:
- backend_changes
- workflow_changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: ${{ inputs.platform }}
outputs:
version: ${{ steps.set_backend_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Build Backend Image
id: set_backend_version
uses: ./.github/actions/docker-buildx
with:
file: ./backend/Dockerfile
gh_username: ${{ github.actor }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
image_name: backend
platform: ${{ matrix.platform }}
build_cypress_image:
if: needs.workflow_changes.outputs.has_changes == 'true' || needs.cypress_changes.outputs.has_changes == 'true' || inputs.force_build == 'true' || github.ref == 'refs/heads/main'
needs:
- cypress_changes
- workflow_changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: ${{ inputs.platform }}
outputs:
version: ${{ steps.set_cypress_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Build Cypress Image
id: set_cypress_version
uses: ./.github/actions/docker-buildx
with:
file: ./cypress/Dockerfile
gh_username: ${{ github.actor }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
image_name: cypress
platform: ${{ matrix.platform }}
build_database_image:
if: needs.workflow_changes.outputs.has_changes == 'true' || needs.database_changes.outputs.has_changes == 'true' || inputs.force_build == 'true' || github.ref == 'refs/heads/main'
needs:
- database_changes
- workflow_changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: ${{ inputs.platform }}
outputs:
version: ${{ steps.set_database_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Build Database Image
id: set_database_version
uses: ./.github/actions/docker-buildx
with:
context: ./backend/db-setup
gh_username: ${{ github.actor }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
image_name: database
platform: ${{ matrix.platform }}
build_frontend_image:
if: needs.workflow_changes.outputs.has_changes == 'true' || needs.frontend_changes.outputs.has_changes == 'true' || inputs.force_build == 'true' || github.ref == 'refs/heads/main'
needs:
- frontend_changes
- workflow_changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: ${{ inputs.platform }}
outputs:
version: ${{ steps.set_frontend_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Build Frontend Image
id: set_frontend_version
uses: ./.github/actions/docker-buildx
with:
file: ./frontend/Dockerfile
gh_username: ${{ github.actor }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
image_name: frontend
platform: ${{ matrix.platform }}
build_args: |
"REACT_APP_OKTA_URL=http://wiremock:8088"
"REACT_APP_OKTA_CLIENT_ID=0oa1k0163nAwfVxNW1d7"
"REACT_APP_BASE_URL=https://localhost.simplereport.gov"
"REACT_APP_BACKEND_URL=https://localhost.simplereport.gov/api"
"PUBLIC_URL=/app/"
"REACT_APP_OKTA_ENABLED=true"
"REACT_APP_DISABLE_MAINTENANCE_BANNER=true"
build_frontend_lighthouse_image:
if: needs.workflow_changes.outputs.has_changes == 'true' || needs.frontend_changes.outputs.has_changes == 'true' || inputs.force_build == 'true' || github.ref == 'refs/heads/main'
needs:
- frontend_changes
- workflow_changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: ${{ inputs.platform }}
outputs:
version: ${{ steps.set_frontend_lighthouse_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Build Frontend Lighthouse Image
id: set_frontend_lighthouse_version
uses: ./.github/actions/docker-buildx
with:
file: ./frontend/Dockerfile
gh_username: ${{ github.actor }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
image_name: frontend-lighthouse
platform: ${{ matrix.platform }}
build_args: |
"REACT_APP_BASE_URL=https://localhost.simplereport.gov"
"REACT_APP_BACKEND_URL=https://localhost.simplereport.gov/api"
"PUBLIC_URL=/app/"
"REACT_APP_OKTA_ENABLED=false"
"REACT_APP_DISABLE_MAINTENANCE_BANNER=true"
build_nginx_image:
if: needs.workflow_changes.outputs.has_changes == 'true' || needs.nginx_changes.outputs.has_changes == 'true' || inputs.force_build == 'true' || github.ref == 'refs/heads/main'
needs:
- nginx_changes
- workflow_changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: ${{ inputs.platform }}
outputs:
version: ${{ steps.set_nginx_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Build Nginx Image
id: set_nginx_version
uses: ./.github/actions/docker-buildx
with:
context: ./nginx
gh_username: ${{ github.actor }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
image_name: nginx
platform: ${{ matrix.platform }}
# Automated tests
e2e_local:
if: |
always() && !failure() && !cancelled()
needs:
- build_backend_image
- build_cypress_image
- build_database_image
- build_frontend_image
- build_nginx_image
uses: ./.github/workflows/e2eLocal.yml
secrets:
CYPRESS_OKTA_USERNAME: ${{ secrets.CYPRESS_OKTA_USERNAME }}
CYPRESS_OKTA_PASSWORD: ${{ secrets.CYPRESS_OKTA_PASSWORD }}
CYPRESS_OKTA_SECRET: ${{ secrets.CYPRESS_OKTA_SECRET }}
OKTA_API_KEY: ${{ secrets.OKTA_API_KEY }}
SMARTY_AUTH_ID: ${{ secrets.SMARTY_AUTH_ID }}
SMARTY_AUTH_TOKEN: ${{ secrets.SMARTY_AUTH_TOKEN }}
with:
DOCKER_BACKEND_IMAGE_VERSION: ${{ needs.build_backend_image.outputs.version }}
DOCKER_CYPRESS_IMAGE_VERSION: ${{ needs.build_cypress_image.outputs.version }}
DOCKER_DATABASE_IMAGE_VERSION: ${{ needs.build_database_image.outputs.version }}
DOCKER_FRONTEND_IMAGE_VERSION: ${{ needs.build_frontend_image.outputs.version }}
DOCKER_NGINX_IMAGE_VERSION: ${{ needs.build_nginx_image.outputs.version }}
lighthouse:
if: |
always() && !failure() && !cancelled()
needs:
- build_backend_image
- build_database_image
- build_frontend_lighthouse_image
- build_nginx_image
uses: ./.github/workflows/lighthouse.yml
with:
DOCKER_BACKEND_IMAGE_VERSION: ${{ needs.build_backend_image.outputs.version }}
DOCKER_DATABASE_IMAGE_VERSION: ${{ needs.build_database_image.outputs.version }}
DOCKER_FRONTEND_LIGHTHOUSE_IMAGE_VERSION: ${{ needs.build_frontend_lighthouse_image.outputs.version }}
DOCKER_NGINX_IMAGE_VERSION: ${{ needs.build_nginx_image.outputs.version }}
tests:
if: |
always() && !failure() && !cancelled()
needs:
- build_database_image
uses: ./.github/workflows/test.yml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_TEST_ACCOUNT_SID }}
TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_TEST_AUTH_TOKEN }}
with:
DOCKER_DATABASE_IMAGE_VERSION: ${{ needs.build_database_image.outputs.version }}
liquibase_action_checks:
if: |
always() && !failure() && !cancelled()
needs:
- build_database_image
uses: ./.github/workflows/testDBActions.yml
with:
DOCKER_DATABASE_IMAGE_VERSION: ${{ needs.build_database_image.outputs.version }}