forked from bahmutov/cypress-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
209 lines (204 loc) · 6.79 KB
/
standard.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# This is a reusable workflow that checks out the source code,
# installs dependencies and runs Cypress tests on a single machine
# https://docs.github.com/en/actions/learn-github-actions/reusing-workflows
name: standard
on:
workflow_call:
inputs:
# most parameters are just copied from the Cypress GH Action
# https://github.com/cypress-io/github-action/blob/master/action.yml
record:
description: 'Sends test results to Cypress Dashboard'
type: boolean
required: false
default: false
config:
description: 'Set configuration values. Separate multiple values with a comma. The values set here override any values set in your configuration file.'
type: string
required: false
config-file:
description: 'Path to a JSON file where configuration values are set.'
type: string
required: false
env:
description: 'Sets Cypress environment variables'
type: string
required: false
browser:
description: 'Name of the browser to use'
type: string
required: false
command:
description: 'Command that overrides cypress run'
type: string
required: false
start:
description: 'Command for starting local server in the background'
type: string
required: false
start-windows:
description: 'A different start command on Windows'
type: string
required: false
build:
description: 'Command to run in build step before starting tests'
type: string
required: false
install:
description: 'Whether or not to run install'
type: boolean
required: false
default: true
install-command:
description: 'Custom install command to use'
type: string
required: false
runTests:
description: 'Whether or not to run tests'
type: boolean
required: false
default: true
wait-on:
description: 'Local server URL to wait for'
type: string
required: false
wait-on-timeout:
description: 'Amount of time to wait for wait-on url to be available'
type: number
required: false
# default is 60 seconds
default: 60
parallel:
description: 'Whether or not to load balance tests using multiple containers'
type: boolean
required: false
group:
description: 'Group setting for tests'
type: string
required: false
tag:
description: 'Tag setting for tests'
type: string
required: false
working-directory:
description: 'Working directory containing Cypress folder'
type: string
required: false
headed:
description: 'Whether or not to use the headed mode'
type: boolean
required: false
spec:
description: 'Provide a specific specs to run'
type: string
required: false
project:
description: 'Path of project to run'
type: string
required: false
command-prefix:
description: 'You can prefix the default test command using the command-prefix option.'
type: string
required: false
ci-build-id:
description: 'ID associates multiple CI machines to one test run'
type: string
required: false
cache-key:
description: 'Custom cache key'
type: string
required: false
quiet:
description: 'Whether or not to silence any Cypress specific output from stdout'
type: boolean
required: false
default: false
debug-inputs:
description: 'Print the workflow inputs'
type: boolean
required: false
default: false
debug:
description: 'Set the environment variable DEBUG'
type: string
required: false
default: ''
store-artifacts:
description: 'Store screenshots and videos from the cypress folder'
type: boolean
required: false
default: true
component:
description: 'Run the component tests, skipping end-to-end tests'
type: boolean
required: false
default: false
publish-summary:
description: 'Whether or not to publish job summary'
type: boolean
required: false
default: true
secrets:
recordKey:
description: 'Cypress Dashboard Record Key'
required: false
jobs:
standard:
runs-on: ubuntu-20.04
steps:
- name: Debug inputs 🐞
if: ${{ inputs.debug-inputs }}
env:
WORKFLOW_INPUTS: ${{ toJson(inputs) }}
run: echo "$WORKFLOW_INPUTS"
- name: Checkout 🛎
uses: actions/checkout@v3
- name: Cypress tests 🧪
# https://github.com/cypress-io/github-action
uses: cypress-io/github-action@v5
with:
record: ${{ inputs.record }}
config: ${{ inputs.config }}
config-file: ${{ inputs.config-file }}
env: '${{ inputs.env }}'
browser: ${{ inputs.browser }}
command: ${{ inputs.command }}
start: ${{ inputs.start }}
start-windows: ${{ inputs.start-windows }}
build: ${{ inputs.build }}
install: ${{ inputs.install }}
install-command: ${{ inputs.install-command }}
runTests: ${{ inputs.runTests }}
wait-on: ${{ inputs.wait-on }}
wait-on-timeout: ${{ inputs.wait-on-timeout }}
parallel: ${{ inputs.parallel }}
group: ${{ inputs.group }}
tag: ${{ inputs.tag }}
working-directory: ${{ inputs.working-directory }}
headed: ${{ inputs.headed }}
spec: ${{ inputs.spec }}
project: ${{ inputs.project }}
command-prefix: ${{ inputs.command-prefix }}
ci-build-id: ${{ inputs.ci-build-id }}
cache-key: ${{ inputs.cache-key }}
quiet: ${{ inputs.quiet }}
component: ${{ inputs.component }}
publish-summary: ${{ inputs.publish-summary }}
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.recordKey }}
# pass the DEBUG environment variable
DEBUG: ${{ inputs.debug }}
# capture screenshots, videos, Mochawesome reports
# in a single test artifact so that relative paths work
# capture screenshots, videos, Mochawesome reports
# https://github.com/actions/upload-artifact
- uses: actions/upload-artifact@v3
if: ${{ inputs.store-artifacts && always() }}
with:
name: cypress-results
path: |
cypress/screenshots
cypress/videos
cypress/results
if-no-files-found: ignore