-
-
Notifications
You must be signed in to change notification settings - Fork 305
/
config.yml
230 lines (215 loc) · 5.92 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
version: 2.1
orbs:
codecov: codecov/codecov@4.2.0
default-job: &default-job
working_directory: /tmp/toolpad
resource_class: medium
docker:
- image: cimg/node:20.17
environment:
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
default-context: &default-context
context:
- org-global
# CircleCI has disabled the cache across forks for security reasons.
# Following their official statement, it was a quick solution, they
# are working on providing this feature back with appropriate security measures.
# https://discuss.circleci.com/t/saving-cache-stopped-working-warning-skipping-this-step-disabled-in-configuration/24423/21
#
# restore_repo: &restore_repo
# restore_cache:
# key: v1-repo-{{ .Branch }}-{{ .Revision }}
commands:
install_js:
parameters:
browsers:
type: boolean
default: false
description: 'Set to true if you intend to use any browser (for example with playwright).'
steps:
- when:
condition: << parameters.browsers >>
steps:
- run:
name: Install pnpm package manager
command: corepack enable
- when:
condition:
not: << parameters.browsers >>
steps:
- run:
name: Install pnpm package manager
# See https://stackoverflow.com/a/73411601
command: corepack enable --install-directory ~/bin
- run:
name: View install environment
command: |
node --version
pnpm --version
- run:
name: Install js dependencies
command: pnpm install
jobs:
checkout:
<<: *default-job
steps:
- checkout
- install_js
- run:
name: Should not have any git not staged
command: git add -A && git diff --exit-code --staged
- run:
name: Check for duplicated packages
command: |
# #default-branch-switch
if [[ $(git diff --name-status master | grep -E 'pnpm-workspace\.yaml|pnpm-lock.yaml|package\.json') == "" ]];
then
echo "no changes to dependencies detected, skipping..."
else
pnpm dedupe --check
fi
test_lint:
<<: *default-job
steps:
- checkout
- install_js
- run:
name: Eslint
command: pnpm eslint
- run:
name: Lint JSON
command: pnpm jsonlint
- run:
name: Lint Markdown
command: pnpm markdownlint
test_types:
<<: *default-job
steps:
- checkout
- install_js
- run:
name: Check Typescript types
command: pnpm check-types
environment:
NODE_OPTIONS: --max-old-space-size=3584
test_static:
<<: *default-job
steps:
- checkout
- install_js
- run:
name: '`pnpm docs:typescript:formatted` changes committed?'
command: |
pnpm docs:typescript:formatted --disable-cache
pnpm check-changes
- run:
name: '`pnpm prettier:all` changes committed?'
command: |
pnpm prettier:all
pnpm check-changes
- run:
name: '`pnpm proptypes` changes committed?'
command: |
pnpm proptypes
pnpm check-changes
- run:
name: '`pnpm jsonSchemas` changes committed?'
command: |
pnpm jsonSchemas
pnpm check-changes
- run:
name: '`pnpm docs:build:api` changes committed?'
command: |
pnpm docs:build:api
pnpm check-changes
test_unit:
<<: *default-job
steps:
- checkout
- install_js:
browsers: false
- run:
name: 'Build packages'
command: pnpm release:build
environment:
NODE_OPTIONS: --max-old-space-size=3584
- run:
name: Tests fake browser
command: pnpm test
- codecov/upload
test_unit_browser:
<<: *default-job
docker:
- image: mcr.microsoft.com/playwright:v1.48.2-focal
environment:
NODE_ENV: test
steps:
- checkout
- install_js:
browsers: true
- run:
name: 'Build packages'
command: pnpm release:build
environment:
NODE_OPTIONS: --max-old-space-size=3584
- run:
name: Tests real browser
command: pnpm test:browser
test_integration:
<<: *default-job
resource_class: 'large'
parallelism: 2
docker:
- image: mcr.microsoft.com/playwright:v1.47.2-focal
environment:
NODE_ENV: test
TOOLPAD_TEST_RETRIES: 1
steps:
- checkout
- install_js:
browsers: true
- run:
name: 'Build packages'
command: pnpm release:build
environment:
NODE_OPTIONS: --max-old-space-size=3584
- run:
name: Tests real browser
command: pnpm test:integration
- store_test_results:
path: test/test-results/junit.xml
- run:
name: Upload screenshots to Argos CI
command: ARGOS_PARALLEL_TOTAL=${CIRCLE_NODE_TOTAL} pnpm test:argos
- store_artifacts:
path: test/test-results
destination: playwright-test-results
workflows:
pipeline:
jobs:
- checkout:
<<: *default-context
- test_lint:
<<: *default-context
requires:
- checkout
- test_types:
<<: *default-context
requires:
- checkout
- test_static:
<<: *default-context
requires:
- checkout
- test_unit:
<<: *default-context
requires:
- checkout
- test_unit_browser:
<<: *default-context
requires:
- checkout
- test_integration:
<<: *default-context
requires:
- checkout