@cypress/github-action 5.0.9 → 5.2.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 CHANGED
@@ -7,6 +7,7 @@
7
7
  - [Basic](#basic)
8
8
  - [Explicit version](#explicit-version)
9
9
  - Run tests in a given [browser](#browser)
10
+ - using [Chrome](#chrome)
10
11
  - using [Firefox](#firefox)
11
12
  - using [Edge](#edge)
12
13
  - using [headed mode](#headed)
@@ -15,9 +16,10 @@
15
16
  - Run only some [spec files](#specs)
16
17
  - Test [project in subfolder](#project)
17
18
  - [Record results](#record-test-results-on-cypress-cloud) on Cypress Cloud
19
+ - Specify [auto cancel](#specify-auto-cancel-after-failures) after failures
18
20
  - Tag [recordings](#tag-recordings)
19
- - [Quiet output](#quiet-flag)
20
21
  - Store [test artifacts](#artifacts) on GitHub
22
+ - [Quiet output](#quiet-flag)
21
23
  - Set Cypress [config values](#config)
22
24
  - Use specific [config file](#config-file)
23
25
  - Run tests in [parallel](#parallel)
@@ -46,7 +48,7 @@
46
48
 
47
49
  ```yml
48
50
  name: End-to-end tests
49
- on: [push]
51
+ on: push
50
52
  jobs:
51
53
  cypress-run:
52
54
  runs-on: ubuntu-22.04
@@ -87,15 +89,16 @@ By using the full version tag, you will avoid accidentally using a newer version
87
89
 
88
90
  ### Browser
89
91
 
90
- Specify the browser name or path with `browser` parameter
92
+ Specify the browser name or path with the `browser` parameter. The default browser, if none is specified, is the built-in [Electron browser](https://on.cypress.io/guides/guides/launching-browsers#Electron-Browser).
93
+
94
+ ### Chrome
91
95
 
92
96
  ```yml
93
- name: E2E on Chrome
94
- on: [push]
97
+ name: Chrome
98
+ on: push
95
99
  jobs:
96
- cypress-run:
100
+ chrome:
97
101
  runs-on: ubuntu-22.04
98
- # let's make sure our tests pass on Chrome browser
99
102
  name: E2E on Chrome
100
103
  steps:
101
104
  - uses: actions/checkout@v3
@@ -108,17 +111,13 @@ jobs:
108
111
 
109
112
  ### Firefox
110
113
 
111
- In order to run Firefox, you need to use non-root user (Firefox security restriction).
112
-
113
114
  ```yml
114
115
  name: Firefox
115
116
  on: push
116
117
  jobs:
117
118
  firefox:
118
119
  runs-on: ubuntu-22.04
119
- container:
120
- image: cypress/browsers:node18.12.0-chrome106-ff106
121
- options: --user 1001
120
+ name: E2E on Firefox
122
121
  steps:
123
122
  - uses: actions/checkout@v3
124
123
  - uses: cypress-io/github-action@v5
@@ -128,16 +127,15 @@ jobs:
128
127
 
129
128
  [![Firefox example](https://github.com/cypress-io/github-action/workflows/example-firefox/badge.svg?branch=master)](.github/workflows/example-firefox.yml)
130
129
 
131
- **Note:** the magical user id `1001` works because it matches permissions settings on the home folder, see issue [#104](https://github.com/cypress-io/github-action/issues/104)
132
-
133
130
  ### Edge
134
131
 
135
132
  ```yml
136
133
  name: Edge
137
134
  on: push
138
135
  jobs:
139
- tests:
136
+ edge:
140
137
  runs-on: windows-latest
138
+ name: E2E on Edge
141
139
  steps:
142
140
  - uses: actions/checkout@v3
143
141
  - uses: cypress-io/github-action@v5
@@ -153,7 +151,7 @@ Run the browser in headed mode - as of Cypress v8.0 the `cypress run` command ex
153
151
 
154
152
  ```yml
155
153
  name: Chrome headed
156
- on: [push]
154
+ on: push
157
155
  jobs:
158
156
  cypress-run:
159
157
  runs-on: ubuntu-22.04
@@ -171,7 +169,7 @@ You can run tests in a GH Action in your Docker container.
171
169
 
172
170
  ```yml
173
171
  name: E2E in custom container
174
- on: [push]
172
+ on: push
175
173
  jobs:
176
174
  cypress-run:
177
175
  runs-on: ubuntu-22.04
@@ -191,7 +189,7 @@ Specify the env argument with `env` parameter
191
189
 
192
190
  ```yml
193
191
  name: Cypress tests
194
- on: [push]
192
+ on: push
195
193
  jobs:
196
194
  cypress-run:
197
195
  runs-on: ubuntu-22.04
@@ -209,7 +207,7 @@ When passing the environment variables this way, unfortunately due to GitHub Act
209
207
 
210
208
  ```yml
211
209
  name: Cypress tests
212
- on: [push]
210
+ on: push
213
211
  jobs:
214
212
  cypress-run:
215
213
  runs-on: ubuntu-22.04
@@ -234,7 +232,7 @@ Specify the [spec files to run](https://docs.cypress.io/guides/guides/command-li
234
232
 
235
233
  ```yml
236
234
  name: Cypress tests
237
- on: [push]
235
+ on: push
238
236
  jobs:
239
237
  cypress-run:
240
238
  name: Cypress run
@@ -265,7 +263,7 @@ Specify the [project to run](https://docs.cypress.io/guides/guides/command-line.
265
263
 
266
264
  ```yml
267
265
  name: Cypress tests
268
- on: [push]
266
+ on: push
269
267
  jobs:
270
268
  cypress-run:
271
269
  name: Cypress run
@@ -285,7 +283,7 @@ For more information, visit [the Cypress command-line docs](https://on.cypress.i
285
283
 
286
284
  ```yml
287
285
  name: Cypress tests
288
- on: [push]
286
+ on: push
289
287
  jobs:
290
288
  cypress-run:
291
289
  name: Cypress run
@@ -317,7 +315,7 @@ jobs:
317
315
 
318
316
  ```yml
319
317
  name: Cypress tests
320
- on: [push]
318
+ on: push
321
319
  jobs:
322
320
  cypress-run:
323
321
  name: Cypress run
@@ -345,7 +343,7 @@ You can provide `quiet` flag for cypress run to silence any Cypress specific out
345
343
 
346
344
  ```yml
347
345
  name: example-quiet
348
- on: [push]
346
+ on: push
349
347
  jobs:
350
348
  cypress-run:
351
349
  runs-on: ubuntu-22.04
@@ -369,7 +367,7 @@ You can pass a single or multiple tags when recording a run. For example
369
367
 
370
368
  ```yml
371
369
  name: tags
372
- on: [push]
370
+ on: push
373
371
  jobs:
374
372
  cypress-run:
375
373
  runs-on: ubuntu-22.04
@@ -404,13 +402,46 @@ The recording will have tags as labels on the run.
404
402
 
405
403
  You can pass multiple tags using commas like `tag: node-10,nightly,staging`.
406
404
 
405
+ ### Specify auto cancel after failures
406
+
407
+ Specify the number of failed tests that will cancel a run when using the [Cypress Cloud Auto Cancellation](https://docs.cypress.io/guides/cloud/smart-orchestration#Auto-Cancellation) feature.
408
+
409
+ This feature requires Cypress 12.6.0 or later and a [Cypress Cloud Business or Enterprise](https://www.cypress.io/cloud/) account.
410
+
411
+ ```yml
412
+ name: Cypress E2E Tests
413
+ on: push
414
+ jobs:
415
+ cypress-run:
416
+ runs-on: ubuntu-22.04
417
+ name: E2E
418
+ steps:
419
+ - name: Setup Node
420
+ uses: actions/setup-node@v3
421
+
422
+ - name: Checkout
423
+ uses: actions/checkout@v3
424
+
425
+ - name: Cypress run
426
+ uses: cypress-io/github-action@v5
427
+ with:
428
+ record: true
429
+ # Cancel the run after 2 failed tests
430
+ auto-cancel-after-failures: 2
431
+ env:
432
+ CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
433
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
434
+ ```
435
+
436
+ See [Auto Cancellation](https://docs.cypress.io/guides/cloud/smart-orchestration#Auto-Cancellation) for more information.
437
+
407
438
  ### Artifacts
408
439
 
409
440
  If you don't record the test run on Cypress Cloud, you can still store generated videos and screenshots as CI artifacts. See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-example) and the workflow example below
410
441
 
411
442
  ```yml
412
443
  name: Artifacts
413
- on: [push]
444
+ on: push
414
445
  jobs:
415
446
  cypress-run:
416
447
  runs-on: ubuntu-22.04
@@ -443,7 +474,7 @@ Specify [configuration](https://docs.cypress.io/guides/references/configuration.
443
474
 
444
475
  ```yml
445
476
  name: Cypress tests
446
- on: [push]
477
+ on: push
447
478
  jobs:
448
479
  cypress-run:
449
480
  name: Cypress run
@@ -466,7 +497,7 @@ Specify the path to your config file with `config-file` parameter
466
497
 
467
498
  ```yml
468
499
  name: Cypress tests
469
- on: [push]
500
+ on: push
470
501
  jobs:
471
502
  cypress-run:
472
503
  name: Cypress run
@@ -489,9 +520,7 @@ You can spin multiple containers running in parallel using `strategy: matrix` ar
489
520
 
490
521
  ```yml
491
522
  name: Parallel Cypress Tests
492
-
493
- on: [push]
494
-
523
+ on: push
495
524
  jobs:
496
525
  test:
497
526
  name: Cypress run
@@ -556,7 +585,7 @@ You can run a build step before starting tests
556
585
 
557
586
  ```yml
558
587
  name: Build
559
- on: [push]
588
+ on: push
560
589
  jobs:
561
590
  cypress-run:
562
591
  runs-on: ubuntu-22.04
@@ -575,7 +604,7 @@ If your tests run against a local server, use `start` parameter, the server will
575
604
 
576
605
  ```yml
577
606
  name: With server
578
- on: [push]
607
+ on: push
579
608
  jobs:
580
609
  cypress-run:
581
610
  runs-on: ubuntu-22.04
@@ -592,7 +621,7 @@ jobs:
592
621
 
593
622
  ```yml
594
623
  name: With server
595
- on: [push]
624
+ on: push
596
625
  jobs:
597
626
  cypress-run:
598
627
  runs-on: ubuntu-22.04
@@ -618,7 +647,7 @@ You can start multiple server processes. For example, if you have an API to star
618
647
 
619
648
  ```yml
620
649
  name: With servers
621
- on: [push]
650
+ on: push
622
651
  jobs:
623
652
  cypress-run:
624
653
  runs-on: ubuntu-22.04
@@ -648,7 +677,7 @@ If you are starting a local server and it takes a while to start, you can add a
648
677
 
649
678
  ```yml
650
679
  name: After server responds
651
- on: [push]
680
+ on: push
652
681
  jobs:
653
682
  cypress-run:
654
683
  runs-on: ubuntu-22.04
@@ -705,6 +734,14 @@ See [example-wait-on.yml](.github/workflows/example-wait-on.yml) workflow file.
705
734
 
706
735
  If this action times out waiting for the server to respond, please see [Debugging](#debugging) section in this README file.
707
736
 
737
+ #### `wait-on` with Node.js 18+
738
+
739
+ Under Node.js version 18 and later, `wait-on` may fail to recognize that a `localhost` server is running. This affects development web servers which do not listen on both IPv4 and IPv6 network stacks.
740
+
741
+ - Check your server documentation to see if it can be started using `0.0.0.0` (all addresses) and use this if available. If this option is not available or does not resolve the issue then carry on to the next steps:
742
+ - If the action log shows that `wait-on` is failing to connect to `127.0.0.1`, replace `localhost` by `[::1]` (the IPv6 loopback address)
743
+ - If the action log shows that `wait-on` is failing to connect to `::1`, replace `localhost` by `127.0.0.1` (the IPv4 loopback address)
744
+
708
745
  ### Custom install command
709
746
 
710
747
  If you want to overwrite the install command
@@ -723,7 +760,7 @@ You can prefix the default test command using the `command-prefix` option. This
723
760
 
724
761
  ```yml
725
762
  name: Visual
726
- on: [push]
763
+ on: push
727
764
  jobs:
728
765
  e2e:
729
766
  runs-on: ubuntu-22.04
@@ -764,7 +801,7 @@ You can overwrite [`ci-build-id`](https://on.cypress.io/parallelization#Linking-
764
801
 
765
802
  ```yml
766
803
  name: Parallel
767
- on: [push]
804
+ on: push
768
805
  jobs:
769
806
  test:
770
807
  runs-on: ubuntu-22.04
@@ -804,7 +841,7 @@ jobs:
804
841
  # take the current commit + timestamp together
805
842
  # the typical value would be something like
806
843
  # "sha-5d3fe...35d3-time-1620841214"
807
- run: echo "::set-output name=value::sha-$GITHUB_SHA-time-$(date +"%s")"
844
+ run: echo "value=sha-$GITHUB_SHA-time-$(date +"%s")" >> $GITHUB_OUTPUT
808
845
  smoke-tests:
809
846
  needs: ['prepare']
810
847
  steps:
@@ -871,7 +908,7 @@ repo/
871
908
  You can specify the `app-test` working directory when running Cypress tests using the `working-directory` parameter
872
909
 
873
910
  ```yml
874
- on: [push]
911
+ on: push
875
912
  jobs:
876
913
  cypress-run:
877
914
  runs-on: ubuntu-22.04
@@ -934,7 +971,7 @@ This action should discover the Yarn workspaces correctly. For example, see fold
934
971
 
935
972
  ```yaml
936
973
  name: example-start-and-yarn-workspaces
937
- on: [push]
974
+ on: push
938
975
  jobs:
939
976
  single:
940
977
  # the example has Yarn workspace in its "root" folder
@@ -959,7 +996,7 @@ Sometimes the default cache key does not work. For example, if you cannot share
959
996
 
960
997
  ```yml
961
998
  name: End-to-end tests
962
- on: [push]
999
+ on: push
963
1000
  jobs:
964
1001
  cypress-run:
965
1002
  runs-on: ubuntu-22.04
@@ -994,7 +1031,7 @@ You can run your tests across multiple Node versions.
994
1031
 
995
1032
  ```yml
996
1033
  name: Node versions
997
- on: [push]
1034
+ on: push
998
1035
  jobs:
999
1036
  cypress-run:
1000
1037
  runs-on: ubuntu-22.04
@@ -1112,6 +1149,14 @@ Name | Description
1112
1149
 
1113
1150
  This action installs local dependencies using lock files. If `yarn.lock` file is found, the install uses `yarn --frozen-lockfile` command. Otherwise it expects to find `package-lock.json` and install using `npm ci` command.
1114
1151
 
1152
+ The above default `yarn` installation command can be replaced for [Yarn Berry](https://yarnpkg.com/) (Yarn 2 and later) using the `install-command` parameter, for example:
1153
+
1154
+ ```yml
1155
+ - uses: cypress-io/github-action@v5
1156
+ with:
1157
+ install-command: yarn install
1158
+ ```
1159
+
1115
1160
  This action uses several production dependencies. The minimum Node version required to run this action depends on the minimum Node required by the dependencies.
1116
1161
 
1117
1162
  ## Debugging
@@ -1215,7 +1260,7 @@ If your repository does not have `package.json` or `yarn.json` (maybe it contain
1215
1260
 
1216
1261
  ```yml
1217
1262
  name: included
1218
- on: [push]
1263
+ on: push
1219
1264
  jobs:
1220
1265
  cypress-run:
1221
1266
  runs-on: ubuntu-22.04
@@ -1235,7 +1280,7 @@ If you are NOT using the `build` command in your project, you can run the `cypre
1235
1280
 
1236
1281
  ```yml
1237
1282
  name: info
1238
- on: [push]
1283
+ on: push
1239
1284
  jobs:
1240
1285
  cypress-run:
1241
1286
  runs-on: ubuntu-22.04
@@ -1252,7 +1297,7 @@ If you are already using the `build` parameter, you can split the [installation
1252
1297
 
1253
1298
  ```yml
1254
1299
  name: info
1255
- on: [push]
1300
+ on: push
1256
1301
  jobs:
1257
1302
  cypress-run:
1258
1303
  runs-on: ubuntu-22.04
package/action.yml CHANGED
@@ -7,6 +7,9 @@ inputs:
7
7
  description: 'Sends test results to Cypress Dashboard'
8
8
  required: false
9
9
  default: false
10
+ auto-cancel-after-failures:
11
+ description: 'Overrides the global Cloud configuration to set the failed test threshold for auto cancellation or to disable auto cancellation when recording to the Cloud (requires Cypress 12.x or later)'
12
+ required: false
10
13
  config:
11
14
  description: 'Set configuration values. Separate multiple values with a comma. The values set here override any values set in your configuration file.'
12
15
  required: false
package/dist/index.js CHANGED
@@ -79017,6 +79017,13 @@ const runTestsUsingCommandLine = async () => {
79017
79017
  cmd.push('--config-file')
79018
79018
  cmd.push(quoteArgument(configFileInput))
79019
79019
  }
79020
+ const autoCancelAfterFailures = core.getInput(
79021
+ 'auto-cancel-after-failures'
79022
+ )
79023
+ if (autoCancelAfterFailures) {
79024
+ cmd.push('--auto-cancel-after-failures')
79025
+ cmd.push(quoteArgument(autoCancelAfterFailures))
79026
+ }
79020
79027
 
79021
79028
  if (parallel || group) {
79022
79029
  let buildIdVar = null
@@ -79145,6 +79152,12 @@ const runTests = async () => {
79145
79152
  cypressOptions.browser = core.getInput('browser')
79146
79153
  }
79147
79154
 
79155
+ if (core.getInput('auto-cancel-after-failures')) {
79156
+ cypressOptions.autoCancelAfterFailures = core.getInput(
79157
+ 'auto-cancel-after-failures'
79158
+ )
79159
+ }
79160
+
79148
79161
  if (core.getInput('env')) {
79149
79162
  cypressOptions.env = core.getInput('env')
79150
79163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/github-action",
3
- "version": "5.0.9",
3
+ "version": "5.2.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",
@@ -13,8 +13,8 @@
13
13
  "test": "echo \"There are no tests :(\"",
14
14
  "build": "ncc build -o dist index.js",
15
15
  "format": "prettier --write index.js",
16
- "check:markdown": "find *.md -print0 | xargs -0 -n1 markdown-link-check -c md-linkcheck.json",
17
- "install-deps": "./scripts/npm-install-examples.sh"
16
+ "check:markdown": "find *.md docs/*.md -print0 | xargs -0 -n1 markdown-link-check -c md-linkcheck.json",
17
+ "update:cypress": "./scripts/update-cypress-latest.sh"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  "quote": "0.4.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@types/node": "18.13.0",
48
+ "@types/node": "18.14.6",
49
49
  "@vercel/ncc": "0.36.1",
50
50
  "husky": "7.0.4",
51
51
  "markdown-link-check": "3.10.3",