@cypress/github-action 7.0.0 → 7.1.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 +57 -13
- package/action.yml +4 -0
- package/dist/index.js +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ The following examples demonstrate the actions' functions.
|
|
|
68
68
|
- Use [Yarn Modern](#yarn-modern)
|
|
69
69
|
- Use [Yarn Plug'n'Play](#yarn-plugnplay)
|
|
70
70
|
- Use [Yarn workspaces](#yarn-workspaces)
|
|
71
|
+
- Disable [package manager cache](#package-manager-cache-disable)
|
|
71
72
|
- Use [custom cache key](#custom-cache-key)
|
|
72
73
|
- Run tests on multiple [Node versions](#node-versions)
|
|
73
74
|
- Split [install and tests](#split-install-and-tests) into separate jobs
|
|
@@ -100,7 +101,7 @@ jobs:
|
|
|
100
101
|
steps:
|
|
101
102
|
- name: Checkout
|
|
102
103
|
uses: actions/checkout@v6
|
|
103
|
-
# Install
|
|
104
|
+
# Install dependencies with caching
|
|
104
105
|
# and run all Cypress tests
|
|
105
106
|
- name: Cypress run
|
|
106
107
|
uses: cypress-io/github-action@v7
|
|
@@ -566,15 +567,14 @@ jobs:
|
|
|
566
567
|
node: [20, 22, 24, 25]
|
|
567
568
|
name: E2E on Node v${{ matrix.node }}
|
|
568
569
|
steps:
|
|
570
|
+
- name: Checkout
|
|
571
|
+
uses: actions/checkout@v6
|
|
569
572
|
- name: Install Node.js
|
|
570
573
|
uses: actions/setup-node@v6
|
|
571
574
|
with:
|
|
572
575
|
node-version: ${{ matrix.node }}
|
|
573
576
|
- run: node -v
|
|
574
577
|
|
|
575
|
-
- name: Checkout
|
|
576
|
-
uses: actions/checkout@v6
|
|
577
|
-
|
|
578
578
|
- name: Cypress run
|
|
579
579
|
uses: cypress-io/github-action@v7
|
|
580
580
|
with:
|
|
@@ -663,7 +663,7 @@ jobs:
|
|
|
663
663
|
steps:
|
|
664
664
|
- name: Checkout
|
|
665
665
|
uses: actions/checkout@v6
|
|
666
|
-
# Install
|
|
666
|
+
# Install dependencies with caching
|
|
667
667
|
# and run all Cypress tests with `quiet` parameter
|
|
668
668
|
- name: Cypress run
|
|
669
669
|
uses: cypress-io/github-action@v7
|
|
@@ -1167,9 +1167,14 @@ jobs:
|
|
|
1167
1167
|
|
|
1168
1168
|
### pnpm
|
|
1169
1169
|
|
|
1170
|
-
The package manager `pnpm` is not pre-installed in [GitHub Actions runner images](https://github.com/actions/runner-images)
|
|
1170
|
+
The package manager `pnpm` is not pre-installed in [GitHub Actions runner images](https://github.com/actions/runner-images)
|
|
1171
|
+
(unlike npm and Yarn Classic) and so it must be installed in a separate workflow step (see below).
|
|
1172
|
+
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.
|
|
1171
1173
|
|
|
1172
|
-
The example below follows [pnpm recommendations](https://pnpm.io/continuous-integration#github-actions) for installing pnpm and caching the
|
|
1174
|
+
The example below follows [pnpm recommendations](https://pnpm.io/continuous-integration#github-actions) for installing pnpm and caching the
|
|
1175
|
+
[pnpm store](https://pnpm.io/cli/store).
|
|
1176
|
+
Follow the [Cypress pnpm configuration instructions](https://docs.cypress.io/app/get-started/install-cypress#pnpm-configuration)
|
|
1177
|
+
and apply them to your project, to enable pnpm to install the Cypress binary.
|
|
1173
1178
|
|
|
1174
1179
|
```yaml
|
|
1175
1180
|
name: example-basic-pnpm
|
|
@@ -1193,6 +1198,7 @@ jobs:
|
|
|
1193
1198
|
- name: Cypress run
|
|
1194
1199
|
uses: cypress-io/github-action@v7
|
|
1195
1200
|
with:
|
|
1201
|
+
package-manager-cache: false
|
|
1196
1202
|
working-directory: examples/basic-pnpm
|
|
1197
1203
|
```
|
|
1198
1204
|
|
|
@@ -1200,13 +1206,19 @@ jobs:
|
|
|
1200
1206
|
|
|
1201
1207
|
### pnpm workspaces
|
|
1202
1208
|
|
|
1203
|
-
The action does not directly support using [pnpm workspaces](https://pnpm.io/workspaces)
|
|
1209
|
+
The action does not directly support using [pnpm workspaces](https://pnpm.io/workspaces)
|
|
1210
|
+
(see feature request [#1144](https://github.com/cypress-io/github-action/issues/1144)).
|
|
1211
|
+
As a workaround, you can install dependencies and run Cypress tests in a workspace in separate steps.
|
|
1212
|
+
The snippet below shows this principle.
|
|
1204
1213
|
|
|
1205
1214
|
```yml
|
|
1206
1215
|
...
|
|
1207
1216
|
- name: Install dependencies
|
|
1208
|
-
|
|
1209
|
-
|
|
1217
|
+
uses: cypress-io/github-action@v7
|
|
1218
|
+
with:
|
|
1219
|
+
package-manager-cache: false
|
|
1220
|
+
runTests: false
|
|
1221
|
+
working-directory: examples/start-and-pnpm-workspaces
|
|
1210
1222
|
|
|
1211
1223
|
- name: Cypress test
|
|
1212
1224
|
uses: cypress-io/github-action@v7
|
|
@@ -1329,6 +1341,38 @@ jobs:
|
|
|
1329
1341
|
|
|
1330
1342
|
[](.github/workflows/example-start-and-yarn-workspaces.yml)
|
|
1331
1343
|
|
|
1344
|
+
### Package manager cache disable
|
|
1345
|
+
|
|
1346
|
+
When the action installs dependencies,
|
|
1347
|
+
it caches the package manager cache from npm or from Yarn 1 (Classic) by default,
|
|
1348
|
+
based on the [lockfile](#package-manager-cache) it discovers.
|
|
1349
|
+
If package manager caching is implemented separately from the action,
|
|
1350
|
+
for example to work with Yarn Modern or pnpm,
|
|
1351
|
+
then disable the actions' package manager caching by setting the parameter
|
|
1352
|
+
`package-manager-cache` to `false`.
|
|
1353
|
+
|
|
1354
|
+
GitHub's [actions/setup-node](https://github.com/actions/setup-node/blob/main/README.md) offers a convenient way to install a chosen version of Node.js
|
|
1355
|
+
and to set up caching of package manager caches in one step.
|
|
1356
|
+
|
|
1357
|
+
```yml
|
|
1358
|
+
name: Package manager caching
|
|
1359
|
+
on: push
|
|
1360
|
+
jobs:
|
|
1361
|
+
cypress-run:
|
|
1362
|
+
runs-on: ubuntu-24.04
|
|
1363
|
+
name:
|
|
1364
|
+
steps:
|
|
1365
|
+
- uses: actions/checkout@v6
|
|
1366
|
+
- uses: actions/setup-node@v6
|
|
1367
|
+
with:
|
|
1368
|
+
node-version: lts
|
|
1369
|
+
cache: 'pnpm'
|
|
1370
|
+
cache-dependency-path: pnpm-lock.yaml
|
|
1371
|
+
- uses: cypress-io/github-action@v7
|
|
1372
|
+
with:
|
|
1373
|
+
package-manager-cache: false
|
|
1374
|
+
```
|
|
1375
|
+
|
|
1332
1376
|
### Custom cache key
|
|
1333
1377
|
|
|
1334
1378
|
Sometimes the default cache key does not work. For example, if you cannot share the Node modules across Node versions due to native extensions. In that case pass your own `cache-key` parameter.
|
|
@@ -1345,12 +1389,12 @@ jobs:
|
|
|
1345
1389
|
node: [20, 22, 24, 25]
|
|
1346
1390
|
name: E2E on Node v${{ matrix.node }}
|
|
1347
1391
|
steps:
|
|
1392
|
+
- name: Checkout
|
|
1393
|
+
uses: actions/checkout@v6
|
|
1348
1394
|
- name: Install Node.js
|
|
1349
1395
|
uses: actions/setup-node@v6
|
|
1350
1396
|
with:
|
|
1351
1397
|
node-version: ${{ matrix.node }}
|
|
1352
|
-
- name: Checkout
|
|
1353
|
-
uses: actions/checkout@v6
|
|
1354
1398
|
# run Cypress tests and record them under the same run
|
|
1355
1399
|
# associated with commit SHA and just give a different group name
|
|
1356
1400
|
- name: Cypress run
|
|
@@ -1379,10 +1423,10 @@ jobs:
|
|
|
1379
1423
|
node: [20, 22, 24, 25]
|
|
1380
1424
|
name: E2E on Node v${{ matrix.node }}
|
|
1381
1425
|
steps:
|
|
1426
|
+
- uses: actions/checkout@v6
|
|
1382
1427
|
- uses: actions/setup-node@v6
|
|
1383
1428
|
with:
|
|
1384
1429
|
node-version: ${{ matrix.node }}
|
|
1385
|
-
- uses: actions/checkout@v6
|
|
1386
1430
|
- uses: cypress-io/github-action@v7
|
|
1387
1431
|
```
|
|
1388
1432
|
|
package/action.yml
CHANGED
|
@@ -83,6 +83,10 @@ inputs:
|
|
|
83
83
|
install-command:
|
|
84
84
|
description: 'Custom install command to use'
|
|
85
85
|
required: false
|
|
86
|
+
package-manager-cache:
|
|
87
|
+
description: 'Set to false to disable automatic package manager caching. By default, package manager caching is enabled.'
|
|
88
|
+
required: false
|
|
89
|
+
default: true
|
|
86
90
|
publish-summary:
|
|
87
91
|
description: 'Whether or not to publish a job summary'
|
|
88
92
|
required: false
|
package/dist/index.js
CHANGED
|
@@ -102775,8 +102775,16 @@ const installMaybe = () => {
|
|
|
102775
102775
|
return Promise.resolve()
|
|
102776
102776
|
}
|
|
102777
102777
|
|
|
102778
|
+
const packageManagerCacheEnabled = getInputBool(
|
|
102779
|
+
'package-manager-cache',
|
|
102780
|
+
true
|
|
102781
|
+
)
|
|
102782
|
+
const npmCachePromise = packageManagerCacheEnabled
|
|
102783
|
+
? restoreCachedNpm()
|
|
102784
|
+
: Promise.resolve(false)
|
|
102785
|
+
|
|
102778
102786
|
return Promise.all([
|
|
102779
|
-
|
|
102787
|
+
npmCachePromise,
|
|
102780
102788
|
restoreCachedCypressBinary()
|
|
102781
102789
|
]).then(([npmCacheHit, cypressCacheHit]) => {
|
|
102782
102790
|
debug(`npm cache hit ${npmCacheHit}`)
|
|
@@ -102791,8 +102799,11 @@ const installMaybe = () => {
|
|
|
102791
102799
|
}
|
|
102792
102800
|
|
|
102793
102801
|
debug('verifying Cypress binary')
|
|
102802
|
+
const saveNpmPromise = packageManagerCacheEnabled
|
|
102803
|
+
? saveCachedNpm()
|
|
102804
|
+
: Promise.resolve(undefined)
|
|
102794
102805
|
return verifyCypressBinary()
|
|
102795
|
-
.then(
|
|
102806
|
+
.then(() => saveNpmPromise)
|
|
102796
102807
|
.then(saveCachedCypressBinary)
|
|
102797
102808
|
})
|
|
102798
102809
|
})
|