Recently GitHub Actions CI service has introduced Reusable workflows which are ... amazing. You can create a workflow with multiple jobs and abstract all the testing details, and then call that workflow from another user workflow, passing inputs as parameters. Here is the entire workflow for installing NPM dependencies, caching them, then running Cypress tests in parallel across 3 machines using Cypress Dashboard parallelization:
1 | name: ci |
That is it - the reusable public workflow parallel.yml is versioned too, so you know what parameter is expects.
You can find my public Cypress workflows in the repo bahmutov/cypress-workflows and the example application in bahmutov/cypress-workflows-example
No more worrying about the specifics of installing and calling a testing tool, no more frustration. Just a single logical call to the workflow that takes care of the details. Truly the simplest way to write CI scripts today, I ❤️ it.
Bonus: check out my open source workshop Cypress on CI that explains how to run Cypress on a regular CI, using GitHub Actions, CircleCI, and Netlify Build.
Here is another example from bahmutov/cypress-3rd-party-script-example: let's say we deploy a site to GitHub Pages, and now want to run the local tests first before the deploy. We just add one more job with 3 lines of YML code:
1 | name: deploy |
So so simple, it hurts.