Files
cypress/circle.yml
T
Gleb Bahmutov 1aa47d2671 CircleCI v2 (#60)
* each container runs its own commands and it is easy to modify which commands are were (multiline format)
* setup is super fast because all deps are in base docker image (well, except for Chrome) and node_modules are cached
2017-05-18 18:16:16 -04:00

188 lines
5.9 KiB
YAML

version: 2
jobs:
build:
docker:
# the Docker image with Node and XVFB
- image: beneaththeink/node-xvfb:6
# - image: node:6.5.0
working_directory: ~/cypress-monorepo
parallelism: 3
steps:
- checkout
# need to restore a separate cache for each package.json
- restore_cache:
key: v1-root-deps
- restore_cache:
key: v1-deps-coffee
- restore_cache:
key: v1-deps-desktop-gui
- restore_cache:
key: v1-deps-driver
- restore_cache:
key: v1-deps-example
- restore_cache:
key: v1-deps-electron
- restore_cache:
key: v1-deps-extension
- restore_cache:
key: v1-deps-https-proxy
- restore_cache:
key: v1-deps-launcher
- restore_cache:
key: v1-deps-reporter
- restore_cache:
key: v1-deps-runner
- restore_cache:
key: v1-deps-server
- restore_cache:
key: v1-deps-socket
- restore_cache:
key: v1-deps-static
- restore_cache:
key: v1-deps-ts
- restore_cache:
key: v1-deps-docs
# why is the `npm install` on CircleCI so verbose?
- run: echo 'loglevel=warn' >> ~/.npmrc
- run: npm install
- run: npm run all install
- run: cd docs && npm install
# save each node_modules folder per package
- save_cache:
key: v1-root-deps-{{ checksum "package.json" }}
paths:
- node_modules
- save_cache:
key: v1-deps-coffee-{{ checksum "packages/coffee/package.json" }}
paths:
- packages/coffee/node_modules
- save_cache:
key: v1-deps-desktop-gui-{{ checksum "packages/desktop-gui/package.json" }}
paths:
- packages/desktop-gui/node_modules
- save_cache:
key: v1-deps-driver-{{ checksum "packages/driver/package.json" }}
paths:
- packages/driver/node_modules
- save_cache:
key: v1-deps-example-{{ checksum "packages/example/package.json" }}
paths:
- packages/example/node_modules
- save_cache:
key: v1-deps-electron-{{ checksum "packages/electron/package.json" }}
paths:
- packages/electron/node_modules
- save_cache:
key: v1-deps-extension-{{ checksum "packages/extension/package.json" }}
paths:
- packages/extension/node_modules
- save_cache:
key: v1-deps-https-proxy-{{ checksum "packages/https-proxy/package.json" }}
paths:
- packages/https-proxy/node_modules
- save_cache:
key: v1-deps-launcher-{{ checksum "packages/launcher/package.json" }}
paths:
- packages/launcher/node_modules
- save_cache:
key: v1-deps-reporter-{{ checksum "packages/reporter/package.json" }}
paths:
- packages/reporter/node_modules
- save_cache:
key: v1-deps-runner-{{ checksum "packages/runner/package.json" }}
paths:
- packages/runner/node_modules
- save_cache:
key: v1-deps-server-{{ checksum "packages/server/package.json" }}
paths:
- packages/server/node_modules
- save_cache:
key: v1-deps-socket-{{ checksum "packages/socket/package.json" }}
paths:
- packages/socket/node_modules
- save_cache:
key: v1-deps-static-{{ checksum "packages/static/package.json" }}
paths:
- packages/static/node_modules
- save_cache:
key: v1-deps-ts-{{ checksum "packages/ts/package.json" }}
paths:
- packages/ts/node_modules
- save_cache:
key: v1-deps-docs-{{ checksum "docs/package.json" }}
paths:
- docs/node_modules
#
# things to run in the 1st CI container
#
- run:
name: Running linters
command: |
if [ $CIRCLE_NODE_INDEX == 0 ]; then
npm run all lint
fi
- run:
name: Fast unit tests
command: |
if [ $CIRCLE_NODE_INDEX == 0 ]; then
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 -- --package server
fi
#
# things to run in the 2nd CI container
#
- run:
name: Docs - innstalling dependencies
command: |
if [ $CIRCLE_NODE_INDEX == 1 ]; then
cd docs
npm install
npm run build
fi
- run:
name: Docs - verifying Cypress
command: |
if [ $CIRCLE_NODE_INDEX == 1 ]; then
set -o xtrace
cd docs
npm run precypress
$(npm bin)/cypress --help
$(npm bin)/cypress --version
$(npm bin)/cypress verify
fi
- run:
name: Docs - running E2E tests
command: |
if [ $CIRCLE_NODE_INDEX == 1 ]; then
cd docs
npm run test-e2e
fi
#
# things to run in the 3rd CI container
#
- run:
name: Driver unit tests
command: |
if [ $CIRCLE_NODE_INDEX == 2 ]; then
npm run all test -- --package driver
fi