Benefits of using Cypress in GitHub actions

If you work with anything related to frontend and you haven’t tried Cypress yet, I highly suggest you give it a try.

But, if you use Cypress and don’t have a CI/CD pipeline set up yet, read forward for the reasons why using GitHub actions for it might be valuable.

GitHub actions

The docs say:

Automate, customize, and execute your software development workflows right in your repository with GitHub Actions.

Cypress GitHub action – installation

Read these:

Benefits of integration

Prevention of merging broken code into the target branch

By leveraging code status checks of GitHub, there is the potential to list run Cypress checks and block PR merge if all checks are not passing.

Software stability

  • as the status checks prevent the merging of broken code, there is potentially a greater awareness across the development team towards software quality and stability
  • another potential outcome is that the team will write more (and meaningful) tests because they see how much their code and tests have an impact on the complete codebase

 

Tracking code coverage

 

Easier onboarding of new developers to project standards

If a new team member has not used Cypress before, they will potentially see the value of tests sooner if they’re visible in the CI and they’re not required to be run manually.

Developer’s ownership of CI/CD

  • in some organizations, CI/CD pipelines are the responsibility of the DevOps team
  • delegating some complex pipelines or asking help from the DevOps team is great for collaboration, but it’s also a really valuable skill to know how to set up the basic CI/CD flows
  • I personally think this is really important because the developer can then tweak the CI/CD pipeline to the project’s needs and potentially easily experiment with new features of relevant technologies on the projects (e.g. Cypress GitHub actions)

Summary

This post focuses (on very high level) on the integration of Cypress and GitHub actions, but can easily be applied to other testing frameworks such as Jest and other CI/CD services such as CircleCI or TravisCI. I personally found it very convenient to use it with GitHub actions because it’s baked in the GitHub itself, but you can freely use other services that support this kind of automated flows.