forked from cypress-io/cypress-example-kitchensink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
222 lines (190 loc) · 6.53 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
# 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]
win: circleci/[email protected]
executors:
mac:
macos:
xcode: "14.3.1"
resource_class: macos.x86.medium.gen2
browsers:
docker:
- image: 'cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1'
jobs:
win-test:
working_directory: ~/app
executor:
name: win/default
size: medium
shell: bash.exe
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
background: true
- run:
name: 'Run Cypress tests'
command: npm run e2e:record -- --env circle=true
no_output_timeout: '1m'
- store_artifacts:
path: cypress\screenshots
win-test-chrome:
working_directory: ~/app
executor:
name: win/default
size: medium
shell: bash.exe
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 --ignore-checksums -y
- 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
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
win-test-firefox:
working_directory: ~/app
executor:
name: win/default
size: medium
shell: bash.exe
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 -y
- 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
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
mac-test:
executor: mac
steps:
- cypress/install:
post-install: "npm run build"
# 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-tests:
start-command: 'npm run start'
cypress-command: 'npx cypress run --record --group Mac build'
release:
executor: cypress/default
steps:
- checkout
- run: npx [email protected]
workflows:
win-build:
jobs:
- win-test
- win-test-chrome
- win-test-firefox
mac-build:
jobs:
- mac-test
linux-build:
jobs:
# checks out code and installs dependencies once
# runs on 3 machines, load balances tests
# and records on Cypress Cloud
- cypress/run:
name: '3 machines'
post-install: 'npm run build'
start-command: 'npm run start'
cypress-command: 'npx cypress run --record --parallel --group 3x-electron on CircleCI'
parallelism: 3
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
# run on 2 machines using Chrome browser
- cypress/run:
name: '2 machines using Chrome'
start-command: 'npm run start'
install-browsers: true
cypress-command: 'npx cypress run --browser chrome --record --parallel --group 2x-chrome on CircleCI'
parallelism: 2
- cypress/run:
name: '2 machines using Firefox'
start-command: 'npm run start'
install-browsers: true
cypress-command: 'npx cypress run --browser firefox --record --parallel --group 2x-firefox on CircleCI'
parallelism: 2
- release:
filters:
branches:
only:
- master
requires:
- 3 machines
- 2 machines using Chrome
- 2 machines using Firefox