Cypress - GitHub Actions

Using GitHub Actions Matrix for parallelizing Cypress tests

TL;DR Check out the GitHub repository:

By using GitHub Actions matrix execution strategy, you can create multiple containers that will run Cypress tests in parallel. Currents orchestrates the tests between multiple containers, applying intelligent optimizations to reduce the overall runtime of your workflow, and records screenshots and videos for later troubleshooting.

Please take a look at the example repository that showcases running cypress tests in parallel using GitHub Actions.

name: Cypress Tests


    runs-on: ubuntu-20.04
      fail-fast: false
        # 👉🏻 run 3 copies of the current job in parallel
        containers: [1, 2, 3]
      - name: Checkout
        uses: actions/checkout@v3
        # 👉🏻  populate commit message for merge commits
        # see
        # with:
        #  ref: ${{ github.event.pull_request.head.sha }}

      - uses: actions/setup-node@v3
          node-version: 18

      - name: Install dependencies
        run: |
          npm ci

      # More about the blocking:
      # -
      # -
      - name: Unblock Cypress
        run: |
          echo 🕊️ Download Free Cypress
          CYPRESS_DOWNLOAD_MIRROR= npx cypress install --force

          echo ✅ Verify Cypress
          npx cypress verify

          echo 👀 Cypress Cache
          npx cypress cache list
          npx cypress cache path

      - name: Run Cypress on
          # enable verbose logging for cypress-io/github-action
          DEBUG: \@cypress/github-action
        uses: cypress-io/github-action@v6
        continue-on-error: true

          # 🔥 Set to false to prevent restoring cachedCypress binary
          install: false
          command: |
            npx cypress-cloud --record --parallel --browser chrome --key ${{ secrets.CURRENTS_RECORD_KEY }} --ci-build-id "${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt}}"

      - name: Cancel the run if workflow is cancelled
        if: ${{ cancelled() }}
        uses: currents-dev/cancel-run-gh-action@v1
          api-token: ${{ secrets.CURRENTS_API_KEY }}
          github-run-id: ${{ github.run_id }}
          github-run-attempt: ${{ github.run_attempt }}

The example workflow config file:

  • runs 3 containers with cypress tests in parallel

  • uses Custom Test Command to run cypress-cloud for recording test results and parallelization with

  • Note: set the projectId in currents.config.js (you can obtain the project id from in Project Settings)

  • Note: install cypress-cloud/plugin in cypress.config.js

  • Note: use CLI arguments to customize your cypress runs, e.g.: cypress-cloud run --parallel --record --key <your key> --group groupA

  • Note: create an organization, get your record key on and set GH secret variable CURRENTS_RECORD_KEY

Here's an example of how the demo workflow appears in Currents dashboard

Last updated