@cypress/github-action 5.7.2 → 5.8.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 +28 -26
- package/action.yml +3 -1
- package/dist/index.js +6 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
|
|
56
56
|
Current examples contained in this repository are based on Cypress 12.x and can be found in the [examples](./examples) directory. Examples for [Legacy Configuration](https://on.cypress.io/guides/references/legacy-configuration) use Cypress `9.7.0` and are kept in the [examples/v9](./examples/v9) directory.
|
|
57
57
|
|
|
58
|
+
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
|
|
59
|
+
|
|
60
|
+
[](.github/workflows/example-basic.yml)
|
|
61
|
+
|
|
58
62
|
Some older **external** examples, linked to by this document, are based solely on Cypress 9 and below and therefore use a [Legacy Configuration](https://on.cypress.io/guides/references/legacy-configuration). These may need modification to be applied to Cypress 10 and later. Each of these external links is listed with a `(legacy)` notation.
|
|
59
63
|
|
|
60
64
|
**Note:** this package assumes that [cypress](https://www.npmjs.com/package/cypress) is declared as a development dependency in the [package.json](https://docs.npmjs.com/creating-a-package-json-file) file. The [cypress npm module](https://www.npmjs.com/package/cypress) is required to run Cypress via its [Module API](https://on.cypress.io/module-api).
|
|
@@ -262,7 +266,7 @@ jobs:
|
|
|
262
266
|
CYPRESS_port: 4222
|
|
263
267
|
```
|
|
264
268
|
|
|
265
|
-
For more examples, see the
|
|
269
|
+
For more examples, see the workflows below, using environment variables for [recording](#record-test-results-on-cypress-cloud).
|
|
266
270
|
|
|
267
271
|
[](.github/workflows/example-env.yml)
|
|
268
272
|
|
|
@@ -287,7 +291,7 @@ jobs:
|
|
|
287
291
|
spec: cypress/e2e/spec1.cy.js
|
|
288
292
|
```
|
|
289
293
|
|
|
290
|
-
You can pass multiple specs and wild card patterns using multi-line parameter, see [example-config.yml](
|
|
294
|
+
You can pass multiple specs and wild card patterns using multi-line parameter, see [example-config.yml](.github/workflows/example-config.yml):
|
|
291
295
|
|
|
292
296
|
```yml
|
|
293
297
|
spec: |
|
|
@@ -345,13 +349,13 @@ jobs:
|
|
|
345
349
|
|
|
346
350
|
[](.github/workflows/example-recording.yml)
|
|
347
351
|
|
|
348
|
-
**Tip 1:** We recommend using the action with `on:
|
|
352
|
+
**Tip 1:** We recommend using the action with `on: push` instead of `on: pull_request` to get the most accurate information related to the commit on Cypress Cloud. With pull requests, the merge commit is created automatically and might not correspond to a meaningful commit in the repository.
|
|
349
353
|
|
|
350
354
|
**Tip 2:** 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
355
|
|
|
352
356
|
**Tip 3:** if running on `pull_request` event, the commit message is "merge SHA into SHA", which is not what you want probably. You can overwrite the commit message sent to Cypress Cloud by setting an environment variable. See [issue 124](https://github.com/cypress-io/github-action/issues/124#issuecomment-653180260) for details.
|
|
353
357
|
|
|
354
|
-
**Tip 4:** to record the project needs `projectId`. Typically this value is saved in the
|
|
358
|
+
**Tip 4:** to record the project needs `projectId`. Typically this value is saved in the [Cypress Configuration File](https://docs.cypress.io/guides/references/configuration#Configuration-File). If you want to avoid this, pass the `projectId` using an environment variable:
|
|
355
359
|
|
|
356
360
|
```yml
|
|
357
361
|
name: Cypress tests
|
|
@@ -618,6 +622,8 @@ During staged rollout of a new GitHub-hosted runner version, GitHub may provide
|
|
|
618
622
|
component: true
|
|
619
623
|
```
|
|
620
624
|
|
|
625
|
+
See the example project [component-test](examples/component-tests/) and the [example-component-test.yml](.github/workflows/example-component-test.yml) workflow for more details.
|
|
626
|
+
|
|
621
627
|
### Build app
|
|
622
628
|
|
|
623
629
|
You can run a build step before starting tests
|
|
@@ -639,7 +645,7 @@ jobs:
|
|
|
639
645
|
|
|
640
646
|
### Start server
|
|
641
647
|
|
|
642
|
-
If your tests run against a local server, use `start` parameter
|
|
648
|
+
If your tests run against a local server, use the `start` parameter to start your server. The server will run in the background.
|
|
643
649
|
|
|
644
650
|
```yml
|
|
645
651
|
name: With server
|
|
@@ -656,7 +662,7 @@ jobs:
|
|
|
656
662
|
start: npm start
|
|
657
663
|
```
|
|
658
664
|
|
|
659
|
-
**Note:** sometimes on Windows you need to run a different start command. You can use `start-windows` parameter for this
|
|
665
|
+
**Note:** sometimes on Windows you need to run a different start command. You can use the `start-windows` parameter for this.
|
|
660
666
|
|
|
661
667
|
```yml
|
|
662
668
|
name: With server
|
|
@@ -678,7 +684,7 @@ jobs:
|
|
|
678
684
|
|
|
679
685
|
[](.github/workflows/example-start.yml)
|
|
680
686
|
|
|
681
|
-
**Note:** GitHub
|
|
687
|
+
**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.
|
|
682
688
|
|
|
683
689
|
### Start multiple servers
|
|
684
690
|
|
|
@@ -733,6 +739,8 @@ jobs:
|
|
|
733
739
|
|
|
734
740
|
[](.github/workflows/example-wait-on.yml)
|
|
735
741
|
|
|
742
|
+
[](.github/workflows/example-webpack.yml) (also uses `wait-on`)
|
|
743
|
+
|
|
736
744
|
By default, `wait-on` will retry for 60 seconds. You can pass a custom timeout in seconds using `wait-on-timeout`.
|
|
737
745
|
|
|
738
746
|
```yml
|
|
@@ -744,7 +752,7 @@ By default, `wait-on` will retry for 60 seconds. You can pass a custom timeout i
|
|
|
744
752
|
wait-on-timeout: 120
|
|
745
753
|
```
|
|
746
754
|
|
|
747
|
-
|
|
755
|
+
|
|
748
756
|
|
|
749
757
|
You can wait for multiple URLs to respond by separating urls with a comma
|
|
750
758
|
|
|
@@ -760,7 +768,7 @@ You can wait for multiple URLs to respond by separating urls with a comma
|
|
|
760
768
|
|
|
761
769
|
The action will wait for the first url to respond, then will check the second url, and so on.
|
|
762
770
|
|
|
763
|
-
You can even use your own command (usually by using `npm`, `yarn`, `npx`) to wait for the server to respond. For example, if you want to use [wait-on](https://github.com/jeffbski/wait-on) utility to ping the server and run the Cypress tests after the server responds:
|
|
771
|
+
You can even use your own command (usually by using `npm`, `yarn`, `npx`) to wait for the server to respond. For example, if you want to use the [wait-on](https://github.com/jeffbski/wait-on) utility to ping the server and run the Cypress tests after the server responds:
|
|
764
772
|
|
|
765
773
|
```yml
|
|
766
774
|
- uses: cypress-io/github-action@v5
|
|
@@ -834,7 +842,7 @@ steps:
|
|
|
834
842
|
|
|
835
843
|
**Caution**: using the action parameter `command` causes multiple other parameters to be ignored including: `auto-cancel-after-failures`, `browser`, `ci-build-id`, `command-prefix`, `component`, `config`, `config-file`, `env`, `group`, `headed`, `parallel`, `project`, `publish-summary`, `quiet`, `record`, `spec` and `tag`.
|
|
836
844
|
|
|
837
|
-
See [
|
|
845
|
+
See [example-custom-command.yml](.github/workflows/example-custom-command.yml) file.
|
|
838
846
|
|
|
839
847
|
### Custom build id
|
|
840
848
|
|
|
@@ -868,7 +876,7 @@ jobs:
|
|
|
868
876
|
|
|
869
877
|
### Robust custom build id
|
|
870
878
|
|
|
871
|
-
If you re-run the GitHub workflow, if you use the same custom build id during recording, Cypress Cloud will cancel the run with "Build already finished" error. To avoid this, you need to generate a _new_ custom build id on every workflow re-run. A good solution showing in the [example-custom-ci-build-id.yml](
|
|
879
|
+
If you re-run the GitHub workflow, if you use the same custom build id during recording, Cypress Cloud will cancel the run with "Build already finished" error. To avoid this, you need to generate a _new_ custom build id on every workflow re-run. A good solution showing in the [example-custom-ci-build-id.yml](.github/workflows/example-custom-ci-build-id.yml) file is to run a common job first that just generates a new random ID. This ID can be used by the testing jobs to tie the build together. If the user re-runs the workflow a new unique build id is generated, allowing recording the new Cypress Cloud run.
|
|
872
880
|
|
|
873
881
|
```yml
|
|
874
882
|
jobs:
|
|
@@ -897,7 +905,7 @@ jobs:
|
|
|
897
905
|
CYPRESS_RECORD_KEY: ${{ secrets.EXAMPLE_RECORDING_KEY }}
|
|
898
906
|
```
|
|
899
907
|
|
|
900
|
-
See the [example-custom-ci-build-id.yml](
|
|
908
|
+
See the [example-custom-ci-build-id.yml](.github/workflows/example-custom-ci-build-id.yml) for the full workflow.
|
|
901
909
|
|
|
902
910
|
### Working directory
|
|
903
911
|
|
|
@@ -1050,8 +1058,6 @@ jobs:
|
|
|
1050
1058
|
working-directory: examples/yarn-classic
|
|
1051
1059
|
```
|
|
1052
1060
|
|
|
1053
|
-
See [example-yarn-classic.yml](.github/workflows/example-yarn-classic.yml) for an example.
|
|
1054
|
-
|
|
1055
1061
|
[](.github/workflows/example-yarn-classic.yml)
|
|
1056
1062
|
|
|
1057
1063
|
### Yarn Modern
|
|
@@ -1074,8 +1080,6 @@ jobs:
|
|
|
1074
1080
|
install-command: yarn install
|
|
1075
1081
|
```
|
|
1076
1082
|
|
|
1077
|
-
See [example-yarn-modern.yml](.github/workflows/example-yarn-modern.yml) for an example.
|
|
1078
|
-
|
|
1079
1083
|
[](.github/workflows/example-yarn-modern.yml)
|
|
1080
1084
|
|
|
1081
1085
|
### Yarn Plug'n'Play
|
|
@@ -1214,7 +1218,7 @@ jobs:
|
|
|
1214
1218
|
working-directory: e2e
|
|
1215
1219
|
```
|
|
1216
1220
|
|
|
1217
|
-
See [cypress-gh-action-monorepo](https://github.com/bahmutov/cypress-gh-action-monorepo) for working example.
|
|
1221
|
+
See [cypress-gh-action-monorepo](https://github.com/bahmutov/cypress-gh-action-monorepo) for a working example.
|
|
1218
1222
|
|
|
1219
1223
|
### Custom install
|
|
1220
1224
|
|
|
@@ -1238,8 +1242,6 @@ If the project has many dependencies, but you want to install just Cypress you c
|
|
|
1238
1242
|
install: false
|
|
1239
1243
|
```
|
|
1240
1244
|
|
|
1241
|
-
See [.github/workflows/example-install-only.yml](.github/workflows/example-install-only.yml) file.
|
|
1242
|
-
|
|
1243
1245
|
[](.github/workflows/example-install-only.yml)
|
|
1244
1246
|
|
|
1245
1247
|
### Timeouts
|
|
@@ -1274,7 +1276,7 @@ See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-ex
|
|
|
1274
1276
|
| [cypress-gh-action-split-install](https://github.com/bahmutov/cypress-gh-action-split-install) (legacy) | Only install npm dependencies, then install and cache Cypress binary yourself |
|
|
1275
1277
|
| [cypress-gh-action-changed-files](https://github.com/bahmutov/cypress-gh-action-changed-files) (legacy) | Shows how to run different Cypress projects depending on changed files |
|
|
1276
1278
|
| [cypress-examples](https://github.com/bahmutov/cypress-examples) | Shows separate install job from parallel test jobs |
|
|
1277
|
-
| [cypress-gh-action-split-jobs](https://github.com/bahmutov/cypress-gh-action-split-jobs)
|
|
1279
|
+
| [cypress-gh-action-split-jobs](https://github.com/bahmutov/cypress-gh-action-split-jobs) | Shows a separate install job with the build step, and another job that runs the tests |
|
|
1278
1280
|
<!-- prettier-ignore-end -->
|
|
1279
1281
|
|
|
1280
1282
|
## Notes
|
|
@@ -1308,7 +1310,7 @@ You can set the environment variable using GitHub UI interface, or in the workfl
|
|
|
1308
1310
|
DEBUG: '@cypress/github-action'
|
|
1309
1311
|
```
|
|
1310
1312
|
|
|
1311
|
-
See the [example-debug.yml](
|
|
1313
|
+
See the [example-debug.yml](.github/workflows/example-debug.yml) workflow file.
|
|
1312
1314
|
|
|
1313
1315
|
### Logs from the test runner
|
|
1314
1316
|
|
|
@@ -1357,9 +1359,9 @@ If you add `workflow_dispatch` event to your workflow, you will be able to start
|
|
|
1357
1359
|
|
|
1358
1360
|
### Outputs
|
|
1359
1361
|
|
|
1360
|
-
This action sets a GitHub step output `
|
|
1362
|
+
This action sets a GitHub step output `resultsUrl` if the run was recorded on [Cypress Cloud](https://on.cypress.io/cloud-introduction) using the action parameter setting `record: true` (see [Record test results on Cypress Cloud](#record-test-results-on-cypress-cloud)). Note that using a [Custom test command](#custom-test-command) with the `command` parameter overrides the `record` parameter and in this case no `resultsUrl` step output is saved.
|
|
1361
1363
|
|
|
1362
|
-
This is an example of using the step output `
|
|
1364
|
+
This is an example of using the step output `resultsUrl`:
|
|
1363
1365
|
|
|
1364
1366
|
```yml
|
|
1365
1367
|
- name: Cypress tests
|
|
@@ -1377,9 +1379,11 @@ This is an example of using the step output `dashboardUrl`:
|
|
|
1377
1379
|
- name: Print Cypress Cloud URL
|
|
1378
1380
|
run: |
|
|
1379
1381
|
echo Cypress finished with: ${{ steps.cypress.outcome }}
|
|
1380
|
-
echo See results at ${{ steps.cypress.outputs.
|
|
1382
|
+
echo See results at ${{ steps.cypress.outputs.resultsUrl }}
|
|
1381
1383
|
```
|
|
1382
1384
|
|
|
1385
|
+
The GitHub step output `dashboardUrl` is deprecated. Cypress Dashboard is now [Cypress Cloud](https://on.cypress.io/cloud-introduction).
|
|
1386
|
+
|
|
1383
1387
|
[](.github/workflows/example-recording.yml)
|
|
1384
1388
|
|
|
1385
1389
|
**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.
|
|
@@ -1451,8 +1455,6 @@ jobs:
|
|
|
1451
1455
|
uses: cypress-io/github-action@v5
|
|
1452
1456
|
```
|
|
1453
1457
|
|
|
1454
|
-
See the [example-cron.yml](./.github/workflows/example-cron.yml) workflow.
|
|
1455
|
-
|
|
1456
1458
|
[](.github/workflows/example-cron.yml)
|
|
1457
1459
|
|
|
1458
1460
|
### Suppress test summary
|
package/action.yml
CHANGED
|
@@ -93,7 +93,9 @@ inputs:
|
|
|
93
93
|
default: false
|
|
94
94
|
outputs:
|
|
95
95
|
dashboardUrl:
|
|
96
|
-
description: 'Cypress
|
|
96
|
+
description: 'Cypress Cloud URL if the run was recorded (deprecated)'
|
|
97
|
+
resultsUrl:
|
|
98
|
+
description: 'Cypress Cloud URL if the run was recorded'
|
|
97
99
|
runs:
|
|
98
100
|
using: 'node16'
|
|
99
101
|
main: 'dist/index.js'
|
package/dist/index.js
CHANGED
|
@@ -75091,7 +75091,7 @@ const runTests = async () => {
|
|
|
75091
75091
|
debug(`Cypress options ${JSON.stringify(cypressOptions)}`)
|
|
75092
75092
|
|
|
75093
75093
|
const onTestsFinished = (testResults) => {
|
|
75094
|
-
const
|
|
75094
|
+
const resultsUrl = testResults.runUrl
|
|
75095
75095
|
process.chdir(startWorkingDirectory)
|
|
75096
75096
|
|
|
75097
75097
|
if (testResults.failures) {
|
|
@@ -75112,14 +75112,15 @@ const runTests = async () => {
|
|
|
75112
75112
|
|
|
75113
75113
|
debug(`Cypress tests: ${testResults.totalFailed} failed`)
|
|
75114
75114
|
|
|
75115
|
-
if (
|
|
75116
|
-
debug(`
|
|
75115
|
+
if (resultsUrl) {
|
|
75116
|
+
debug(`resultsUrl ${resultsUrl}`)
|
|
75117
75117
|
} else {
|
|
75118
|
-
debug('There is no
|
|
75118
|
+
debug('There is no resultsUrl')
|
|
75119
75119
|
}
|
|
75120
75120
|
|
|
75121
75121
|
// we still set the output explicitly
|
|
75122
|
-
core.setOutput('dashboardUrl',
|
|
75122
|
+
core.setOutput('dashboardUrl', resultsUrl) // deprecated and retained for backward compatibility
|
|
75123
|
+
core.setOutput('resultsUrl', resultsUrl) // replacement for dashboardUrl
|
|
75123
75124
|
|
|
75124
75125
|
if (testResults.totalFailed) {
|
|
75125
75126
|
return Promise.reject(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cypress/github-action",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.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",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"supports-color": "9.3.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/node": "18.16.
|
|
49
|
+
"@types/node": "18.16.14",
|
|
50
50
|
"@vercel/ncc": "0.36.1",
|
|
51
51
|
"husky": "8.0.3",
|
|
52
52
|
"markdown-link-check": "3.11.1",
|