@@ -189,86 +189,70 @@ jobs:
189189
190190# # Caching Dependencies and Build Artifacts
191191
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-
198192:::info
199193
200194Caching 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
202198[Upload/Download Artifact Actions](https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts).
203199
204200:: :
205201
206202The `install` job below uses the
207203[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.
209211
210212` ` ` yaml
211- name: Cypress Tests with installation job
213+ name: Cypress Tests with Dependency and Artifact Caching
212214
213215on: push
214216
215217jobs:
216218 install:
217219 runs-on: ubuntu-22.04
218- container: cypress/browsers:node12.18.3-chrome87-ff82
219220 steps:
220221 - name: Checkout
221222 uses: actions/checkout@v3
222223
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-
230224 - name: Cypress install
231225 uses: cypress-io/github-action@v5
232226 with:
233227 # Disable running of tests within install job
234228 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
245230
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
247237
248- jobs:
249- # install:
250- # ....
251238 cypress-run:
252239 runs-on: ubuntu-22.04
253- container: cypress/browsers:node12.18.3-chrome87-ff82
240+ needs: install
254241 steps:
255242 - name: Checkout
256243 uses: actions/checkout@v3
257244
258- - name: Download the build folders
245+ - name: Download the build folder
259246 uses: actions/download-artifact@v3
260247 with:
261248 name: build
262249 path: build
263250
264- # Install NPM dependencies, cache them correctly
265- # and run all Cypress tests
266251 - name: Cypress run
267252 uses: cypress-io/github-action@v5
268253 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
272256` ` `
273257
274258# # Parallelization
0 commit comments