@cypress/github-action 5.5.1 → 5.6.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.
Files changed (3) hide show
  1. package/README.md +54 -31
  2. package/dist/index.js +13 -2
  3. package/package.json +6 -10
package/README.md CHANGED
@@ -35,6 +35,7 @@
35
35
  - pass [custom build id](#custom-build-id) when recording to Cypress Cloud
36
36
  - generate a [robust custom build id](#robust-custom-build-id) to allow re-running the workflow
37
37
  - use different [working-directory](#working-directory)
38
+ - use [pnpm](#pnpm)
38
39
  - use [Yarn Classic](#yarn-classic)
39
40
  - use [Yarn Modern](#yarn-modern)
40
41
  - use [Yarn workspaces](#yarn-workspaces)
@@ -116,7 +117,7 @@ When using `cypress-io/github-action@v5` from your workflow file, you automatica
116
117
 
117
118
  ```yml
118
119
  - name: Cypress run
119
- uses: cypress-io/github-action@v5.x.x
120
+ uses: cypress-io/github-action@v5.1.0
120
121
  ```
121
122
 
122
123
  By using the full version tag, you will avoid accidentally using a newer version of the action.
@@ -408,7 +409,7 @@ jobs:
408
409
  # let's make sure our "app" works on several versions of Node
409
410
  strategy:
410
411
  matrix:
411
- node: [14, 16, 18]
412
+ node: [14, 16, 18, 19]
412
413
  name: E2E on Node v${{ matrix.node }}
413
414
  steps:
414
415
  - name: Setup Node
@@ -434,7 +435,7 @@ The recording will have tags as labels on the run.
434
435
 
435
436
  ![Tags](images/tags.png)
436
437
 
437
- You can pass multiple tags using commas like `tag: node-10,nightly,staging`.
438
+ You can pass multiple tags using commas like `tag: node-18,nightly,staging`.
438
439
 
439
440
  ### Specify auto cancel after failures
440
441
 
@@ -996,6 +997,31 @@ jobs:
996
997
 
997
998
  See [cypress-gh-action-subfolders](https://github.com/bahmutov/cypress-gh-action-subfolders) (legacy) for example.
998
999
 
1000
+ ### pnpm
1001
+
1002
+ The package manager `pnpm` is not pre-installed in [GitHub Actions runner images](https://github.com/actions/runner-images) (unlike `npm` and `yarn`): to install `pnpm` include [pnpm/action-setup](https://github.com/pnpm/action-setup) in your workflow. 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.
1003
+
1004
+ ```yaml
1005
+ name: example-basic-pnpm
1006
+ on: push
1007
+ jobs:
1008
+ basic-pnpm:
1009
+ runs-on: ubuntu-22.04
1010
+ steps:
1011
+ - name: Checkout
1012
+ uses: actions/checkout@v3
1013
+ - name: Install pnpm
1014
+ uses: pnpm/action-setup@v2
1015
+ with:
1016
+ version: latest
1017
+ - name: Cypress run
1018
+ uses: cypress-io/github-action@v5
1019
+ with:
1020
+ working-directory: examples/basic-pnpm
1021
+ ```
1022
+
1023
+ [![pnpm example](https://github.com/cypress-io/github-action/workflows/example-basic-pnpm/badge.svg?branch=master)](.github/workflows/example-basic-pnpm.yml)
1024
+
999
1025
  ### Yarn Classic
1000
1026
 
1001
1027
  If a `yarn.lock` file is found, the action uses the [Yarn 1 (Classic)](https://classic.yarnpkg.com/) command `yarn --frozen-lockfile` by default to install dependencies.
@@ -1081,7 +1107,7 @@ jobs:
1081
1107
  # let's make sure our "app" works on several versions of Node
1082
1108
  strategy:
1083
1109
  matrix:
1084
- node: [14, 16, 18]
1110
+ node: [14, 16, 18, 19]
1085
1111
  name: E2E on Node v${{ matrix.node }}
1086
1112
  steps:
1087
1113
  - name: Setup Node
@@ -1115,7 +1141,7 @@ jobs:
1115
1141
  runs-on: ubuntu-22.04
1116
1142
  strategy:
1117
1143
  matrix:
1118
- node: [14, 16, 18]
1144
+ node: [14, 16, 18, 19]
1119
1145
  name: E2E on Node v${{ matrix.node }}
1120
1146
  steps:
1121
1147
  - uses: actions/setup-node@v3
@@ -1127,8 +1153,6 @@ jobs:
1127
1153
 
1128
1154
  [![Node versions example](https://github.com/cypress-io/github-action/workflows/example-node-versions/badge.svg?branch=master)](.github/workflows/example-node-versions.yml)
1129
1155
 
1130
- **Note:** because this action uses `npm ci` and `npx` commands, it requires at least Node 8.12 that includes the version of NPM with those commands.
1131
-
1132
1156
  ### Split install and tests
1133
1157
 
1134
1158
  Sometimes you may want to run additional commands between installation and tests. To enable this use the `install` and `runTests` parameters.
@@ -1223,11 +1247,25 @@ See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-ex
1223
1247
 
1224
1248
  ### Installation
1225
1249
 
1226
- 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. See the [Yarn Modern](#yarn-modern) example for instructions on installing dependencies using this later version.
1250
+ This action installs local dependencies using lock files. Ensure that exactly one type of lock file is used for each project or working-directory from the following supported package managers:
1227
1251
 
1228
- #### Minimum Node.js
1252
+ | Lock file | Package Manager | Installation command |
1253
+ | ------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------- |
1254
+ | `package-lock.json` | [npm](https://docs.npmjs.com/cli/v9/commands/npm-ci) | `npm ci` |
1255
+ | `pnpm-lock.yaml` | [pnpm](https://pnpm.io/cli/install#--frozen-lockfile) | `pnpm install --frozen-lockfile` |
1256
+ | `yarn.lock` | [Yarn Classic](https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-frozen-lockfile) | `yarn --frozen-lockfile` |
1229
1257
 
1230
- This action uses several production dependencies. The minimum Node version required to run this action depends on the minimum Node version required by the dependencies.
1258
+ See section [Yarn Modern](#yarn-modern) for information about using Yarn version 2 and later.
1259
+
1260
+ #### Node.js Support
1261
+
1262
+ Node.js is required to run this action. The current version `v5` supports:
1263
+
1264
+ - **Node.js** 14.x
1265
+ - **Node.js** 16.x
1266
+ - **Node.js** 18.x and above
1267
+
1268
+ and is generally aligned with [Node.js's release schedule](https://github.com/nodejs/Release).
1231
1269
 
1232
1270
  ## Debugging
1233
1271
 
@@ -1299,7 +1337,9 @@ If you add `workflow_dispatch` event to your workflow, you will be able to start
1299
1337
 
1300
1338
  ### Outputs
1301
1339
 
1302
- This GH Action sets an output `dashboardUrl` if the run was recorded on [Cypress Cloud](https://on.cypress.io/dashboard-introduction), see [action.yml](action.yml). To use this output:
1340
+ This action sets a GitHub step output `dashboardUrl` if the run was recorded on [Cypress Cloud](https://on.cypress.io/dashboard-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 `dashboardUrl` step output is saved.
1341
+
1342
+ This is an example of using the step output `dashboardUrl`:
1303
1343
 
1304
1344
  ```yml
1305
1345
  - name: Cypress tests
@@ -1308,7 +1348,7 @@ This GH Action sets an output `dashboardUrl` if the run was recorded on [Cypress
1308
1348
  # to its output values later
1309
1349
  id: cypress
1310
1350
  # Continue the build in case of an error, as we need to set the
1311
- # commit status in the next step, both in case of success and failure
1351
+ # commit status in the next step, both in case of success or failure
1312
1352
  continue-on-error: true
1313
1353
  with:
1314
1354
  record: true
@@ -1322,25 +1362,7 @@ This GH Action sets an output `dashboardUrl` if the run was recorded on [Cypress
1322
1362
 
1323
1363
  [![recording example](https://github.com/cypress-io/github-action/workflows/example-recording/badge.svg?branch=master)](.github/workflows/example-recording.yml)
1324
1364
 
1325
- **Note:** every GH workflow step can have `outcome` and `conclusion` properties. See the documentation at [steps context](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context) page. In particular, the `output` value can be `success`, `failure`, `cancelled`, or `skipped` which you can use the next steps that follow.
1326
-
1327
- ### Docker image
1328
-
1329
- If your repository does not have `package.json` or `yarn.json` (maybe it contains a static site and does not need any dependencies), you can run Cypress tests using `cypress/included:...` [Cypress Docker images](https://github.com/cypress-io/cypress-docker-images/tree/master/included). In that case you don't even need this GH Action, instead use the Docker container and write `cypress run` command like this example from [cypress-gh-action-included](https://github.com/bahmutov/cypress-gh-action-included) (legacy)
1330
-
1331
- ```yml
1332
- name: included
1333
- on: push
1334
- jobs:
1335
- cypress-run:
1336
- runs-on: ubuntu-22.04
1337
- # Docker image with Cypress pre-installed
1338
- # https://github.com/cypress-io/cypress-docker-images/tree/master/included
1339
- container: cypress/included:3.8.3
1340
- steps:
1341
- - uses: actions/checkout@v3
1342
- - run: cypress run
1343
- ```
1365
+ **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.
1344
1366
 
1345
1367
  ### Print Cypress info
1346
1368
 
@@ -1441,6 +1463,7 @@ See [Releases](https://github.com/cypress-io/github-action/releases) for full de
1441
1463
  | Version | Changes |
1442
1464
  | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
1443
1465
  | v5 | Examples and workflows additionally use Node.js 18. Use of the end-of-life Node.js version 12 in examples and workflows is removed. |
1466
+ | v4.2.0 | Support for pnpm added. |
1444
1467
  | v4 | Support for Cypress 10 and later versions is added. |
1445
1468
  | v3 | Action runs under Node.js 16 instead of Node.js 12. |
1446
1469
  | v2 | Cypress runs using the [NPM module API](https://docs.cypress.io/guides/guides/module-api) instead of being started via the command line. |
package/dist/index.js CHANGED
@@ -74454,20 +74454,31 @@ const packageLockFilename = path.join(
74454
74454
  )
74455
74455
 
74456
74456
  const useYarn = () => fs.existsSync(yarnFilename)
74457
-
74458
74457
  const usePnpm = () => fs.existsSync(pnpmLockFilename)
74458
+ const useNpm = () => fs.existsSync(packageLockFilename)
74459
74459
 
74460
74460
  const lockHash = () => {
74461
74461
  const lockFilename = useYarn()
74462
74462
  ? yarnFilename
74463
74463
  : usePnpm()
74464
74464
  ? pnpmLockFilename
74465
- : packageLockFilename
74465
+ : useNpm()
74466
+ ? packageLockFilename
74467
+ : noLockFile()
74466
74468
  const fileHash = hasha.fromFileSync(lockFilename)
74467
74469
  debug(`Hash from file ${lockFilename} is ${fileHash}`)
74468
74470
  return fileHash
74469
74471
  }
74470
74472
 
74473
+ const noLockFile = () => {
74474
+ core.error(
74475
+ `Action failed. Missing package manager lockfile. ` +
74476
+ `Expecting one of package-lock.json (npm), pnpm-lock.yaml (pnpm) or yarn.lock (yarn) in working-directory ` +
74477
+ workingDirectory
74478
+ )
74479
+ process.exit(1)
74480
+ }
74481
+
74471
74482
  // enforce the same NPM cache folder across different operating systems
74472
74483
  const NPM_CACHE_FOLDER = path.join(homeDirectory, '.npm')
74473
74484
  const getNpmCache = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/github-action",
3
- "version": "5.5.1",
3
+ "version": "5.6.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",
@@ -12,9 +12,10 @@
12
12
  "scripts": {
13
13
  "test": "echo \"There are no tests :(\"",
14
14
  "build": "ncc build -o dist index.js",
15
- "format": "prettier --write index.js",
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
- "update:cypress": "./scripts/update-cypress-latest.sh"
17
+ "update:cypress": "./scripts/update-cypress-latest.sh",
18
+ "prepare": "husky install"
18
19
  },
19
20
  "repository": {
20
21
  "type": "git",
@@ -45,18 +46,13 @@
45
46
  "supports-color": "9.3.1"
46
47
  },
47
48
  "devDependencies": {
48
- "@types/node": "18.15.3",
49
+ "@types/node": "18.15.10",
49
50
  "@vercel/ncc": "0.36.1",
50
- "husky": "7.0.4",
51
+ "husky": "8.0.3",
51
52
  "markdown-link-check": "3.11.0",
52
53
  "prettier": "2.8.4"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
56
- },
57
- "husky": {
58
- "hooks": {
59
- "pre-commit": "npm run format && npm run build && git add index.js dist"
60
- }
61
57
  }
62
58
  }