Files
cypress/circle.yml
Gleb Bahmutov 8e1776c870 Issue 146: uniform CLI error reporting (#149)
* cli: shorter install message without undefined for #146

* cli: show relative path after install

* cli: debug install process

* cli: print message if using CYPRESS_VERSION

* cli: tests for CYPRESS_VERSION install

* cli: needed version message

* cli: verify app after download on install

* cli: do not verify app on install, wait until it runs

* cli: add verify command

* cli: good messags for missing app binary

* cli: xvfb error

* add missing app error

* linting

* cli: errors reported using same function

* print stack in error message for some errors

* show path checked

* use same error mechanism for download errors

* cli: unzip should report error the same way as the rest of CLI

* update some error language

* consolidate urls in error messages

* show terminal info

* terminal check outside of code

* cli: detect CI, do not use progress bar

* cli: test mock bar

* remove context.only
2017-06-09 17:37:48 -04:00

227 lines
7.9 KiB
YAML

version: 2
jobs:
build:
docker:
# the Docker image with Cypress dependencies and Chrome browser
- image: cypress/internal:chrome58
environment:
## this enables colors + fixes failing unit tests
TERM: xterm
npm_config_loglevel: warn
# even when running as non-root user
# need to set unsafe perm to be able to do `npm postinstall`
npm_config_unsafe-perm: true
working_directory: ~/cypress-monorepo
parallelism: 4
steps:
- checkout
## make sure the TERM is set to 'xterm' in node
## else colors (and tests) will fail
## See the following information
## * http://andykdocs.de/development/Docker/Fixing+the+Docker+TERM+variable+issue
## * https://unix.stackexchange.com/questions/43945/whats-the-difference-between-various-term-variables
- run:
name: Checking TERM is set
command: |
echo 'term env var is:' $TERM
node -e 'assert.equal(process.env.TERM, "xterm", "need TERM to be set for Docker to work")'
node -e 'console.log("TERM %s stdout.isTTY?", process.env.TERM, process.stdout.isTTY)'
# need to restore a separate cache for each package.json
- restore_cache:
key: v5-{{ .Branch }}-root-deps
- restore_cache:
key: v5-{{ .Branch }}-deps-coffee
- restore_cache:
key: v5-{{ .Branch }}-deps-desktop-gui
- restore_cache:
key: v5-{{ .Branch }}-deps-driver
- restore_cache:
key: v5-{{ .Branch }}-deps-example
- restore_cache:
key: v7-{{ .Branch }}-deps-electron
- restore_cache:
key: v5-{{ .Branch }}-deps-extension
- restore_cache:
key: v5-{{ .Branch }}-deps-https-proxy
- restore_cache:
key: v5-{{ .Branch }}-deps-launcher
- restore_cache:
key: v5-{{ .Branch }}-deps-reporter
- restore_cache:
key: v5-{{ .Branch }}-deps-runner
- restore_cache:
key: v5-{{ .Branch }}-deps-server
- restore_cache:
key: v5-{{ .Branch }}-deps-socket
- restore_cache:
key: v5-{{ .Branch }}-deps-static
- restore_cache:
key: v5-{{ .Branch }}-deps-ts
- restore_cache:
key: v5-{{ .Branch }}-deps-docs
# only installs the root dependencies, without going into packages
# via postinstall script
- run: npm install --ignore-scripts
## symlink all of our sub packages in node_modules
- run: npm run link
## now install all of the sub packages node_modules
- run: npm run all install -- --serial
# save each node_modules folder per package
- save_cache:
key: v5-{{ .Branch }}-root-deps-{{ checksum "package.json" }}
paths:
- node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-coffee-{{ checksum "packages/coffee/package.json" }}
paths:
- packages/coffee/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-desktop-gui-{{ checksum "packages/desktop-gui/package.json" }}
paths:
- packages/desktop-gui/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-driver-{{ checksum "packages/driver/package.json" }}
paths:
- packages/driver/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-example-{{ checksum "packages/example/package.json" }}
paths:
- packages/example/node_modules
- save_cache:
key: v7-{{ .Branch }}-deps-electron-{{ checksum "packages/electron/package.json" }}
paths:
- packages/electron/node_modules
- ~/.cache/electron
- ~/.electron
- save_cache:
key: v5-{{ .Branch }}-deps-extension-{{ checksum "packages/extension/package.json" }}
paths:
- packages/extension/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-https-proxy-{{ checksum "packages/https-proxy/package.json" }}
paths:
- packages/https-proxy/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-launcher-{{ checksum "packages/launcher/package.json" }}
paths:
- packages/launcher/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-reporter-{{ checksum "packages/reporter/package.json" }}
paths:
- packages/reporter/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-runner-{{ checksum "packages/runner/package.json" }}
paths:
- packages/runner/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-server-{{ checksum "packages/server/package.json" }}
paths:
- packages/server/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-socket-{{ checksum "packages/socket/package.json" }}
paths:
- packages/socket/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-static-{{ checksum "packages/static/package.json" }}
paths:
- packages/static/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-ts-{{ checksum "packages/ts/package.json" }}
paths:
- packages/ts/node_modules
- save_cache:
key: v5-{{ .Branch }}-deps-docs-{{ checksum "docs/package.json" }}
paths:
- docs/node_modules
## now go build all of subpackages
- run: npm run build
#
# things to run in the 1st CI container
#
- run:
name: Running linters
command: |
if [ $CIRCLE_NODE_INDEX == 0 ]; then
npm run lint
npm run all lint
fi
- run:
name: Fast unit tests
command: |
if [ $CIRCLE_NODE_INDEX == 0 ]; then
npm run all test -- --package cli
npm run all test -- --package coffee
npm run all test -- --package desktop-gui
npm run all test -- --package electron
npm run all test -- --package extension
npm run all test -- --package https-proxy
npm run all test -- --package launcher
npm run all test -- --package reporter
npm run all test -- --package runner
npm run all test -- --package socket
npm run all test -- --package static
fi
- run:
name: Server unit tests
command: |
if [ $CIRCLE_NODE_INDEX == 0 ]; then
npm run all test-unit -- --package server
fi
- run:
name: Server integration tests
command: |
if [ $CIRCLE_NODE_INDEX == 0 ]; then
whoami
npm run all test-integration -- --package server
fi
#
# things to run in the 2nd CI container
#
- run:
name: Server E2E tests (electron)
command: |
if [ $CIRCLE_NODE_INDEX == 1 ]; then
npm run all test-e2e -- --package server
fi
#
# things to run in the 3rd CI container
#
- run:
name: Docs - running E2E tests
command: |
if [ $CIRCLE_NODE_INDEX == 2 ]; then
cd docs
npm run test-e2e
fi
#
# things to run in the 4th CI container
#
- run:
name: Driver unit tests
command: |
if [ $CIRCLE_NODE_INDEX == 3 ]; then
chrome --version
xvfb-run -as "-screen 0 1280x720x16" npm run all test -- --package driver
fi
#
# things to run in the 4th CI container
#
# - run:
# name: Example e2e tests
# command: |
# if [ $CIRCLE_NODE_INDEX == 3 ]; then
# # ./bin/cypress --project=./packages/example --path-to-cypress
# # xvfb-run -as "-screen 0 1280x720x16" npm start -- --project=./packages/example
# fi