@cypress/github-action 6.6.0 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +179 -113
- package/dist/index.js +4 -4
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
- Run only some [spec files](#specs)
|
|
22
22
|
- Test [project in subfolder](#project)
|
|
23
23
|
- [Record results](#record-test-results-on-cypress-cloud) on Cypress Cloud
|
|
24
|
+
- Storing the [Project ID and Record Key](#project-id-and-record-key)
|
|
25
|
+
- Getting [Git information](#git-information) environment variables
|
|
26
|
+
- Getting [PR and URL](#automatic-pr-number-and-url-detection) automatically
|
|
27
|
+
- Overwriting [Merge SHA into SHA](#merge-sha-into-sha) message
|
|
24
28
|
- Tag [recordings](#tag-recordings)
|
|
25
29
|
- Specify [auto cancel](#specify-auto-cancel-after-failures) after failures
|
|
26
30
|
- Store [test artifacts](#artifacts) on GitHub
|
|
@@ -42,6 +46,7 @@
|
|
|
42
46
|
- Use different [working-directory](#working-directory)
|
|
43
47
|
- Use [subfolders](#subfolders)
|
|
44
48
|
- Use [pnpm](#pnpm)
|
|
49
|
+
- Use [pnpm workspaces](#pnpm-workspaces)
|
|
45
50
|
- Use [Yarn Classic](#yarn-classic)
|
|
46
51
|
- Use [Yarn Modern](#yarn-modern)
|
|
47
52
|
- Use [Yarn Plug'n'Play](#yarn-plugnplay)
|
|
@@ -62,7 +67,7 @@ Examples contained in this repository, based on current Cypress versions, can be
|
|
|
62
67
|
|
|
63
68
|
Live examples, such as [example-basic.yml](.github/workflows/example-basic.yml) are shown together with a status badge. Click on the status badge to read the source code of the workflow, for example
|
|
64
69
|
|
|
65
|
-
[](.github/workflows/example-basic.yml)
|
|
66
71
|
|
|
67
72
|
Older **external** examples based on a [Legacy Configuration](https://on.cypress.io/guides/references/legacy-configuration) for Cypress `9` and earlier can be found in the [README](https://github.com/cypress-io/github-action/blob/v5/README.md) for version `v5`.
|
|
68
73
|
|
|
@@ -85,7 +90,7 @@ jobs:
|
|
|
85
90
|
uses: cypress-io/github-action@v6
|
|
86
91
|
```
|
|
87
92
|
|
|
88
|
-
[](.github/workflows/example-basic.yml)
|
|
89
94
|
|
|
90
95
|
The workflow file [example-basic.yml](.github/workflows/example-basic.yml) shows how Cypress runs on GH Actions using Ubuntu (20 and 22), Windows, and macOS without additional OS dependencies necessary.
|
|
91
96
|
|
|
@@ -96,7 +101,7 @@ This workflow uses the default [test type](https://on.cypress.io/guides/overview
|
|
|
96
101
|
To use [Cypress Component Testing](https://on.cypress.io/component-testing) add `component: true`
|
|
97
102
|
|
|
98
103
|
```yml
|
|
99
|
-
name:
|
|
104
|
+
name: Component tests
|
|
100
105
|
on: push
|
|
101
106
|
jobs:
|
|
102
107
|
cypress-run:
|
|
@@ -110,7 +115,7 @@ jobs:
|
|
|
110
115
|
component: true
|
|
111
116
|
```
|
|
112
117
|
|
|
113
|
-
[](.github/workflows/example-component-test.yml)
|
|
114
119
|
|
|
115
120
|
See the example project [component-tests](examples/component-tests/) and the [example-component-test.yml](.github/workflows/example-component-test.yml) workflow for more details.
|
|
116
121
|
|
|
@@ -134,7 +139,7 @@ Alternatively, to mitigate unforeseen breaks, bind to a specific [tag](https://g
|
|
|
134
139
|
uses: cypress-io/github-action@v6.1.0
|
|
135
140
|
```
|
|
136
141
|
|
|
137
|
-
The changes associated with each tag are shown under GitHub's [releases](https://github.com/cypress-io/github-action/releases) list. Refer also to the [
|
|
142
|
+
The changes associated with each tag are shown under GitHub's [releases](https://github.com/cypress-io/github-action/releases) list. Refer also to the [CHANGELOG](./CHANGELOG.md) for an overview of major changes.
|
|
138
143
|
|
|
139
144
|
### Browser
|
|
140
145
|
|
|
@@ -156,7 +161,7 @@ jobs:
|
|
|
156
161
|
browser: chrome
|
|
157
162
|
```
|
|
158
163
|
|
|
159
|
-
[](.github/workflows/example-chrome.yml)
|
|
160
165
|
|
|
161
166
|
### Firefox
|
|
162
167
|
|
|
@@ -174,7 +179,7 @@ jobs:
|
|
|
174
179
|
browser: firefox
|
|
175
180
|
```
|
|
176
181
|
|
|
177
|
-
[](.github/workflows/example-firefox.yml)
|
|
178
183
|
|
|
179
184
|
### Edge
|
|
180
185
|
|
|
@@ -192,7 +197,7 @@ jobs:
|
|
|
192
197
|
browser: edge
|
|
193
198
|
```
|
|
194
199
|
|
|
195
|
-
[](.github/workflows/example-edge.yml)
|
|
196
201
|
|
|
197
202
|
### Headed
|
|
198
203
|
|
|
@@ -240,7 +245,7 @@ Include `options: --user 1001` to avoid permissions issues.
|
|
|
240
245
|
|
|
241
246
|
Refer to [cypress-io/cypress-docker-images](https://github.com/cypress-io/cypress-docker-images) for further information about using Cypress Docker images. Cypress offers the [Cypress Docker Factory](https://github.com/cypress-io/cypress-docker-images/tree/master/factory) to generate additional Docker images with selected components and versions.
|
|
242
247
|
|
|
243
|
-
[](.github/workflows/example-docker.yml)
|
|
244
249
|
|
|
245
250
|
### Env
|
|
246
251
|
|
|
@@ -283,7 +288,7 @@ jobs:
|
|
|
283
288
|
|
|
284
289
|
For more examples, see the workflows below, using environment variables for [recording](#record-test-results-on-cypress-cloud).
|
|
285
290
|
|
|
286
|
-
[](.github/workflows/example-env.yml)
|
|
287
292
|
|
|
288
293
|
### Specs
|
|
289
294
|
|
|
@@ -342,6 +347,8 @@ For more information, visit [the Cypress command-line docs](https://on.cypress.i
|
|
|
342
347
|
|
|
343
348
|
By setting the parameter `record` to `true`, you can record your test results into the [Cypress Cloud](https://on.cypress.io/cloud). Read the [Cypress Cloud documentation](https://on.cypress.io/guides/cloud/introduction) to learn how to sign up and create a Cypress Cloud project.
|
|
344
349
|
|
|
350
|
+
We recommend passing the `GITHUB_TOKEN` secret (created by the GH Action automatically) as an environment variable. This will allow correctly identifying every build and avoid confusion when re-running a build.
|
|
351
|
+
|
|
345
352
|
```yml
|
|
346
353
|
name: Cypress tests
|
|
347
354
|
on: push
|
|
@@ -358,21 +365,17 @@ jobs:
|
|
|
358
365
|
with:
|
|
359
366
|
record: true
|
|
360
367
|
env:
|
|
361
|
-
# pass the Cypress Cloud record key as an environment variable
|
|
362
|
-
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
363
368
|
# pass GitHub token to allow accurately detecting a build vs a re-run build
|
|
364
369
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
365
370
|
```
|
|
366
371
|
|
|
367
|
-
[](.github/workflows/example-recording.yml)
|
|
370
373
|
|
|
371
|
-
|
|
374
|
+
### Project ID and Record Key
|
|
372
375
|
|
|
373
|
-
|
|
376
|
+
To record the project needs `projectId` and `recordKey`.
|
|
374
377
|
|
|
375
|
-
|
|
378
|
+
Typically, the `projectId` is stored in the [Cypress Configuration File](https://docs.cypress.io/guides/references/configuration#Configuration-File), while the `recordKey` is set as a [CLI parameter](https://docs.cypress.io/guides/guides/command-line#cypress-run-record-key-lt-record-key-gt). If you want to avoid this, both the `projectId` and `recordKey` can be provided as environment variables using [GitHub secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).
|
|
376
379
|
|
|
377
380
|
```yml
|
|
378
381
|
name: Cypress tests
|
|
@@ -392,12 +395,107 @@ jobs:
|
|
|
392
395
|
env:
|
|
393
396
|
# pass the Cypress Cloud record key as an environment variable
|
|
394
397
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
395
|
-
# pass GitHub token to allow accurately detecting a build vs a re-run build
|
|
396
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
397
398
|
# pass the project ID from the secrets through environment variable
|
|
398
399
|
CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }}
|
|
399
400
|
```
|
|
400
401
|
|
|
402
|
+
### Git information
|
|
403
|
+
|
|
404
|
+
Cypress uses the [@cypress/commit-info](https://github.com/cypress-io/commit-info) package to associate Git details (branch, commit message, author) with each run. It typically uses Git commands, expecting a .git folder. In Docker or similar environments where .git is absent, or if you need different data in the Cypress Cloud, Git information can be passed via custom environment variables.
|
|
405
|
+
|
|
406
|
+
```yml
|
|
407
|
+
name: Cypress tests
|
|
408
|
+
on: push
|
|
409
|
+
jobs:
|
|
410
|
+
cypress-run:
|
|
411
|
+
name: Cypress run
|
|
412
|
+
runs-on: ubuntu-22.04
|
|
413
|
+
steps:
|
|
414
|
+
- name: Checkout
|
|
415
|
+
uses: actions/checkout@v4
|
|
416
|
+
|
|
417
|
+
- name: Cypress run
|
|
418
|
+
uses: cypress-io/github-action@v6
|
|
419
|
+
with:
|
|
420
|
+
record: true
|
|
421
|
+
env:
|
|
422
|
+
# Get the short ref name of the branch that triggered the workflow run
|
|
423
|
+
COMMIT_INFO_BRANCH: ${{ github.ref_name }}
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Please refer to the [Cypress Cloud Git information environment variables](https://on.cypress.io/guides/continuous-integration/introduction#Git-information) section in our documentation for more examples.
|
|
427
|
+
|
|
428
|
+
Please refer to the [default GitHub environment variables](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) for additional GitHub examples.
|
|
429
|
+
|
|
430
|
+
### Automatic PR number and URL detection
|
|
431
|
+
|
|
432
|
+
When recording runs to Cypress Cloud, the PR number and URL can be automatically detected if you pass `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`
|
|
433
|
+
via the workflow `env`. When set, this value enables the Action to perform additional logic that grabs the related PR number and URL (if they
|
|
434
|
+
exist) and sets them in the environment variables `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
|
|
435
|
+
* See Cypress' documentation on [CI Build Information](https://on.cypress.io/guides/continuous-integration/introduction#CI-Build-Information)
|
|
436
|
+
|
|
437
|
+
Example workflow using the variables:
|
|
438
|
+
```yml
|
|
439
|
+
name: Example echo PR number and URL
|
|
440
|
+
on: push
|
|
441
|
+
jobs:
|
|
442
|
+
cypress-run:
|
|
443
|
+
runs-on: ubuntu-22.04
|
|
444
|
+
steps:
|
|
445
|
+
- name: Checkout
|
|
446
|
+
uses: actions/checkout@v4
|
|
447
|
+
- name: Cypress run
|
|
448
|
+
uses: cypress-io/github-action@v6
|
|
449
|
+
with:
|
|
450
|
+
record: true
|
|
451
|
+
- run: echo "PR number is $CYPRESS_PULL_REQUEST_ID"
|
|
452
|
+
- run: echo "PR URL is $CYPRESS_PULL_REQUEST_URL"
|
|
453
|
+
env:
|
|
454
|
+
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
455
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
#### Triggering event: `pull_request`/`pull_request_target`
|
|
459
|
+
|
|
460
|
+
For either of these events, we set `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL` to that of the PR number and URL, respectively, of the
|
|
461
|
+
PR that triggered the workflow.
|
|
462
|
+
|
|
463
|
+
#### Triggering event: `push`
|
|
464
|
+
|
|
465
|
+
When a commit on a branch without a PR is made, the Cypress GitHub Action checks to see if the commit that triggered the workflow has a
|
|
466
|
+
related PR. If the commit exists in any other PRs, it's considered a related PR. When there are related PRs, we grab the first related PR
|
|
467
|
+
and use that PR's number and URL for `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
|
|
468
|
+
|
|
469
|
+
If no related PR is detected, `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL` will be undefined.
|
|
470
|
+
|
|
471
|
+
### Merge SHA into SHA
|
|
472
|
+
|
|
473
|
+
We recommend using the action with `on: push` rather than `on: pull_request` or `on: merge_group` for more accurate commit information in Cypress Cloud. When running on pull_request or merge_group, the commit message defaults to "merge SHA into SHA". You can overwrite the commit message sent to Cypress Cloud by setting an environment variable.
|
|
474
|
+
|
|
475
|
+
```yml
|
|
476
|
+
name: Cypress tests
|
|
477
|
+
on: push
|
|
478
|
+
jobs:
|
|
479
|
+
cypress-run:
|
|
480
|
+
name: Cypress run
|
|
481
|
+
runs-on: ubuntu-22.04
|
|
482
|
+
steps:
|
|
483
|
+
- name: Checkout
|
|
484
|
+
uses: actions/checkout@v4
|
|
485
|
+
|
|
486
|
+
- name: Cypress run
|
|
487
|
+
uses: cypress-io/github-action@v6
|
|
488
|
+
with:
|
|
489
|
+
record: true
|
|
490
|
+
env:
|
|
491
|
+
# overwrite commit message sent to Cypress Cloud
|
|
492
|
+
COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}}
|
|
493
|
+
# re-enable PR comment bot
|
|
494
|
+
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}}
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
See [issue 124](https://github.com/cypress-io/github-action/issues/124#issuecomment-1076826988) for details.
|
|
498
|
+
|
|
401
499
|
### Tag recordings
|
|
402
500
|
|
|
403
501
|
You can pass a single or multiple tags when recording a run. For example
|
|
@@ -411,7 +509,7 @@ jobs:
|
|
|
411
509
|
# let's make sure our "app" works on several versions of Node
|
|
412
510
|
strategy:
|
|
413
511
|
matrix:
|
|
414
|
-
node: [18, 20,
|
|
512
|
+
node: [18, 20, 22]
|
|
415
513
|
name: E2E on Node v${{ matrix.node }}
|
|
416
514
|
steps:
|
|
417
515
|
- name: Setup Node
|
|
@@ -485,14 +583,14 @@ jobs:
|
|
|
485
583
|
- uses: actions/checkout@v4
|
|
486
584
|
- uses: cypress-io/github-action@v6
|
|
487
585
|
# after the test run completes store videos and any screenshots
|
|
488
|
-
- uses: actions/upload-artifact@
|
|
586
|
+
- uses: actions/upload-artifact@v4
|
|
489
587
|
# add the line below to store screenshots only on failures
|
|
490
588
|
# if: failure()
|
|
491
589
|
with:
|
|
492
590
|
name: cypress-screenshots
|
|
493
591
|
path: cypress/screenshots
|
|
494
592
|
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
|
|
495
|
-
- uses: actions/upload-artifact@
|
|
593
|
+
- uses: actions/upload-artifact@v4
|
|
496
594
|
with:
|
|
497
595
|
name: cypress-videos
|
|
498
596
|
path: cypress/videos
|
|
@@ -521,7 +619,7 @@ jobs:
|
|
|
521
619
|
quiet: true
|
|
522
620
|
```
|
|
523
621
|
|
|
524
|
-
[](.github/workflows/example-quiet.yml)
|
|
525
623
|
|
|
526
624
|
### Config
|
|
527
625
|
|
|
@@ -544,7 +642,7 @@ jobs:
|
|
|
544
642
|
config: pageLoadTimeout=100000,baseUrl=http://localhost:3000
|
|
545
643
|
```
|
|
546
644
|
|
|
547
|
-
[](.github/workflows/example-config.yml)
|
|
548
646
|
|
|
549
647
|
### Config File
|
|
550
648
|
|
|
@@ -567,7 +665,7 @@ jobs:
|
|
|
567
665
|
config-file: cypress.config-alternate.js
|
|
568
666
|
```
|
|
569
667
|
|
|
570
|
-
[](.github/workflows/example-config.yml)
|
|
571
669
|
|
|
572
670
|
### Parallel
|
|
573
671
|
|
|
@@ -613,9 +711,13 @@ jobs:
|
|
|
613
711
|
|
|
614
712
|

|
|
615
713
|
|
|
616
|
-
|
|
714
|
+
The Cypress GH Action does not spawn or create any additional containers - it only links the multiple containers spawned using the matrix strategy into a single logical Cypress Cloud run where it splits the specs amongst the machines. See the [Cypress Cloud Smart Orchestration](https://on.cypress.io/guides/cloud/smart-orchestration/) guide for a detailed explanation.
|
|
617
715
|
|
|
618
|
-
|
|
716
|
+
If you use the GitHub Actions facility for [Re-running workflows and jobs](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs), note that [Re-running failed jobs in a workflow](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs?tool=webui#re-running-failed-jobs-in-a-workflow) is not suited for use with parallel recording into Cypress Cloud. Re-running failed jobs in this situation does not simply re-run failed Cypress tests. Instead it re-runs **all** Cypress tests, load-balanced over the containers with failed jobs.
|
|
717
|
+
|
|
718
|
+
To optimize runs when there are failing tests present, refer to optional [Cypress Cloud Smart Orchestration](https://on.cypress.io/guides/cloud/smart-orchestration/) Premium features:
|
|
719
|
+
- [Spec Prioritization](https://on.cypress.io/guides/cloud/smart-orchestration/spec-prioritization)
|
|
720
|
+
- [Run Cancellation](https://docs.cypress.io/guides/cloud/smart-orchestration/run-cancellation). See also [Specify auto cancel after failures](#specify-auto-cancel-after-failures) for details of how to set this option in a Cypress GH Action workflow.
|
|
619
721
|
|
|
620
722
|
During staged rollout of a new GitHub-hosted runner version, GitHub may provide a mixture of current and new image versions used by the container matrix. It is recommended to use a [Docker image](#docker-image) in the parallel job run which avoids any Cypress Cloud errors due to browser major version mismatch from the two different image versions. A [Docker image](#docker-image) is not necessary if testing against the default built-in Electron browser because this browser version is fixed by the Cypress version in use and it is unaffected by any GitHub runner image rollout.
|
|
621
723
|
|
|
@@ -696,7 +798,7 @@ jobs:
|
|
|
696
798
|
start-windows: npm run start:windows:server
|
|
697
799
|
```
|
|
698
800
|
|
|
699
|
-
[](.github/workflows/example-start.yml)
|
|
700
802
|
|
|
701
803
|
**Note:** A server continues to run until the end of the GitHub workflow job that started it. At the end of the job the GitHub workflow runner executes a "Complete job" phase automatically where it terminates any server processes which are still running.
|
|
702
804
|
|
|
@@ -728,7 +830,7 @@ with:
|
|
|
728
830
|
npm run web
|
|
729
831
|
```
|
|
730
832
|
|
|
731
|
-
[](.github/workflows/example-start.yml)
|
|
732
834
|
|
|
733
835
|
### Wait-on
|
|
734
836
|
|
|
@@ -751,9 +853,9 @@ jobs:
|
|
|
751
853
|
wait-on: 'http://localhost:8080'
|
|
752
854
|
```
|
|
753
855
|
|
|
754
|
-
[](.github/workflows/example-wait-on.yml)
|
|
755
857
|
|
|
756
|
-
[](.github/workflows/example-webpack.yml) (also uses `wait-on`)
|
|
757
859
|
|
|
758
860
|
By default, `wait-on` will retry for 60 seconds. You can pass a custom timeout in seconds using `wait-on-timeout`.
|
|
759
861
|
|
|
@@ -1002,8 +1104,8 @@ jobs:
|
|
|
1002
1104
|
|
|
1003
1105
|
### pnpm
|
|
1004
1106
|
|
|
1005
|
-
The package manager `pnpm` is not pre-installed in [GitHub Actions runner images](https://github.com/actions/runner-images) (unlike `npm` and `yarn`)
|
|
1006
|
-
At this time the action does not automatically cache dependencies installed by pnpm.
|
|
1107
|
+
The package manager `pnpm` is not pre-installed in [GitHub Actions runner images](https://github.com/actions/runner-images) (unlike `npm` and `yarn`) and so it must be installed in a separate workflow step (see below). If the action finds a `pnpm-lock.yaml` file, it uses the [pnpm](https://pnpm.io/cli/install) command `pnpm install --frozen-lockfile` by default to install dependencies.
|
|
1108
|
+
At this time, the action does not automatically cache dependencies installed by pnpm. We advise against attempting to work around this restriction, by caching the pnpm store directory through additional workflow steps, as this can lead to the action skipping installation of the Cypress binary, causing workflow failure.
|
|
1007
1109
|
|
|
1008
1110
|
```yaml
|
|
1009
1111
|
name: example-basic-pnpm
|
|
@@ -1015,27 +1117,38 @@ jobs:
|
|
|
1015
1117
|
- name: Checkout
|
|
1016
1118
|
uses: actions/checkout@v4
|
|
1017
1119
|
- name: Install pnpm
|
|
1018
|
-
|
|
1019
|
-
with:
|
|
1020
|
-
version: 8
|
|
1021
|
-
- name: Get pnpm store directory
|
|
1022
|
-
shell: bash
|
|
1023
|
-
run: |
|
|
1024
|
-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
1025
|
-
- name: Setup pnpm cache
|
|
1026
|
-
uses: actions/cache@v3
|
|
1027
|
-
with:
|
|
1028
|
-
path: ${{ env.STORE_PATH }}
|
|
1029
|
-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }}
|
|
1030
|
-
restore-keys: |
|
|
1031
|
-
${{ runner.os }}-pnpm-store-
|
|
1120
|
+
run: npm install -g pnpm@9
|
|
1032
1121
|
- name: Cypress run
|
|
1033
1122
|
uses: cypress-io/github-action@v6
|
|
1034
1123
|
with:
|
|
1035
1124
|
working-directory: examples/basic-pnpm
|
|
1036
1125
|
```
|
|
1037
1126
|
|
|
1038
|
-
[](.github/workflows/example-basic-pnpm.yml)
|
|
1128
|
+
|
|
1129
|
+
### pnpm workspaces
|
|
1130
|
+
|
|
1131
|
+
If you are using [pnpm workspaces](https://pnpm.io/workspaces) you need to install dependencies and run Cypress tests in a workspace in separate steps. The snippet below shows this principle.
|
|
1132
|
+
|
|
1133
|
+
```yml
|
|
1134
|
+
...
|
|
1135
|
+
- name: Install dependencies
|
|
1136
|
+
uses: cypress-io/github-action@v6
|
|
1137
|
+
with:
|
|
1138
|
+
working-directory: examples/start-and-pnpm-workspaces
|
|
1139
|
+
runTests: false
|
|
1140
|
+
|
|
1141
|
+
- name: Cypress test
|
|
1142
|
+
uses: cypress-io/github-action@v6
|
|
1143
|
+
with:
|
|
1144
|
+
install: false
|
|
1145
|
+
working-directory: examples/start-and-pnpm-workspaces/packages/workspace-1
|
|
1146
|
+
...
|
|
1147
|
+
```
|
|
1148
|
+
|
|
1149
|
+
[](.github/workflows/example-start-and-pnpm-workspaces.yml)
|
|
1150
|
+
|
|
1151
|
+
See the example project [start-and-pnpm-workspaces](examples/start-and-pnpm-workspaces/) and the [example-start-and-pnpm-workspaces.yml](.github/workflows/example-start-and-pnpm-workspaces.yml) workflow for a full working example including pnpm caching.
|
|
1039
1152
|
|
|
1040
1153
|
### Yarn Classic
|
|
1041
1154
|
|
|
@@ -1056,7 +1169,7 @@ jobs:
|
|
|
1056
1169
|
working-directory: examples/yarn-classic
|
|
1057
1170
|
```
|
|
1058
1171
|
|
|
1059
|
-
[](.github/workflows/example-yarn-classic.yml)
|
|
1060
1173
|
|
|
1061
1174
|
### Yarn Modern
|
|
1062
1175
|
|
|
@@ -1081,7 +1194,7 @@ jobs:
|
|
|
1081
1194
|
This example covers the [`.yarnrc.yml`](https://yarnpkg.com/configuration/yarnrc#nodeLinker) configuration `nodeLinker: node-modules` which Yarn uses by default for projects updated from Yarn Classic. For `nodeLinker: pnp` see [Yarn Plug'n'Play](#yarn-plugnplay) below.
|
|
1082
1195
|
(Note that `github-action` is not compatible with the `nodeLinker: pnpm` setting.)
|
|
1083
1196
|
|
|
1084
|
-
[](.github/workflows/example-yarn-modern.yml)
|
|
1085
1198
|
|
|
1086
1199
|
### Yarn Plug'n'Play
|
|
1087
1200
|
|
|
@@ -1106,7 +1219,7 @@ jobs:
|
|
|
1106
1219
|
|
|
1107
1220
|
This example covers the [`.yarnrc.yml`](https://yarnpkg.com/configuration/yarnrc#nodeLinker) configuration when `nodeLinker` is undefined or set to `nodeLinker: pnp` corresponding to Yarn Plug'n'Play. Yarn uses this by default for projects newly created with Yarn Modern.
|
|
1108
1221
|
|
|
1109
|
-
[](https://github.com/cypress-io/github-action/actions/workflows/example-yarn-modern-pnp.yml)
|
|
1110
1223
|
|
|
1111
1224
|
**Caution**: using the action parameter `command` causes multiple other parameters to be ignored. [See `command` section for more information.](#custom-test-command)
|
|
1112
1225
|
|
|
@@ -1133,7 +1246,7 @@ jobs:
|
|
|
1133
1246
|
wait-on: 'http://localhost:5000'
|
|
1134
1247
|
```
|
|
1135
1248
|
|
|
1136
|
-
[](.github/workflows/example-start-and-yarn-workspaces.yml)
|
|
1137
1250
|
|
|
1138
1251
|
### Custom cache key
|
|
1139
1252
|
|
|
@@ -1148,7 +1261,7 @@ jobs:
|
|
|
1148
1261
|
# let's make sure our "app" works on several versions of Node
|
|
1149
1262
|
strategy:
|
|
1150
1263
|
matrix:
|
|
1151
|
-
node: [18, 20,
|
|
1264
|
+
node: [18, 20, 22]
|
|
1152
1265
|
name: E2E on Node v${{ matrix.node }}
|
|
1153
1266
|
steps:
|
|
1154
1267
|
- name: Setup Node
|
|
@@ -1182,7 +1295,7 @@ jobs:
|
|
|
1182
1295
|
runs-on: ubuntu-22.04
|
|
1183
1296
|
strategy:
|
|
1184
1297
|
matrix:
|
|
1185
|
-
node: [18, 20,
|
|
1298
|
+
node: [18, 20, 22]
|
|
1186
1299
|
name: E2E on Node v${{ matrix.node }}
|
|
1187
1300
|
steps:
|
|
1188
1301
|
- uses: actions/setup-node@v4
|
|
@@ -1194,7 +1307,7 @@ jobs:
|
|
|
1194
1307
|
|
|
1195
1308
|
See the [Node.js](#nodejs) section for information about supported versions and usage of Node.js.
|
|
1196
1309
|
|
|
1197
|
-
[](.github/workflows/example-node-versions.yml)
|
|
1198
1311
|
|
|
1199
1312
|
### Split install and tests
|
|
1200
1313
|
|
|
@@ -1235,7 +1348,7 @@ If the project has many dependencies, but you want to install just Cypress you c
|
|
|
1235
1348
|
|
|
1236
1349
|
```yml
|
|
1237
1350
|
- uses: actions/checkout@v4
|
|
1238
|
-
- uses: actions/cache@
|
|
1351
|
+
- uses: actions/cache@v4
|
|
1239
1352
|
with:
|
|
1240
1353
|
path: |
|
|
1241
1354
|
~/.cache/Cypress
|
|
@@ -1247,7 +1360,7 @@ If the project has many dependencies, but you want to install just Cypress you c
|
|
|
1247
1360
|
install: false
|
|
1248
1361
|
```
|
|
1249
1362
|
|
|
1250
|
-
[](.github/workflows/example-install-only.yml)
|
|
1251
1364
|
|
|
1252
1365
|
### Timeouts
|
|
1253
1366
|
|
|
@@ -1370,14 +1483,12 @@ This is an example of using the step output `resultsUrl`:
|
|
|
1370
1483
|
# let's give this action an ID so we can refer
|
|
1371
1484
|
# to its output values later
|
|
1372
1485
|
id: cypress
|
|
1373
|
-
# Continue the build in case of an error, as we need to set the
|
|
1374
|
-
# commit status in the next step, both in case of success or failure
|
|
1375
|
-
continue-on-error: true
|
|
1376
1486
|
with:
|
|
1377
1487
|
record: true
|
|
1378
1488
|
env:
|
|
1379
1489
|
CYPRESS_RECORD_KEY: ${{ secrets.RECORDING_KEY }}
|
|
1380
1490
|
- name: Print Cypress Cloud URL
|
|
1491
|
+
if: always()
|
|
1381
1492
|
run: |
|
|
1382
1493
|
echo Cypress finished with: ${{ steps.cypress.outcome }}
|
|
1383
1494
|
echo See results at ${{ steps.cypress.outputs.resultsUrl }}
|
|
@@ -1385,7 +1496,7 @@ This is an example of using the step output `resultsUrl`:
|
|
|
1385
1496
|
|
|
1386
1497
|
The GitHub step output `dashboardUrl` is deprecated. Cypress Dashboard is now [Cypress Cloud](https://on.cypress.io/cloud-introduction).
|
|
1387
1498
|
|
|
1388
|
-
[](.github/workflows/example-recording.yml)
|
|
1389
1500
|
|
|
1390
1501
|
**Note:** every GitHub workflow step can have `outcome` and `conclusion` properties. See the GitHub [Contexts](https://docs.github.com/en/actions/learn-github-actions/contexts) documentation section [steps context](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context). In particular, the `outcome` or `conclusion` value can be `success`, `failure`, `cancelled`, or `skipped` which you can use in any following steps.
|
|
1391
1502
|
|
|
@@ -1456,7 +1567,7 @@ jobs:
|
|
|
1456
1567
|
uses: cypress-io/github-action@v6
|
|
1457
1568
|
```
|
|
1458
1569
|
|
|
1459
|
-
[](.github/workflows/example-cron.yml)
|
|
1460
1571
|
|
|
1461
1572
|
### Job summary title
|
|
1462
1573
|
|
|
@@ -1507,55 +1618,13 @@ jobs:
|
|
|
1507
1618
|
publish-summary: false
|
|
1508
1619
|
```
|
|
1509
1620
|
|
|
1510
|
-
### Automatic PR number & URL detection
|
|
1511
|
-
|
|
1512
|
-
When recording runs to Cypress Cloud, the PR number and URL can be automatically detected if you pass `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`
|
|
1513
|
-
via the workflow `env`. When set, this value enables the Action to perform additional logic that grabs the related PR number and URL (if they
|
|
1514
|
-
exist) and sets them in the environment variables `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
|
|
1515
|
-
* See Cypress' documentation on [CI Build Information](https://on.cypress.io/guides/continuous-integration/introduction#CI-Build-Information)
|
|
1516
|
-
|
|
1517
|
-
Example workflow using the variables:
|
|
1518
|
-
```yml
|
|
1519
|
-
name: Example echo PR number and URL
|
|
1520
|
-
on: push
|
|
1521
|
-
jobs:
|
|
1522
|
-
cypress-run:
|
|
1523
|
-
runs-on: ubuntu-22.04
|
|
1524
|
-
steps:
|
|
1525
|
-
- name: Checkout
|
|
1526
|
-
uses: actions/checkout@v4
|
|
1527
|
-
- name: Cypress run
|
|
1528
|
-
uses: cypress-io/github-action@v6
|
|
1529
|
-
with:
|
|
1530
|
-
record: true
|
|
1531
|
-
- run: echo "PR number is $CYPRESS_PULL_REQUEST_ID"
|
|
1532
|
-
- run: echo "PR URL is $CYPRESS_PULL_REQUEST_URL"
|
|
1533
|
-
env:
|
|
1534
|
-
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
1535
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
1536
|
-
```
|
|
1537
|
-
|
|
1538
|
-
#### Triggering event: `pull_request`/`pull_request_target`
|
|
1539
|
-
|
|
1540
|
-
For either of these events, we set `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL` to that of the PR number and URL, respectively, of the
|
|
1541
|
-
PR that triggered the workflow.
|
|
1542
|
-
|
|
1543
|
-
#### Triggering event: `push`
|
|
1544
|
-
|
|
1545
|
-
When a commit on a branch without a PR is made, the Cypress GitHub Action checks to see if the commit that triggered the workflow has a
|
|
1546
|
-
related PR. If the commit exists in any other PRs, it's considered a related PR. When there are related PRs, we grab the first related PR
|
|
1547
|
-
and use that PR's number and URL for `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
|
|
1548
|
-
|
|
1549
|
-
If no related PR is detected, `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL` will be undefined.
|
|
1550
|
-
|
|
1551
1621
|
## Node.js
|
|
1552
1622
|
|
|
1553
1623
|
### Support
|
|
1554
1624
|
|
|
1555
1625
|
Node.js is required to run this action. The recommended version `v6` supports:
|
|
1556
1626
|
|
|
1557
|
-
- **Node.js** 18.x
|
|
1558
|
-
- **Node.js** 20.x and above
|
|
1627
|
+
- **Node.js** 18.x, 20.x and 22.x
|
|
1559
1628
|
|
|
1560
1629
|
and is generally aligned with [Node.js's release schedule](https://github.com/nodejs/Release).
|
|
1561
1630
|
|
|
@@ -1563,7 +1632,7 @@ and is generally aligned with [Node.js's release schedule](https://github.com/no
|
|
|
1563
1632
|
|
|
1564
1633
|
`github-action` command-type options such as [`install-command`](https://github.com/cypress-io/github-action#custom-install-command), [`build`](https://github.com/cypress-io/github-action#build-app), [`start`](https://github.com/cypress-io/github-action#start-server) and [`command`](https://github.com/cypress-io/github-action#custom-test-command) are executed with the runner's version of Node.js. You can use GitHub's [actions/setup-node](https://github.com/actions/setup-node) to install an explicit Node.js version into the runner.
|
|
1565
1634
|
|
|
1566
|
-
[](.github/workflows/example-node-versions.yml)
|
|
1567
1636
|
|
|
1568
1637
|
Cypress itself runs with a fixed Node.js version specified by the [runs.using](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions) parameter of [action.yml](action.yml). `github-action@v6` uses `node20`.
|
|
1569
1638
|
|
|
@@ -1573,11 +1642,8 @@ View the [CHANGELOG](./CHANGELOG.md) document for an overview of version changes
|
|
|
1573
1642
|
|
|
1574
1643
|
## Compatibility
|
|
1575
1644
|
|
|
1576
|
-
- `v6` is the current recommended version and uses `node20`
|
|
1577
|
-
- `v5`
|
|
1578
|
-
- `v4` is the minimum version required for Cypress `10.x` and later - also uses the deprecated version `node16`
|
|
1579
|
-
|
|
1580
|
-
Pay attention to any GitHub Actions deprecation warnings shown in logs which may recommend updating.
|
|
1645
|
+
- `github-action@v6` is the current recommended version and uses `node20`
|
|
1646
|
+
- `github-action` versions `v1` to `v5` are unsupported: they rely on Node.js `12` and `16` in End-of-life status.
|
|
1581
1647
|
|
|
1582
1648
|
## Contributing
|
|
1583
1649
|
|
|
@@ -1590,7 +1656,7 @@ Please see our [Contributing Guideline](./CONTRIBUTING.md) which explains how to
|
|
|
1590
1656
|
This project is licensed under the terms of the [MIT license][license-file].
|
|
1591
1657
|
|
|
1592
1658
|
<!-- badge links follow -->
|
|
1593
|
-
[ci-badge]: https://github.com/cypress-io/github-action/workflows/main/badge.svg
|
|
1659
|
+
[ci-badge]: https://github.com/cypress-io/github-action/actions/workflows/main.yml/badge.svg
|
|
1594
1660
|
[ci-workflow]: https://github.com/cypress-io/github-action/actions/workflows/main.yml
|
|
1595
1661
|
[cloud-badge]: https://img.shields.io/endpoint?url=https://cloud.cypress.io/badge/simple/3tb7jn/master&style=flat&logo=cypress
|
|
1596
1662
|
[cloud-project]: https://cloud.cypress.io/projects/3tb7jn/runs
|
package/dist/index.js
CHANGED
|
@@ -74506,10 +74506,10 @@ const lockHash = () => {
|
|
|
74506
74506
|
const lockFilename = useYarn()
|
|
74507
74507
|
? yarnFilename
|
|
74508
74508
|
: usePnpm()
|
|
74509
|
-
|
|
74510
|
-
|
|
74511
|
-
|
|
74512
|
-
|
|
74509
|
+
? pnpmLockFilename
|
|
74510
|
+
: useNpm()
|
|
74511
|
+
? packageLockFilename
|
|
74512
|
+
: noLockFile()
|
|
74513
74513
|
const fileHash = hasha.fromFileSync(lockFilename)
|
|
74514
74514
|
debug(`Hash from file ${lockFilename} is ${fileHash}`)
|
|
74515
74515
|
return fileHash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cypress/github-action",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "GitHub Action for running Cypress end-to-end and component tests",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"format": "prettier --write index.js src/ping.js",
|
|
16
16
|
"check:markdown": "find *.md docs/*.md -print0 | xargs -0 -n1 markdown-link-check -c md-linkcheck.json",
|
|
17
17
|
"update:cypress": "./scripts/update-cypress-latest.sh",
|
|
18
|
-
"prepare": "husky
|
|
18
|
+
"prepare": "husky"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"supports-color": "9.3.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/node": "20.
|
|
49
|
+
"@types/node": "20.12.12",
|
|
50
50
|
"@vercel/ncc": "0.38.1",
|
|
51
|
-
"husky": "
|
|
52
|
-
"markdown-link-check": "3.
|
|
53
|
-
"prettier": "3.
|
|
51
|
+
"husky": "9.0.11",
|
|
52
|
+
"markdown-link-check": "3.12.2",
|
|
53
|
+
"prettier": "3.2.5"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|