Skip to content

Commit e77704d

Browse files
feat: add yarn 1 (classic) examples (#828)
* add workflow for yarn classic * Update .gitignore for yarn * modify update script for yarn classic * add yarn classic to readme * create yarn-classic examples --------- Co-authored-by: Bill Glesias <[email protected]>
1 parent d89e86b commit e77704d

File tree

14 files changed

+2458
-2
lines changed

14 files changed

+2458
-2
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: example-yarn-classic
2+
on:
3+
push:
4+
branches:
5+
- 'master'
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
11+
# ~~~~~~~~~~~~~~~~~~ Cypress v9 and below (using Legacy configuration) ~~~~~~~~~~~~~~~~~~~ #
12+
13+
yarn-classic-v9:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
19+
- name: Test with Yarn Classic
20+
uses: ./
21+
with:
22+
working-directory: examples/v9/yarn-classic
23+
24+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Cypress v10 and higher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
25+
26+
yarn-classic:
27+
runs-on: ubuntu-22.04
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
32+
- name: Test with Yarn Classic
33+
uses: ./
34+
with:
35+
working-directory: examples/yarn-classic

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,21 @@ examples/**/cypress/screenshots
44
examples/**/cypress/downloads
55
results.json
66
.vscode/
7+
8+
# Logs
9+
logs
10+
*.log
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
15+
# For Yarn Classic and Yarn Modern without Zero-Installs
16+
# see https://yarnpkg.com/getting-started/qa/#which-files-should-be-gitignored
17+
18+
examples/**/.pnp.*
19+
examples/**/.yarn/*
20+
!examples/**/.yarn/patches
21+
!examples/**/.yarn/plugins
22+
!examples/**/.yarn/releases
23+
!examples/**/.yarn/sdks
24+
!examples/**/.yarn/versions

README.md

+33-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
- pass [custom build id](#custom-build-id) when recording to Cypress Cloud
3636
- generate a [robust custom build id](#robust-custom-build-id) to allow re-running the workflow
3737
- use different [working-directory](#working-directory)
38+
- use [Yarn Classic](#yarn-classic)
39+
- use [Yarn workspaces](#yarn-workspaces)
3840
- use [custom cache key](#custom-cache-key)
3941
- run tests on multiple [Node versions](#node-versions)
4042
- split [install and tests](#split-install-and-tests) into separate jobs
@@ -993,6 +995,31 @@ jobs:
993995

994996
See [cypress-gh-action-subfolders](https://github.com/bahmutov/cypress-gh-action-subfolders) (legacy) for example.
995997

998+
### Yarn Classic
999+
1000+
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.
1001+
1002+
```yaml
1003+
name: example-yarn-classic
1004+
on: push
1005+
jobs:
1006+
yarn-classic:
1007+
runs-on: ubuntu-22.04
1008+
steps:
1009+
- name: Checkout
1010+
uses: actions/checkout@v3
1011+
- name: Cypress run
1012+
uses: cypress-io/github-action@v5
1013+
with:
1014+
working-directory: examples/yarn-classic
1015+
```
1016+
1017+
See [example-yarn-classic.yml](.github/workflows/example-yarn-classic.yml) for an example.
1018+
1019+
[![Yarn classic example](https://github.com/cypress-io/github-action/workflows/example-yarn-classic/badge.svg?branch=master)](.github/workflows/example-yarn-classic.yml)
1020+
1021+
See below under [Yarn Modern](#yarn-modern) (version 2 and later) for instructions on installing dependencies using this later version.
1022+
9961023
### Yarn workspaces
9971024

9981025
This action should discover the Yarn workspaces correctly. For example, see folder [examples/start-and-yarn-workspaces](examples/start-and-yarn-workspaces) and workflow file [example-start-and-yarn-workspaces.yml](.github/workflows/example-start-and-yarn-workspaces.yml)
@@ -1175,15 +1202,19 @@ See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-ex
11751202

11761203
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.
11771204

1178-
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:
1205+
#### Yarn Modern
1206+
1207+
The above default `yarn` installation command can be replaced for [Yarn Modern](https://yarnpkg.com/) (Yarn 2 and later) using the `install-command` parameter, for example:
11791208

11801209
```yml
11811210
- uses: cypress-io/github-action@v5
11821211
with:
11831212
install-command: yarn install
11841213
```
11851214

1186-
This action uses several production dependencies. The minimum Node version required to run this action depends on the minimum Node required by the dependencies.
1215+
#### Minimum Node.js
1216+
1217+
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.
11871218

11881219
## Debugging
11891220

examples/v9/yarn-classic/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# example: yarn-classic
2+
3+
This example demonstrates installing dependencies using [Yarn 1 (Classic)](https://classic.yarnpkg.com/lang/en/).

examples/v9/yarn-classic/cypress.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"fixturesFolder": false,
3+
"supportFile": false,
4+
"pluginsFile": false,
5+
"baseUrl": "https://example.cypress.io/"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// <reference types="cypress" />
2+
describe('example: yarn-classic', () => {
3+
it('loads the deployed site', () => {
4+
cy.visit('/')
5+
cy.contains('h1', 'Kitchen Sink')
6+
})
7+
})

examples/v9/yarn-classic/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "example-yarn-classic",
3+
"version": "1.0.0",
4+
"description": "Install dependencies using Yarn",
5+
"scripts": {
6+
"test": "cypress run"
7+
},
8+
"license": "MIT",
9+
"private": true,
10+
"devDependencies": {
11+
"cypress": "9.7.0"
12+
}
13+
}

0 commit comments

Comments
 (0)