This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
Cypress Tests #2564
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cypress Tests | |
on: [deployment_status] | |
jobs: | |
cypress-percy: | |
# Sender id is Vercel's | |
if: github.event.deployment_status.state == 'success' && github.event.sender.id == 35613825 | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
containers: [1, 2, 3] | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v1 | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
# Get the branch name from the commit SHA | |
- name: Set branch name | |
run: echo "BRANCH=$(git name-rev --name-only $GITHUB_SHA | awk -F / '{print $3}')" >> $GITHUB_ENV | |
- name: Run Cypress 🌲 | |
uses: cypress-io/github-action@v2 | |
with: | |
browser: chrome | |
headless: true | |
record: true | |
parallel: true | |
group: 'GitHub Actions' | |
command-prefix: '@percy/cli exec -t 500 -- npx' | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# Pass the Vercel reported environment (Preview or Production) through to Cypress | |
# This is used for conditional tests: enterpriseTrials.spec.js and salesFormPage.spec.js | |
CYPRESS_DEPLOY_ENVIRONMENT: ${{ github.event.deployment.environment }} | |
# We pass the gh token to allow Cypress to detect re-runs accurately. | |
# See https://github.com/cypress-io/github-action | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} | |
CYPRESS_BASE_URL: ${{ github.event.deployment_status.target_url }} | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | |
PERCY_TARGET_BRANCH: 'master' | |
# Use the branch name set in the 'Set branch name' job above | |
PERCY_BRANCH: ${{ env.BRANCH }} | |
COMMIT_INFO_BRANCH: ${{ env.BRANCH }} | |
# Should match the total in matrix:containers | |
PERCY_PARALLEL_TOTAL: 3 | |
PERCY_PARALLEL_NONCE: '${{ github.event_name }}-${{ github.sha }}' |