forked from cypress-io/cypress-example-kitchensink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
272 lines (238 loc) · 8.17 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
269
270
271
272
# testing using CircleCI orb
# see https://on.cypress.io/circleci-orb
# for non-orb configuration see old commit
# https://github.com/cypress-io/cypress-example-kitchensink/blob/aabb10cc1bb9dee88e1bf28e0af5e9661427ee7a/circle.yml
# to use CircleCI orbs need to use version >= 2.1
version: 2.1
orbs:
# use Cypress orb from CircleCI registry
cypress: cypress-io/[email protected]
executors:
mac:
macos:
xcode: "10.1.0"
win:
# copied the parameters from
# https://circleci.com/developer/orbs/orb/circleci/windows
machine:
image: "windows-server-2019-vs2019:stable"
resource_class: "windows.medium"
shell: "bash.exe"
browsers:
docker:
- image: 'cypress/browsers:node14.16.0-chrome90-ff88'
jobs:
win-test:
working_directory: ~/app
executor: win
steps:
- checkout
- restore_cache:
key: dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
- run: npm ci
- run: npm run cy:verify
- run: npm run cy:info
- save_cache:
key: dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
paths:
# could not use environment variables for some reason
- C:\Users\circleci\AppData\Local\Cypress\Cache
- C:\Users\circleci\AppData\Roaming\npm-cache
# if you want to test execa's behavior on Windows
# - run: node ./scripts/test-execa
- run:
name: 'Start server'
command: npm run start:ci:windows
background: true
- run:
name: 'Run Cypress tests'
command: npm run e2e:record -- --env circle=true
no_output_timeout: '1m'
- store_artifacts:
path: cypress\screenshots
- store_artifacts:
path: cypress\videos
win-test-chrome:
working_directory: ~/app
executor: win
steps:
- checkout
- restore_cache:
key: dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
# install Chrome browser on Windows machine using Chocolatey
# https://chocolatey.org/packages/GoogleChrome
- run: choco install googlechrome
- run: npm ci
- run: npm run cy:verify
- run: npm run cy:info
- save_cache:
key: dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
paths:
# could not use environment variables for some reason
- C:\Users\circleci\AppData\Local\Cypress\Cache
- C:\Users\circleci\AppData\Roaming\npm-cache
# if you want to test execa's behavior on Windows
# - run: node ./scripts/test-execa
- run:
name: 'Start server'
command: npm run start:ci:windows
background: true
- run:
name: 'Run Cypress tests'
command: npm run e2e:record:chrome -- --env circle=true
no_output_timeout: '1m'
- store_artifacts:
path: cypress\screenshots
- store_artifacts:
path: cypress\videos
win-test-firefox:
working_directory: ~/app
executor: win
steps:
- checkout
- restore_cache:
key: dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
# install Firefox browser on Windows machine using Chocolatey
# https://chocolatey.org/packages/Firefox
- run: choco install firefox
- run: npm ci
- run: npm run cy:verify
- run: npm run cy:info
- save_cache:
key: dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
paths:
# could not use environment variables for some reason
- C:\Users\circleci\AppData\Local\Cypress\Cache
- C:\Users\circleci\AppData\Roaming\npm-cache
# if you want to test execa's behavior on Windows
# - run: node ./scripts/test-execa
- run:
name: 'Start server'
command: npm run start:ci:windows
background: true
- run:
name: 'Run Cypress tests'
command: npm run e2e:record:firefox -- --env circle=true
no_output_timeout: '1m'
- store_artifacts:
path: cypress\screenshots
- store_artifacts:
path: cypress\videos
release:
executor: cypress/base-14
steps:
- attach_workspace:
at: ~/
- run: npm run semantic-release
workflows:
win-build:
jobs:
- win-test
- win-test-chrome
- win-test-firefox
mac-build:
jobs:
- cypress/install:
name: 'Mac install'
executor: mac
# and builds the app using this command
build: 'npm run build'
post-steps:
# show Cypress cache folder and binary versions
# to check if we are caching previous binary versions
- run: npx cypress cache path
- run: npx cypress cache list
- run: npx cypress info
- cypress/run:
name: Mac test
executor: mac
requires:
- Mac install
record: true
parallel: true
parallelism: 2
start: 'npm run start:ci'
group: 'Mac build'
linux-build:
jobs:
# checks out code and installs dependencies once
- cypress/install:
name: 'Linux install'
post-steps:
# show Cypress cache folder and binary versions
# to check if we are caching previous binary versions
- run: npx cypress cache path
- run: npx cypress cache list
- run: npx cypress info
# let's print version info
- run: npx cypress version
- run: npx cypress version --component package
- run: npx cypress version --component binary
- run: npx cypress version --component electron
- run: npx cypress version --component node
- cypress/run:
name: 'Linux lint'
requires:
- Linux install
# the previous job has already installed every dependency
# and saved the workspace. "cypress/run" automatically restores the workspace
install-command: echo 'Already installed'
# run all lint checks
command: 'npm run build'
# this job does not need to save its files
no-workspace: true
# runs on 3 machines, load balances tests
# and records on Cypress Dashboard
- cypress/run:
# name this job because we are running "cypress/run" several times
# with different parameters
name: '3 machines'
# job will use workspace with code and dependencies
# installed by the "install" job
requires:
- Linux install
record: true # record results on Cypress dashboard
parallel: true # load balance all tests
parallelism: 3 # across 3 machines
group: '3x-electron on CircleCI' # name this group
start: 'npm run start:ci' # start server before running tests
# run on 2 machines using Chrome browser
- cypress/run:
name: '2 machines using Chrome'
# job will use workspace with code and dependencies
# installed by the "install" job
requires:
- Linux install
# use executor with Chrome installed
executor: browsers
# use browser "chrome" for running tests
browser: chrome
record: true
parallel: true
parallelism: 2
group: '2x-chrome on CircleCI'
start: 'npm run start:ci'
- cypress/run:
name: '2 machines using Firefox'
# job will use workspace with code and dependencies
# installed by the "install" job
requires:
- Linux install
# use executor with Chrome installed
executor: browsers
# use browser "chrome" for running tests
browser: firefox
record: true
parallel: true
parallelism: 2
group: '2x-firefox on CircleCI'
start: 'npm run start:ci'
- release:
filters:
branches:
only:
- master
requires:
- Linux install
- Linux lint
- 3 machines