@@ -189,86 +189,70 @@ jobs:
189
189
190
190
# # Caching Dependencies and Build Artifacts
191
191
192
- The Cypress team maintains the official
193
- [Cypress GitHub Action](https://github.com/marketplace/actions/cypress-io) for
194
- running Cypress tests. This action provides npm installation, custom caching,
195
- additional configuration options and simplifies setting up advanced workflows
196
- with Cypress in the GitHub Actions platform.
197
-
198
192
:::info
199
193
200
194
Caching of dependencies and build artifacts between installation and worker jobs
201
- can be accomplished with the
195
+ can be accomplished by combining the
196
+ [Cypress GitHub Action](https://github.com/marketplace/actions/cypress-io) with
197
+ the GitHub
202
198
[Upload/Download Artifact Actions](https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts).
203
199
204
200
:: :
205
201
206
202
The `install` job below uses the
207
203
[upload-artifact](https://github.com/marketplace/actions/upload-a-build-artifact)
208
- action and will save the state of the `build` directory for the worker jobs.
204
+ action and saves the state of the `build` directory for the `cypress-run` worker
205
+ job.
206
+
207
+ The
208
+ [download-artifact](https://github.com/marketplace/actions/download-a-build-artifact)
209
+ action retrieves the `build` directory saved in the `install` job, as seen below
210
+ in the `cypress-run` worker job.
209
211
210
212
` ` ` yaml
211
- name: Cypress Tests with installation job
213
+ name: Cypress Tests with Dependency and Artifact Caching
212
214
213
215
on: push
214
216
215
217
jobs:
216
218
install:
217
219
runs-on: ubuntu-22.04
218
- container: cypress/browsers:node12.18.3-chrome87-ff82
219
220
steps:
220
221
- name: Checkout
221
222
uses: actions/checkout@v3
222
223
223
- - name: Save build folder
224
- uses: actions/upload-artifact@v3
225
- with:
226
- name: build
227
- if-no-files-found: error
228
- path: build
229
-
230
224
- name: Cypress install
231
225
uses: cypress-io/github-action@v5
232
226
with:
233
227
# Disable running of tests within install job
234
228
runTests: false
235
- build: yarn build
236
- ` ` `
237
-
238
- The
239
- [download-artifact](https://github.com/marketplace/actions/download-a-build-artifact)
240
- action will retrieve the `build` directory saved in the install job, as seen
241
- below in a worker job.
242
-
243
- ` ` ` yaml
244
- name: Cypress Tests with Dependency and Artifact Caching
229
+ build: npm run build
245
230
246
- on: push
231
+ - name: Save build folder
232
+ uses: actions/upload-artifact@v3
233
+ with:
234
+ name: build
235
+ if-no-files-found: error
236
+ path: build
247
237
248
- jobs:
249
- # install:
250
- # ....
251
238
cypress-run:
252
239
runs-on: ubuntu-22.04
253
- container: cypress/browsers:node12.18.3-chrome87-ff82
240
+ needs: install
254
241
steps:
255
242
- name: Checkout
256
243
uses: actions/checkout@v3
257
244
258
- - name: Download the build folders
245
+ - name: Download the build folder
259
246
uses: actions/download-artifact@v3
260
247
with:
261
248
name: build
262
249
path: build
263
250
264
- # Install NPM dependencies, cache them correctly
265
- # and run all Cypress tests
266
251
- name: Cypress run
267
252
uses: cypress-io/github-action@v5
268
253
with:
269
- # Specify Browser since container image is compiled with Firefox
270
- browser: firefox
271
- build: yarn build
254
+ start: npm start
255
+ browser: chrome
272
256
` ` `
273
257
274
258
# # Parallelization
0 commit comments