-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
225 lines (221 loc) · 5.66 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
version: 2.1
orbs:
aws-cli: circleci/aws-cli@2.0
codecov: codecov/codecov@3.2.3
browser-tools: circleci/browser-tools@1.2.3
executors:
exec-docker-node:
docker:
- image: cimg/node:16.11.1
commands:
cmd-save-cache:
steps:
- save_cache:
key: package-cache-{{ checksum "package-lock.json" }}
paths:
- node_modules
cmd-restore-cache:
steps:
- restore_cache:
key: package-cache-{{ checksum "package-lock.json" }}
jobs:
install-packages:
executor: exec-docker-node
steps:
- checkout
- cmd-restore-cache
- run:
name: "Install packages"
command: npm install
- cmd-save-cache
lint:
executor: exec-docker-node
steps:
- checkout
- cmd-restore-cache
- run:
name: "Lint"
command: npm run lint
test-tsc:
executor: exec-docker-node
steps:
- checkout
- cmd-restore-cache
- run:
name: "Check TypeScript files"
command: npm run test:tsc
test-unit-integration:
executor: exec-docker-node
steps:
- checkout
- cmd-restore-cache
- run:
name: "Test (Unit and Integration)"
command: npm run test:ci
test-unit-integration-with-reports:
executor: exec-docker-node
steps:
- checkout
- cmd-restore-cache
- run:
name: "Test (Unit and Integration) with reports"
command: npm run test:ci:with:reports
- store_artifacts:
path: ./test-reports
- store_test_results:
path: ./test-reports/test-results
- codecov/upload:
file: ./test-reports/test-coverage/cobertura-coverage.xml
test-sca:
executor: exec-docker-node
steps:
- checkout
- cmd-restore-cache
- run:
name: "Authenticate Snyk"
command: npm run sca:auth $SNYK_TOKEN
- run:
name: "Scanning Code for vulnerabilities"
command: npm run sca:test
test-performance:
docker:
- image: cimg/node:16.13-browsers
steps:
- checkout
- cmd-restore-cache
- attach_workspace:
at: .
- browser-tools/install-chrome
- run:
name: "Test Performance & Insights"
command: npm run test:perf:ci
build-app:
executor: exec-docker-node
steps:
- checkout
- cmd-restore-cache
- run:
name: "Clean previous Application Build"
command: npm run build:clean
- run:
name: "Build Application"
command: npm run build:client:prod
- persist_to_workspace:
root: .
paths:
- 'dist'
deploy-app:
executor: exec-docker-node
steps:
- aws-cli/setup:
profile-name: {PROFILE_NAME}
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-region: AWS_REGION
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
- checkout
- cmd-restore-cache
- attach_workspace:
at: .
- run:
name: "Deploy Application"
command: npm run deploy:s3
build-components-library:
executor: exec-docker-node
steps:
- checkout
- cmd-restore-cache
- run:
name: "Clean previous Components Library Build"
command: npm run storybook:build:clean
- run:
name: "Build Components Library"
command: npm run storybook:build
- persist_to_workspace:
root: .
paths:
- 'storybook-static'
deploy-components-library:
executor: exec-docker-node
steps:
- aws-cli/setup:
profile-name: {PROFILE_NAME}
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-region: AWS_REGION
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
- checkout
- cmd-restore-cache
- attach_workspace:
at: .
- run:
name: "Deploy Components Library"
command: npm run storybook:deploy:s3
workflows:
Common(feature):
when:
not:
equal: [ main, << pipeline.git.branch >> ]
jobs:
- install-packages
- lint:
requires:
- install-packages
- test-tsc:
requires:
- install-packages
- test-unit-integration:
requires:
- install-packages
- build-app:
requires:
- lint
- test-tsc
- test-unit-integration
Commitment(main):
when:
equal: [ main, << pipeline.git.branch >> ]
jobs:
- install-packages
- lint:
requires:
- install-packages
- test-tsc:
requires:
- install-packages
- test-unit-integration-with-reports:
requires:
- install-packages
- test-sca:
requires:
- install-packages
- build-app:
requires:
- lint
- test-tsc
- test-unit-integration-with-reports
- test-sca
- test-performance:
requires:
- build-app
- hold-deploy-app:
name: "[Deploy Application]"
type: approval
requires:
- test-performance
- build-app
- deploy-app:
requires:
- "[Deploy Application]"
- hold-deploy-components-library:
type: approval
name: "[Deploy Components Lib]"
requires:
- lint
- test-tsc
- test-unit-integration-with-reports
- test-sca
- build-components-library:
requires:
- "[Deploy Components Lib]"
- deploy-components-library:
requires:
- build-components-library