-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add info around next version, testing other projects (#19157)
Co-authored-by: Matt Henkes <mjhenkes@gmail.com> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Tyler Biethman <tbiethman@users.noreply.github.com>
- Loading branch information
1 parent
2c9cb68
commit 42dfb8a
Showing
9 changed files
with
164 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Guides | ||
|
||
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. | ||
|
||
For information about using Cypress for testing web applications, visit [`docs.cypress.io`](https://docs.cypress.io). | ||
|
||
For information related to a specific package in the monorepo, see that package's respective `README.md`. | ||
|
||
For general contributor information, check out [`CONTRIBUTING.md`](../CONTRIBUTING.md). | ||
|
||
## Table of Contents | ||
|
||
* [Building release artifacts](./building-release-artifacts.md) | ||
* [Code signing](./code-signing.md) | ||
* [Determining the next version of Cypress to be released](./next-version.md) | ||
* [Release process](./release-process.md) | ||
* [Testing other projects](./testing-other-projects.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Building Release Artifacts | ||
|
||
The `cypress` NPM package consists of two main parts: | ||
|
||
1. The `cypress` NPM package `.tgz` (built from [`cli`](../cli)) | ||
* Contains the command line tool `cypress`, type definitions, and the [Module API](https://on.cypress.io/module-api). | ||
* End users install this via NPM to the project's `node_modules`. | ||
2. The "binary" `.zip` (built from [`packages/server`](../packages/server)) | ||
* 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) | ||
* Also contains all the production dependencies of the above. | ||
* This is installed when the `cli` is installed or when `cypress install` is run, to a system cache. | ||
|
||
This guide has instructions for building both. | ||
|
||
## Building the npm package | ||
|
||
> :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). | ||
Building a new npm package is two commands: | ||
|
||
1. Increment the version in the root `package.json` | ||
2. `yarn build --scope cypress` | ||
|
||
The steps above: | ||
|
||
- Build the `cypress` npm package | ||
- Transpile the code into ES5 to be compatible with the common Node versions | ||
- Put the result into the [`cli/build`](../cli/build) folder. | ||
|
||
## Building the binary | ||
|
||
> :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). | ||
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. | ||
|
||
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`. | ||
|
||
`yarn binary-zip` can be used to zip the built binary together. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Code Signing | ||
|
||
Code signing is done for the Windows and Mac distributions of Cypress when they are built in CI. | ||
|
||
`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). | ||
|
||
## Installing a new Mac code signing key | ||
|
||
Follow the directions supplied by `electron-builder`: https://www.electron.build/code-signing#travis-appveyor-and-other-ci-servers | ||
|
||
Set the environment variables `CSC_LINK` and `CSC_KEY_PASSWORD` in the `test-runner:sign-mac-binary` CircleCI context. | ||
|
||
## Installing a new Windows code signing key | ||
|
||
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-----`) | ||
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. | ||
```shell | ||
➜ openssl pkcs12 -export -inkey key.pem -in cert.pem -out encrypted.pfx | ||
Enter Export Password: <password> | ||
Verifying - Enter Export Password: <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). | ||
4. Within the `test-runner:sign-windows-binary` CircleCI context, set `CSC_LINK` to that URL and `CSC_KEY_PASSWORD` to the password. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Next Version | ||
|
||
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). | ||
|
||
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. | ||
|
||
The `get-next-version.js` script follows these steps: | ||
|
||
1. If the environment variable `NEXT_VERSION` exists, print `NEXT_VERSION` and exit. | ||
2. Otherwise, analyze the commits to the current branch since the last release, using semantic commit messages. Print out the calculated version. | ||
* Only commits that touch files in `packages/*` or `cli/*` are considered. | ||
* This is done so that commits to the `npm/` packages do not necessarily bump the CLI and binary versions. | ||
* This project uses the [`angular` commit message style](https://gist.github.com/brianclements/841ea7bffdb01346392c/8e1f9b44d3fc7a4f2b448581071f9805f759c912). | ||
* The prefix `fix:` will trigger a patch version bump. | ||
* The prefix `feat:` will trigger a minor version bump. | ||
* A commit with the footer containing `BREAKING CHANGE:` should trigger a major version bump. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Testing other projects | ||
|
||
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. | ||
|
||
Two main strategies are used to spawn these test projects: | ||
|
||
1. Local CI | ||
2. Remote CI | ||
|
||
## Local CI | ||
|
||
A number of CI jobs in `circle.yml` clone test projects and run tests as part of `cypress-io/cypress`'s CI pipeline. | ||
|
||
You can find a list of test projects that do this by searching for usage of the `test-binary-against-repo` step. | ||
|
||
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. | ||
|
||
One advantage to local CI is that it does not require creating commits to another repo. | ||
|
||
## Remote CI | ||
|
||
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. | ||
|
||
This script creates commits inside of several test projects (hence "Remote CI") in order to trigger a realistic, continous-integration test of Cypress. | ||
|
||
For a list of the projects, see the definition of `_PROVIDERS` in [`/scripts/binary/bump.js`](../scripts/binary/bump.js). | ||
|
||
For each project and operating system combo in `_PROVIDERS`, the script: | ||
|
||
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) | ||
* Note the commit is specifically for `linux`, and only the `linux-tests` job runs to completion. | ||
* 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. | ||
* 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. | ||
* Otherwise, the default branch is used for the commit. | ||
2. Creates a status check in this GitHub repo (`cypress-io/cypress`) and marks it `pending`. | ||
3. Waits for the test project's CI workflow to finish running. | ||
* 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. | ||
* Each test project is configured to update the `pending` CI job in `cypress-io/cypress` to a `success` when the CI workflow successfully finishes. | ||
|
||
These tests add coverage to the Cypress code base by: | ||
|
||
* 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) | ||
* Testing in a variety of environments | ||
* Different Node.js versions | ||
* Different operating systems | ||
* A multitude of CI providers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42dfb8a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
42dfb8a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppVeyor has built the
win32 x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
42dfb8a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: