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.
ℹ️ See the publishing section for how to build, test and publish a new official version of the binary and
cypress
NPM package.
We build the NPM package and binary on all major platforms (Linux, Mac, Windows) on different CI providers. In order to set the version while building we have to set the environment variable with the new version on each CI provider before starting the build.
Use the script command below to to do this.
npm run set-next-ci-version
⚠️ Note: The steps in this section are automated in CI, and you should not generally need to do them yourself.
Building a new NPM package is very quick.
- Increment the version in the root
package.json
cd cli && npm run build
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
folder.
You could publish from there, but first you need to build and upload the binary with the same version;
this guarantees that when users do npm i cypress@<x.y.z>
they can download the binary
with the same version x.y.z
from Cypress's CDN service.
⚠️ Note: The steps in this section are automated in CI, and you should not generally need to do them yourself.
First, you need to build, zip and upload the application binary to the Cypress server.
You can use a single command to do all tasks at once:
npm run binary-deploy
Or you can specify each command separately:
npm run binary-build
npm run binary-zip
npm run binary-upload
You can pass options to each command to avoid answering questions, for example
npm run binary-deploy -- --platform darwin --version 0.20.0
npm run binary-upload -- --platform darwin --version 0.20.0 --zip cypress.zip
If something goes wrong, see the debug messages using the DEBUG=cypress:binary ...
environment
variable.
Because we had many problems reliably zipping the built binary, for now we need to build both the Mac and Linux binary from Mac (Linux binary is built using a Docker container), then zip it from Mac, then upload it.
If you are using a Mac you can build the linux binary if you have docker installed.
npm run binary-build-linux
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
:
- Build the NPM package with the new target version baked in.
- Build the Linux/Mac binaries on CircleCI and build Windows on AppVeyor.
- Upload the binaries and the new NPM package to
cdn.cypress.io
under the "beta" folder. - Launch the test projects like cypress-test-node-versions and cypress-test-example-repos using the newly-uploaded package & binary instead of installing from the NPM registry. That installation looks like this:
export CYPRESS_INSTALL_BINARY=https://cdn.../binary/<new version>/<commit hash>/cypress.zip npm i https://cdn.../npm/<new version>/<commit hash>/cypress.tgz
Multiple test projects are launched for each target operating system and the results are reported back to GitHub using status checks so that you can see if a change has broken real-world usage of Cypress. You can see the progress of the test projects by opening the status checks on GitHub:
Once the develop
branch for all test projects are reliably passing with the new changes, publishing can proceed.
In the following instructions, "X.Y.Z" is used to denote the version of Cypress being published.
- Make sure that if there is a new
cypress-example-kitchensink
version, the corresponding dependency inpackages/example
has been updated to that new version. - Make sure that you have the correct environment variables set up before proceeding.
- You'll need Cypress AWS access keys in
aws_credentials_json
, which looks like this:aws_credentials_json={"bucket":"cdn.cypress.io","folder":"desktop","key":"...","secret":"..."}
- You'll need a GitHub token, a CircleCI token,
and a
cypress-io
account-specific AppVeyor token inci_json
:ci_json={"githubToken":"...","circleToken":"...","appVeyorToken":"..."}
- Tip: Use as-a to manage environment variables for different situations.
- You'll need Cypress AWS access keys in
- Use the
move-binaries
script to move the binaries for<commit sha>
frombeta
to thedesktop
folder for<new target version>
npm run move-binaries -- --sha <commit sha> --version <new target version>
- Publish the new NPM package under the
dev
tag. The unique link to the package filecypress.tgz
is the one already tested above. You can publish to the NPM registry straight from the URL:npm publish https://cdn.../npm/X.Y.Z/<long sha>/cypress.tgz --tag dev
- Double-check that the new version has been published under the
dev
tag usingnpm info cypress
or available-versions. Example output:dist-tags: dev: 3.4.0 latest: 3.3.2
- Test
[email protected]
again to make sure everything is working. You can trigger test projects from the command line (if you have the appropriate permissions)node scripts/test-other-projects.js --npm [email protected] --binary X.Y.Z
- Test the new version of Cypress against the Cypress dashboard repo.
- Update and publish the changelog and any release-specific documentation changes in cypress-documentation.
- Make the new NPM version the "latest" version by updating the dist-tag
latest
to point to the new version:npm dist-tag add [email protected]
- Run
binary-release
to update the download the server's manifest, set the next CI version, and create an empty version commit:npm run binary-release -- --version X.Y.Z --commit
- If needed, push out any updated changes to the links manifest to
on.cypress.io
. - If needed, deploy the updated
cypress-example-kitchensink
toexample.cypress.io
by following these instructions under "Deployment". - Update the releases in ZenHub:
- Close the current release in ZenHub.
- Create a new patch release (and a new minor release, if this is a minor release) in ZenHub, and schedule them both to be completed 2 weeks from the current date.
- Bump
version
inpackage.json
and commit it todevelop
using a commit message likerelease X.Y.Z [skip ci]
- Tag this commit with
vX.Y.Z
and push that tag up. - Merge
develop
intomaster
and push that branch up. - Inside of cypress-io/release-automations:
- Publish GitHub release to cypress-io/cypress/releases using package
set-releases
:cd set-releases && npm run release-log -- --version X.Y.Z
- Add a comment to each GH issue that has been resolved with the new published version using package
issues-in-release
:cd issues-in-release && npm run do:comment -- --version X.Y.Z
- Publish GitHub release to cypress-io/cypress/releases using package
- Publish a new docker image in
cypress-docker-images
underincluded
for the new cypress version. - Decide on the next version that we will work on. For example, if we have just released
3.7.0
we probably will work on3.7.1
next. Set it on CI machines. - Try updating as many example projects to the new version. You probably want to update by using Renovate dependency issue like
cypress-example-todomvc
"Update Dependencies (Renovate Bot). Try updating at least the following projects:- https://github.com/cypress-io/cypress-example-todomvc
- https://github.com/cypress-io/cypress-example-todomvc-redux
- https://github.com/cypress-io/cypress-example-realworld
- https://github.com/cypress-io/cypress-example-recipes
- https://github.com/cypress-io/cypress-example-docker-compose
- https://github.com/cypress-io/cypress-example-api-testing
- https://github.com/cypress-io/angular-pizza-creator
- https://github.com/cypress-io/cypress-fiddle
- https://github.com/cypress-io/cypress-example-piechopper
- https://github.com/cypress-io/cypress-documentation
Take a break, you deserve it! 😎