Skip to content

test: use short-form cypress/browsers tag (#1318) #2766

test: use short-form cypress/browsers tag (#1318)

test: use short-form cypress/browsers tag (#1318) #2766

name: example-recording
#
# To set up this workflow to work with your own Cypress Cloud project
# refer to the README in the example directory examples/recording.
#
on:
push:
branches:
- 'master'
pull_request:
workflow_dispatch:
env:
# Set up the Cypress Cloud project ID and record key as environment variables
# If the Actions secret EXAMPLE_PROJECT_ID is not defined then
# the projectId is taken from cypress.json (v9) or cypress.config.js (v10 and later).
# If the Actions secret EXAMPLE_RECORDING_KEY is not defined then recording jobs are skipped.
CYPRESS_PROJECT_ID: ${{ secrets.EXAMPLE_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.EXAMPLE_RECORDING_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
check-record-key:
runs-on: ubuntu-24.04
outputs:
record-key-exists: ${{ steps.record-key-check.outputs.defined }}
steps:
- name: Check for record key
id: record-key-check
run: |
if [ "${{ secrets.EXAMPLE_RECORDING_KEY }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
parallel:
runs-on: ubuntu-24.04
needs: [check-record-key]
strategy:
fail-fast: false
matrix:
# run copies of the current job in parallel
containers: [1, 2]
if: needs.check-record-key.outputs.record-key-exists == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress tests
# normally you would write
# uses: cypress-io/github-action@v6
uses: ./
# let's give this action an ID so we can refer
# to its output values later
id: cypress
with:
working-directory: examples/recording
record: true
parallel: true
group: Recording example
tag: action
# see "outcome" and "conclusion" of a step doc
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context
# "output" can be success, failure, cancelled, or skipped
- name: Print Cypress Cloud URL
if: always()
run: |
echo Cypress finished with: ${{ steps.cypress.outcome }}
echo See results at ${{ steps.cypress.outputs.resultsUrl }}
group:
runs-on: ubuntu-24.04
needs: [check-record-key]
if: needs.check-record-key.outputs.record-key-exists == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress tests
# normally you would write
# uses: cypress-io/github-action@v6
uses: ./
with:
working-directory: examples/recording
record: true
# no parallel flag, just the group name
group: Recording group