You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -650,7 +650,7 @@ Below are some guidelines Cypress uses when reviewing dependency updates.
650
650
651
651
## Deployment
652
652
653
-
We will try to review and merge pull requests quickly. If you want to know our build process or build your own Cypress binary, read [DEPLOY.md](./DEPLOY.md).
653
+
We will try to review and merge pull requests quickly. If you want to know our build process or build your own Cypress binary, read [the "Release Process" guide](./guides/release-process.md).
654
654
655
655
Independent packages are deployed immediately upon being merged into master. You can read more [above](#independent-packages-ci-workflow).
The `guides` directory contains information about specific things encountered *when contributing to the Cypress project* that fall outside the scope of `CONTRIBUTING.md`, which is more geared towards everyday development in this repo.
4
+
5
+
For information about using Cypress for testing web applications, visit [`docs.cypress.io`](https://docs.cypress.io).
6
+
7
+
For information related to a specific package in the monorepo, see that package's respective `README.md`.
8
+
9
+
For general contributor information, check out [`CONTRIBUTING.md`](../CONTRIBUTING.md).
The `cypress` NPM package consists of two main parts:
4
+
5
+
1. The `cypress` NPM package `.tgz` (built from [`cli`](../cli))
6
+
* Contains the command line tool `cypress`, type definitions, and the [Module API](https://on.cypress.io/module-api).
7
+
* End users install this via NPM to the project's `node_modules`.
8
+
2. The "binary" `.zip` (built from [`packages/server`](../packages/server))
9
+
* Contains the Electron app, `ffmpeg`, and built versions of the [`server`](../packages/server), [`desktop-gui`](../packages/desktop-gui), [`runner`](../packages/runner), [`example` project](../packages/example), and [`extension`](../packages/extension)
10
+
* Also contains all the production dependencies of the above.
11
+
* This is installed when the `cli` is installed or when `cypress install` is run, to a system cache.
12
+
13
+
This guide has instructions for building both.
14
+
15
+
## Building the npm package
16
+
17
+
> :warning: Note: The steps in this section are automated in CI, and you should not need to do them yourself when going through the [release process](./release-process.md).
18
+
19
+
Building a new npm package is two commands:
20
+
21
+
1. Increment the version in the root `package.json`
22
+
2.`yarn build --scope cypress`
23
+
24
+
The steps above:
25
+
26
+
- Build the `cypress` npm package
27
+
- Transpile the code into ES5 to be compatible with the common Node versions
28
+
- Put the result into the [`cli/build`](../cli/build) folder.
29
+
30
+
## Building the binary
31
+
32
+
> :warning: Note: The steps in this section are automated in CI, and you should not need to do them yourself when going through the [release process](./release-process.md).
33
+
34
+
The npm package requires a corresponding binary of the same version. In production, it will try to retrieve the binary from the Cypress CDN if it is not cached locally.
35
+
36
+
You can build the Cypress binary locally by running `yarn binary-build`. You can use Linux to build the Cypress binary (just like it is in CI) by running `yarn binary-build` inside of `yarn docker`.
37
+
38
+
`yarn binary-zip` can be used to zip the built binary together.
Code signing is done for the Windows and Mac distributions of Cypress when they are built in CI.
4
+
5
+
`electron-builder` handles code signing during the `create-build-artifacts` jobs. This guide assumes that the reader is already familiar with [`electron-builder`'s Code Signing documentation](https://www.electron.build/code-signing).
6
+
7
+
## Installing a new Mac code signing key
8
+
9
+
Follow the directions supplied by `electron-builder`: https://www.electron.build/code-signing#travis-appveyor-and-other-ci-servers
10
+
11
+
Set the environment variables `CSC_LINK` and `CSC_KEY_PASSWORD` in the `test-runner:sign-mac-binary` CircleCI context.
12
+
13
+
## Installing a new Windows code signing key
14
+
15
+
1. Obtain the private key and full certificate chain in ASCII-armored PEM format and store each in a file (`-----BEGIN PRIVATE KEY-----`, `-----BEGIN CERTIFICATE-----`)
16
+
2. Using `openssl`, convert the plaintext PEM public and private key to binary PKCS#12/PFX format and encrypt it with a real strong password.
3. Upload the `encrypted.pfx` file to the Cypress App Google Drive and obtain a [direct download link](http://www.syncwithtech.org/p/direct-download-link-generator.html).
23
+
4. Within the `test-runner:sign-windows-binary` CircleCI context, set`CSC_LINK` to that URL and `CSC_KEY_PASSWORD` to the password.
When the Cypress CLI and binary are built in CI, the version number they share is determined by the script in [`/scripts/get-next-version.js`](../scripts/get-next-version.js).
4
+
5
+
In most cases, the script will correctly determine the next version. If it needs to be overridden, the environment variable `NEXT_VERSION` can be set to the desired version (`NEXT_VERSION=1.2.3`). This is commonly desired on a release branch or when trying to force a specific major version.
6
+
7
+
The `get-next-version.js` script follows these steps:
8
+
9
+
1. If the environment variable `NEXT_VERSION` exists, print `NEXT_VERSION` and exit.
10
+
2. Otherwise, analyze the commits to the current branch since the last release, using semantic commit messages. Print out the calculated version.
11
+
* Only commits that touch files in `packages/*` or `cli/*` are considered.
12
+
* This is done so that commits to the `npm/` packages do not necessarily bump the CLI and binary versions.
13
+
* This project uses the [`angular` commit message style](https://gist.github.com/brianclements/841ea7bffdb01346392c/8e1f9b44d3fc7a4f2b448581071f9805f759c912).
14
+
* The prefix `fix:` will trigger a patch version bump.
15
+
* The prefix `feat:` will trigger a minor version bump.
16
+
* A commit with the footer containing `BREAKING CHANGE:` should trigger a major version bump.
17
+
18
+
You can debug the script locally by running it using `node ./scripts/get-next-version.js`. It will analyze the commits on your current branch and print out the calculated version number.
Copy file name to clipboardExpand all lines: guides/release-process.md
+17-46Lines changed: 17 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,10 @@
1
-
# Deployment
1
+
# Release Process
2
2
3
-
These deployment procedures mainly concern the Cypress binary and `cypress` npm module.
3
+
These procedures concern the release process for the Cypress binary and `cypress` npm module.
4
4
5
-
Independent`@cypress/`packages that live inside the [`npm`](./npm) directory are automatically published to npm (with [`semantic-release`](https://semantic-release.gitbook.io/semantic-release/)) upon being merged into master. You can read more about this in [CONTRIBUTING.md](./CONTRIBUTING.md#committing-code)
5
+
The`@cypress/`-namespaced NPM packages that live inside the [`/npm`](../npm) directory are automatically published to npm (with [`semantic-release`](https://semantic-release.gitbook.io/semantic-release/)) upon being merged into `master`. You can read more about this in [CONTRIBUTING.md](../CONTRIBUTING.md#independent-packages-ci-workflow).
6
6
7
-
Anyone can build the binary and npm package, but you can only deploy the Cypress application and publish the npm module `cypress` if you are a member of the `cypress` npm organization.
8
-
9
-
> :information_source: See the [publishing](#publishing) section for how to build, test and publish a
10
-
new official version of the binary and `cypress` npm package.
11
-
12
-
## Building Locally
13
-
14
-
### Building the npm package
15
-
16
-
> :warning: Note: The steps in this section are automated in CI, and you should not need to do them yourself when publishing.
17
-
18
-
Building a new npm package is very quick.
19
-
20
-
- Increment the version in the root `package.json`
21
-
-`yarn build --scope cypress`
22
-
23
-
The steps above:
24
-
25
-
- Build the `cypress` npm package
26
-
- Transpile the code into ES5 to be compatible with the common Node versions
27
-
- Put the result into the [`cli/build`](./cli/build) folder.
28
-
29
-
### Building the binary
30
-
31
-
> :warning: Note: The steps in this section are automated in CI, and you should not need to do them yourself when publishing.
32
-
33
-
The npm package requires a corresponding binary of the same version. In production, it will try to retrieve the binary from the Cypress CDN if it is not cached locally.
34
-
35
-
You can build the Cypress binary locally by running `yarn binary-build`. You can use Linux to build the Cypress binary (just like it is in CI) by running `yarn binary-build` inside of `yarn docker`.
36
-
37
-
`yarn binary-zip` can be used to zip the built binary together.
7
+
[Anyone can build the binary and npm package locally](./building-release-artifacts.md), but you can only deploy the Cypress application and publish the npm module `cypress` if you are a member of the `cypress` npm organization.
38
8
39
9
## Publishing
40
10
@@ -60,6 +30,11 @@ You can build the Cypress binary locally by running `yarn binary-build`. You can
60
30
ZENHUB_API_TOKEN="..."
61
31
```
62
32
- The `cypress-bot` GitHub app credentials are also needed. Ask another team member who has done a deploy for those.
33
+
```text
34
+
GITHUB_APP_CYPRESS_INSTALLATION_ID=
35
+
GITHUB_APP_ID=
36
+
GITHUB_PRIVATE_KEY=
37
+
```
63
38
- For purging the Cloudflare cache (part of the `move-binaries` step), you'll need `CF_ZONEID` and `CF_TOKEN` set. These can be found in 1Password. If you don't have access, ask a team member who has done a deploy.
64
39
```text
65
40
CF_ZONEID="..."
@@ -69,16 +44,12 @@ You can build the Cypress binary locally by running `yarn binary-build`. You can
69
44
70
45
### Before Publishing a New Version
71
46
72
-
In order to publish a new `cypress` package to the npm registry, we must build and test it across multiple platforms and test projects. This makes publishing *directly* into the npm registry impossible. Instead, we have CI set up to do the following on every commit to `develop`:
47
+
In order to publish a new version of the `cypress` package to the npm registry, CI must build and test it across multiple platforms and test projects. CI is set up to do the following on every commit to `develop`:
73
48
74
-
1. Build the npm package with the new target version baked in.
49
+
1. Build the npm package with the [next target version](./next-version.md) baked in.
75
50
2. Build the Linux, Mac & Windows binaries on CircleCI.
76
-
3. Upload the binaries and the new npm package to `cdn.cypress.io` under the "beta" folder.
77
-
4. Launch the test projects like [cypress-test-node-versions](https://github.com/cypress-io/cypress-test-node-versions) and [cypress-test-example-repos](https://github.com/cypress-io/cypress-test-example-repos) using the newly-uploaded package & binary instead of installing from the npm registry. That installation looks like this:
npm i https://cdn.../npm/<new version>/<commit hash>/cypress.tgz
81
-
```
51
+
3. Upload the binaries and the new npm package to the AWS S3 Bucket `cdn.cypress.io` under the "beta" folder.
52
+
4. [Launch test projects](./testing-other-projects.md) using the newly-uploaded package & binary instead of installing from the npm registry.
82
53
83
54
Multiple test projects are launched for each target operating system and the results are reported
84
55
back to GitHub using status checks so that you can see if a change has broken real-world usage
@@ -90,11 +61,11 @@ Once the `develop` branch for all test projects are reliably passing with the ne
90
61
91
62
### Steps to Publish a New Version
92
63
93
-
In the following instructions, "X.Y.Z" is used to denote the version of Cypress being published.
64
+
In the following instructions, "X.Y.Z" is used to denote the [next version of Cypress being published](./next-version.md).
94
65
95
66
1. `develop` should contain all of the changes made in `master`. However, this occasionally may not be the case. Ensure that `master` does not have any additional commits that are not on `develop` and all auto-generated pull requests designed to merge master into develop have been successfully merged.
96
67
97
-
2. If there is a new [`cypress-example-kitchensink`](https://github.com/cypress-io/cypress-example-kitchensink/releases) version, update the corresponding dependency in [`packages/example`](./packages/example) to that new version.
68
+
2. If there is a new [`cypress-example-kitchensink`](https://github.com/cypress-io/cypress-example-kitchensink/releases) version, update the corresponding dependency in [`packages/example`](../packages/example) to that new version.
98
69
99
70
3. Use the `move-binaries` script to move the binaries for `<commit sha>` from `beta` to the `desktop` folder for `<new target version>`. This also purges the cloudflare cache for this version.
100
71
```shell
@@ -109,7 +80,7 @@ In the following instructions, "X.Y.Z" is used to denote the version of Cypress
- Publish to the npm registry straight from the URL:
111
82
```shell
112
-
npm publish https://cdn.../npm/X.Y.Z/<long sha>/cypress.tgz --tag dev
83
+
npm publish https://cdn.cypress.io/beta/npm/X.Y.Z/<long sha>/cypress.tgz --tag dev
113
84
```
114
85
115
86
5. Double-check that the new version has been published under the `dev` tag using `npm info cypress` or [available-versions](https://github.com/bahmutov/available-versions). `latest` should still point to the previous version. Example output:
@@ -156,7 +127,7 @@ In the following instructions, "X.Y.Z" is used to denote the version of Cypress
156
127
157
128
11. If needed, push out any updated changes to the links manifest to [`on.cypress.io`](https://github.com/cypress-io/cypress-services/tree/develop/packages/on).
158
129
159
-
12. If needed, deploy the updated [`cypress-example-kitchensink`][cypress-example-kitchensink] to `example.cypress.io` by following [these instructions under "Deployment"](./packages/example/README.md).
130
+
12. If needed, deploy the updated [`cypress-example-kitchensink`][cypress-example-kitchensink] to `example.cypress.io` by following [these instructions under "Deployment"](../packages/example/README.md).
160
131
161
132
13. Update the releases in [ZenHub](https://app.zenhub.com/workspaces/test-runner-5c3ea3baeb1e75374f7b0708/reports/release):
In `develop`, `master`, and any other branch configured in [`circle.yml`](../circle.yml), the Cypress binary and npm package are built and uploaded to `cdn.cypress.io`. Then, tests are run, using a variety of real-world example repositories.
4
+
5
+
Two main strategies are used to spawn these test projects:
6
+
7
+
1. Local CI
8
+
2. Remote CI
9
+
10
+
## Local CI
11
+
12
+
A number of CI jobs in `circle.yml` clone test projects and run tests as part of `cypress-io/cypress`'s CI pipeline.
13
+
14
+
You can find a list of test projects that do this by searching for usage of the `test-binary-against-repo` step.
15
+
16
+
Similarly to "Remote CI" test projects, Local CI test projects will attempt to check out a branch that is named after the [next version](./next-version.md) (`X.Y.Z`) if one exists in the test project git repo.
17
+
18
+
One advantage to local CI is that it does not require creating commits to another repo.
19
+
20
+
## Remote CI
21
+
22
+
After the production binary and NPM package are build and uploaded in CI, [`/scripts/test-other-projects.js`](../scripts/test-other-projects.js) is run as part of the `test-other-projects``circle.yml` step.
23
+
24
+
This script creates commits inside of several test projects (hence "Remote CI") in order to trigger a realistic, continous-integration test of Cypress.
25
+
26
+
For a list of the projects, see the definition of `_PROVIDERS` in [`/scripts/binary/bump.js`](../scripts/binary/bump.js).
27
+
28
+
For each project and operating system combo in `_PROVIDERS`, the script:
29
+
30
+
1. Creates a commit to the test project's GitHub repo using the API. [An example of such a commit.](https://github.com/cypress-io/cypress-test-tiny/commit/5b39f3f43f6b7598f0d57cffcba71a7048d1d809)
31
+
* Note the commit is specifically for `linux`, and only the `linux-tests` job runs to completion.
32
+
* If a branch exists that is named after the [next version](./next-version.md) (`X.Y.Z`), the commit will be made to that branch.
33
+
* This is useful to test a release's breaking changes or new features against an example project without having to have the project's main branch in a broken state.
34
+
* Otherwise, the default branch is used for the commit.
35
+
2. Creates a status check in this GitHub repo (`cypress-io/cypress`) and marks it `pending`.
36
+
3. Waits for the test project's CI workflow to finish running.
37
+
* Each test project is configured to use [`@cypress/commit-message-install`](https://github.com/cypress-io/commit-message-install) to configure the exact test required via the information in the commit message.
38
+
* Each test project is configured to update the `pending` CI job in `cypress-io/cypress` to a `success` when the CI workflow successfully finishes.
39
+
40
+
These tests add coverage to the Cypress code base by:
41
+
42
+
* Providing a super-close-to-real-world usage of Cypress (i.e. installing fresh from an NPM package and running in a bare repo using the repo's CI setup)
0 commit comments