-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.yml
268 lines (254 loc) · 9.35 KB
/
config.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
version: 2.1
orbs:
aws-cli: circleci/[email protected]
aws_assume_role: lbh-hackit/[email protected]
browser-tools: circleci/[email protected]
node: circleci/[email protected]
executors:
node-executor:
docker:
- image: cimg/node:20.16.0-browsers
docker-python:
docker:
- image: circleci/python:3.7
references:
workspace_root: &workspace_root '~'
attach_workspace: &attach_workspace
attach_workspace:
at: *workspace_root
jobs:
install-dependencies:
executor: node-executor
steps:
- checkout
- node/install-packages:
pkg-manager: yarn
tests:
executor: node-executor
steps:
- checkout
- node/install-packages:
pkg-manager: yarn
- run:
name: Run Linter
command: yarn lint
- run:
name: Run Tests
command: |
export NEXT_PUBLIC_ENV_NAME=test
export NEXT_PUBLIC_NODE_ENV=development
export NEXT_PUBLIC_BUDGET_CODE_SELECTION_ENABLED=true
export NEXT_PUBLIC_SUPPORT_LINK=https://sites.google.com/hackney.gov.uk/repairshubsupport
export NEXT_PUBLIC_OUT_OF_HOURS_LINK=https://hackney.gov.uk
yarn test:unit
e2e:
executor: node-executor
parallelism: 4
steps:
- checkout
- node/install-packages:
pkg-manager: yarn
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- run:
name: Force install
command: yarn cypress install --force
- run:
name: Run E2E With Lighthouse Audit
command: |
export NEXT_PUBLIC_ENV_NAME=test
export NEXT_PUBLIC_SCHEDULER_URL=$NEXT_PUBLIC_SCHEDULER_URL
export NEXT_PUBLIC_OUT_OF_HOURS_LINK=https://hackney.gov.uk
export NEXT_PUBLIC_PROPERTIES_PAGE_SIZE=$NEXT_PUBLIC_PROPERTIES_PAGE_SIZE
export NEXT_PUBLIC_SUPPORT_LINK=https://sites.google.com/hackney.gov.uk/repairshubsupport
export NEXT_PUBLIC_BUDGET_CODE_SELECTION_ENABLED=true
# Split tests and run them in parallel using CircleCI's built in timing-based splitter
find cypress/e2e -type f -name "*.[jt]s" | sort | uniq > circleci_test_files.txt
cat circleci_test_files.txt
# Cypress expects files to be separated with commas
TESTFILES=$(circleci tests split --split-by=timings circleci_test_files.txt | perl -pe 'chomp if eof' | tr '\n' ',')
echo $TESTFILES
NODE_ENV=test yarn start-test http://localhost:5001 "yarn cy:run:audit --reporter cypress-multi-reporters --reporter-options configFile=cypress-reporter-config.json --spec \"$TESTFILES\""
yarn node scripts/fix-junit-xml.js
- store_artifacts:
path: cypress/screenshots
- store_artifacts:
path: cypress/videos
- store_artifacts:
path: cypress/reports
- store_test_results:
path: cypress/results/
build-deploy-development:
executor: node-executor
steps:
- *attach_workspace
- checkout
- node/install-packages:
pkg-manager: yarn
- aws-cli/install
- run:
name: deploy
command: |
export NEXT_PUBLIC_NODE_ENV=production
export NEXT_PUBLIC_ENV_NAME=development
export NEXT_PUBLIC_SCHEDULER_URL=$DRS_URL_STAGING
export NEXT_PUBLIC_OUT_OF_HOURS_LINK=$OUT_OF_HOURS_LINK_STAGING
export NEXT_PUBLIC_DRS_SESSION_COOKIE_NAME=$DRS_SESSION_COOKIE_NAME
export NEXT_PUBLIC_STATIC_IMAGES_BUCKET_URL=$PUBLIC_STATIC_IMAGES_BUCKET_URL_DEVELOPMENT
export NEXT_PUBLIC_PROPERTIES_PAGE_SIZE=$NEXT_PUBLIC_PROPERTIES_PAGE_SIZE
export NEXT_PUBLIC_SUPPORT_LINK=$SUPPORT_LINK
export NEXT_PUBLIC_SENTRY_ENVIRONMENT=development
export NEXT_PUBLIC_SENTRY_RELEASE=$CIRCLE_SHA1
export NEXT_PUBLIC_SENTRY_DEBUG=false
export NEXT_PUBLIC_SENTRY_DSN=$SENTRY_DSN
export NEXT_PUBLIC_BUDGET_CODE_SELECTION_ENABLED=$NEXT_PUBLIC_BUDGET_CODE_SELECTION_ENABLED_DEVELOPMENT
export NEXT_PUBLIC_MMH_FRONTEND_URL=$NEXT_PUBLIC_MMH_FRONTEND_URL_DEVELOPMENT
yarn build && yarn --production=true && npx --yes serverless deploy --stage development
build-deploy-staging:
executor: node-executor
steps:
- *attach_workspace
- checkout
- node/install-packages:
pkg-manager: yarn
- aws-cli/install
- run:
name: deploy
command: |
export NEXT_PUBLIC_NODE_ENV=production
export NEXT_PUBLIC_ENV_NAME=staging
export NEXT_PUBLIC_SCHEDULER_URL=$DRS_URL_STAGING
export NEXT_PUBLIC_OUT_OF_HOURS_LINK=$OUT_OF_HOURS_LINK_STAGING
export NEXT_PUBLIC_DRS_SESSION_COOKIE_NAME=$DRS_SESSION_COOKIE_NAME
export NEXT_PUBLIC_STATIC_IMAGES_BUCKET_URL=$PUBLIC_STATIC_IMAGES_BUCKET_URL_STAGING
export NEXT_PUBLIC_PROPERTIES_PAGE_SIZE=$NEXT_PUBLIC_PROPERTIES_PAGE_SIZE
export NEXT_PUBLIC_SUPPORT_LINK=$SUPPORT_LINK
export NEXT_PUBLIC_SENTRY_ENVIRONMENT=staging
export NEXT_PUBLIC_SENTRY_RELEASE=$CIRCLE_SHA1
export NEXT_PUBLIC_SENTRY_DEBUG=false
export NEXT_PUBLIC_SENTRY_DSN=$SENTRY_DSN
export NEXT_PUBLIC_BUDGET_CODE_SELECTION_ENABLED=$NEXT_PUBLIC_BUDGET_CODE_SELECTION_ENABLED_STAGING
export NEXT_PUBLIC_MMH_FRONTEND_URL=$NEXT_PUBLIC_MMH_FRONTEND_URL_STAGING
yarn build && yarn --production=true && npx --yes serverless deploy --stage staging
build-deploy-production:
executor: node-executor
steps:
- *attach_workspace
- checkout
- node/install-packages:
pkg-manager: yarn
- aws-cli/install
- run:
name: deploy
command: |
export NEXT_PUBLIC_NODE_ENV=production
export NEXT_PUBLIC_ENV_NAME=production
export NEXT_PUBLIC_SCHEDULER_URL=$DRS_URL_PRODUCTION
export NEXT_PUBLIC_OUT_OF_HOURS_LINK=$OUT_OF_HOURS_LINK_PRODUCTION
export NEXT_PUBLIC_DRS_SESSION_COOKIE_NAME=$DRS_SESSION_COOKIE_NAME
export NEXT_PUBLIC_STATIC_IMAGES_BUCKET_URL=$PUBLIC_STATIC_IMAGES_BUCKET_URL_PRODUCTION
export NEXT_PUBLIC_PROPERTIES_PAGE_SIZE=$NEXT_PUBLIC_PROPERTIES_PAGE_SIZE
export NEXT_PUBLIC_SUPPORT_LINK=$SUPPORT_LINK
export NEXT_PUBLIC_SENTRY_ENVIRONMENT=production
export NEXT_PUBLIC_SENTRY_RELEASE=$CIRCLE_SHA1
export NEXT_PUBLIC_SENTRY_DEBUG=false
export NEXT_PUBLIC_SENTRY_DSN=$SENTRY_DSN
export NEXT_PUBLIC_BUDGET_CODE_SELECTION_ENABLED=$NEXT_PUBLIC_BUDGET_CODE_SELECTION_ENABLED_PRODUCTION
export NEXT_PUBLIC_MMH_FRONTEND_URL=$NEXT_PUBLIC_MMH_FRONTEND_URL_PRODUCTION
yarn build && yarn --production=true && npx --yes serverless deploy --stage production
assume-role-development:
executor: docker-python
steps:
- checkout
- aws_assume_role/assume_role:
account: $AWS_ACCOUNT_DEVELOPMENT
profile_name: default
role: 'LBH_Circle_CI_Deployment_Role'
- persist_to_workspace:
root: *workspace_root
paths:
- .aws
assume-role-staging:
executor: docker-python
steps:
- checkout
- aws_assume_role/assume_role:
account: $AWS_ACCOUNT_STAGING
profile_name: default
role: 'LBH_Circle_CI_Deployment_Role'
- persist_to_workspace:
root: *workspace_root
paths:
- .aws
assume-role-production:
executor: docker-python
steps:
- checkout
- aws_assume_role/assume_role:
account: $AWS_ACCOUNT_PRODUCTION
profile_name: default
role: 'LBH_Circle_CI_Deployment_Role'
- persist_to_workspace:
root: *workspace_root
paths:
- .aws
workflows:
version: 2
continuous-delivery:
jobs:
- tests
- e2e
- assume-role-development:
context: api-assume-role-housing-development-context
requires:
- tests
- e2e
filters:
branches:
only: develop
- build-deploy-development:
requires:
- assume-role-development
context:
- "Serverless Framework"
filters:
branches:
only: develop
- assume-role-staging:
context: api-assume-role-staging-context
requires:
- tests
- e2e
filters:
branches:
only: main
- build-deploy-staging:
requires:
- assume-role-staging
context:
- "Serverless Framework"
filters:
branches:
only: main
- permit-deploy-production:
type: approval
requires:
- build-deploy-staging
filters:
branches:
only: main
- assume-role-production:
context: api-assume-role-housing-production-context
requires:
- permit-deploy-production
filters:
branches:
only: main
- build-deploy-production:
requires:
- assume-role-production
context:
- "Serverless Framework"
filters:
branches:
only: main