Cypress - GitHub Actions
Using GitHub Actions Matrix for parallelizing Cypress tests

Last updated
Was this helpful?
Was this helpful?
name: Cypress Tests
on:
push:
jobs:
cypress-tests:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
# 👉🏻 run 3 copies of the current job in parallel
containers: [1, 2, 3]
steps:
- name: Checkout
uses: actions/checkout@v3
# 👉🏻 populate commit message for merge commits
# see https://currents.dev/readme/ci-setup/github-actions
# with:
# ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: |
npm ci
# More about the blocking:
# - https://currents.dev/posts/v13-blocking
# - https://currents.dev/readme/integration-with-cypress/alternative-cypress-binaries
- name: Unblock Cypress
run: |
echo 🕊️ Download Free Cypress
CYPRESS_DOWNLOAD_MIRROR=https://cy-cdn.currents.dev 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 Currents.dev
env:
# enable verbose logging for cypress-io/github-action
DEBUG: \@cypress/github-action
uses: cypress-io/github-action@v6
continue-on-error: true
with:
# 🔥 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
with:
api-token: ${{ secrets.CURRENTS_API_KEY }}
github-run-id: ${{ github.run_id }}
github-run-attempt: ${{ github.run_attempt }}