Files
cypress/circle.yml
Gleb Bahmutov a2fecfc338 launcher: detect chrome on windows (#504)
close #504 

* launcher: detect chrome on windows

checks if file exists, then determines version using `wmic`

close #503

* launcher: detect canary and chromium

plus update types to latest

* add launcher as a CI job

* run launcher on Windows CI

* forgot to restore monorepo

* go back on Win CI
2017-09-26 12:55:06 -04:00

457 lines
14 KiB
YAML

version: 2
defaults: &defaults
parallelism: 1
working_directory: ~/cypress-monorepo
docker:
# the Docker image with Cypress dependencies and Chrome browser
- image: cypress/internal:chrome61
environment:
## this enables colors + fixes failing unit tests
TERM: xterm
CIRCLE_ARTIFACTS: /tmp/artifacts ## store artifacts here
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
jobs:
## code checkout and NPM installs
build:
<<: *defaults
steps:
- checkout
# print global NPM cache path
- run: echo $(npm -g bin)
## 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 }}-cli-deps
- 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
# show what is already cached globally
- run: ls $(npm -g bin)
- run: ls $(npm -g bin)/../lib/node_modules
# 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 }}-cli-deps-{{ checksum "cli/package.json" }}
paths:
- cli/node_modules
- 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
- run: npm run stop-only
## now go build all of subpackages
- run: npm run build
## save entire folder as artifact for other jobs to continue
## hmm, do not see a good way to cache it, since all code
## might change
- save_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
paths:
- /home/person/cypress-monorepo
lint:
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: npm run lint
- run: npm run all lint
"unit-tests":
<<: *defaults
parallelism: 1
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: npm run all test -- --package cli
- run: npm run all test -- --package coffee
- run: npm run all test -- --package desktop-gui
- run: npm run all test -- --package electron
- run: npm run all test -- --package extension
- run: npm run all test -- --package https-proxy
- run: npm run all test -- --package launcher
# how to pass Mocha reporter through zunder?
- run: npm run all test -- --package reporter
- run: npm run all test -- --package runner
- run: npm run all test -- --package socket
- run: npm run all test -- --package static
- store_test_results:
path: /tmp/cypress-monorepo
"server-unit-tests":
<<: *defaults
parallelism: 2
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: npm run all test-unit -- --package server
- store_test_results:
path: /tmp/cypress-monorepo
"server-integration-tests":
<<: *defaults
parallelism: 2
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: npm run all test-integration -- --package server
- store_test_results:
path: /tmp/cypress-monorepo
"server-e2e-tests-1":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: cd packages/server && npm run test-e2e -- --parallel 5 --index 0
- store_test_results:
path: /tmp/cypress-monorepo
"server-e2e-tests-2":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: cd packages/server && npm run test-e2e -- --parallel 5 --index 1
- store_test_results:
path: /tmp/cypress-monorepo
"server-e2e-tests-3":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: cd packages/server && npm run test-e2e -- --parallel 5 --index 2
- store_test_results:
path: /tmp/cypress-monorepo
"server-e2e-tests-4":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: cd packages/server && npm run test-e2e -- --parallel 5 --index 3
- store_test_results:
path: /tmp/cypress-monorepo
"server-e2e-tests-5":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: cd packages/server && npm run test-e2e -- --parallel 5 --index 4
- store_test_results:
path: /tmp/cypress-monorepo
"driver-integration-tests-1":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run:
command: cd packages/driver && npm start
background: true
- run: cd packages/driver && npm run test-integration -- --parallel 5 --index 0
- store_test_results:
path: /tmp/cypress-monorepo
- store_artifacts:
path: /tmp/artifacts
"driver-integration-tests-2":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run:
command: cd packages/driver && npm start
background: true
- run: cd packages/driver && npm run test-integration -- --parallel 5 --index 1
- store_test_results:
path: /tmp/cypress-monorepo
- store_artifacts:
path: /tmp/artifacts
"driver-integration-tests-3":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run:
command: cd packages/driver && npm start
background: true
- run: cd packages/driver && npm run test-integration -- --parallel 5 --index 2
- store_test_results:
path: /tmp/cypress-monorepo
- store_artifacts:
path: /tmp/artifacts
"driver-integration-tests-4":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run:
command: cd packages/driver && npm start
background: true
- run: cd packages/driver && npm run test-integration -- --parallel 5 --index 3
- store_test_results:
path: /tmp/cypress-monorepo
- store_artifacts:
path: /tmp/artifacts
"driver-integration-tests-5":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run:
command: cd packages/driver && npm start
background: true
- run: cd packages/driver && npm run test-integration -- --parallel 5 --index 4
- store_test_results:
path: /tmp/cypress-monorepo
- store_artifacts:
path: /tmp/artifacts
"desktop-gui-integration-tests-1":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: cd packages/desktop-gui && npm run build-prod
- run: cd packages/desktop-gui && npm run test-integration -- --parallel 3 --index 0
- store_test_results:
path: /tmp/cypress-monorepo
- store_artifacts:
path: /tmp/artifacts
"desktop-gui-integration-tests-2":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: cd packages/desktop-gui && npm run build-prod
- run: cd packages/desktop-gui && npm run test-integration -- --parallel 3 --index 1
- store_test_results:
path: /tmp/cypress-monorepo
- store_artifacts:
path: /tmp/artifacts
"desktop-gui-integration-tests-3":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: cd packages/desktop-gui && npm run build-prod
- run: cd packages/desktop-gui && npm run test-integration -- --parallel 3 --index 2
- store_test_results:
path: /tmp/cypress-monorepo
- store_artifacts:
path: /tmp/artifacts
"run-launcher":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: cd packages/launcher && node index.js
"build-binary":
<<: *defaults
steps:
- restore_cache:
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
- run: npm run binary-deploy -- --platform linux --version $NEXT_LINUX_BINARY_VERSION
workflows:
version: 2
build_and_test:
jobs:
- build
- lint:
requires:
- build
- unit-tests:
requires:
- build
- server-unit-tests:
requires:
- build
- server-integration-tests:
requires:
- build
- server-e2e-tests-1:
requires:
- build
- server-e2e-tests-2:
requires:
- build
- server-e2e-tests-3:
requires:
- build
- server-e2e-tests-4:
requires:
- build
- server-e2e-tests-5:
requires:
- build
- driver-integration-tests-1:
requires:
- build
- driver-integration-tests-2:
requires:
- build
- driver-integration-tests-3:
requires:
- build
- driver-integration-tests-4:
requires:
- build
- driver-integration-tests-5:
requires:
- build
- desktop-gui-integration-tests-1:
requires:
- build
- desktop-gui-integration-tests-2:
requires:
- build
- desktop-gui-integration-tests-3:
requires:
- build
- build-binary:
requires:
- build
- run-launcher:
requires:
- build
#
# 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
# # npm start -- --project=./packages/example
# fi