-
Notifications
You must be signed in to change notification settings - Fork 347
90 lines (82 loc) · 2.78 KB
/
example-recording.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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