diff --git a/circle.yml b/circle.yml index 49445d575d..3edc7a7c5f 100644 --- a/circle.yml +++ b/circle.yml @@ -1,21 +1,38 @@ -version: 2 +version: 2.1 defaults: &defaults parallelism: 1 working_directory: ~/cypress - docker: - # the Docker image with Cypress dependencies and Chrome browser - - image: cypress/browsers:chrome64 - environment: - ## set specific timezone - TZ: "/usr/share/zoneinfo/America/New_York" + parameters: + executor: + type: executor + default: cy-doc + executor: <> + environment: + ## set specific timezone + TZ: "/usr/share/zoneinfo/America/New_York" - ## store artifacts here - CIRCLE_ARTIFACTS: /tmp/artifacts + ## store artifacts here + CIRCLE_ARTIFACTS: /tmp/artifacts - ## set so that e2e tests are consistent - COLUMNS: 100 - LINES: 24 + ## set so that e2e tests are consistent + COLUMNS: 100 + LINES: 24 + +executors: + # the Docker image with Cypress dependencies and Chrome browser + cy-doc: + docker: + - image: cypress/browsers:chrome64 + environment: + PLATFORM: linux + + # executor to run on Mac OS + mac: + macos: + xcode: "9.0.1" + environment: + PLATFORM: mac jobs: ## code checkout and NPM installs @@ -23,7 +40,6 @@ jobs: <<: *defaults steps: - checkout - - run: name: Print working folder command: echo $PWD @@ -38,52 +54,46 @@ jobs: command: npm -v - run: npm run check-node-version - ## make sure the TERM is set to 'xterm' in node + ## make sure the TERM is set to 'xterm' in node (Linux only) ## 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 and COLUMNS are set - command: | - node -e 'assert.ok(process.env.TERM === "xterm", `process.env.TERM=${process.env.TERM} and must be set to "xterm" for Docker to work`)' - node -e 'assert.ok(process.env.COLUMNS === "100", `process.env.COLUMNS=${process.env.COLUMNS} must be set to 100 for snapshots to pass`)' - node -e 'console.log("stdout.isTTY?", process.stdout.isTTY)' - node -e 'console.log("stderr.isTTY?", process.stderr.isTTY)' + - run: npm run check-terminal # need to restore a separate cache for each package.json - restore_cache: - key: v6-{{ .Branch }}-cli-deps + key: v6-{{ arch }}-{{ .Branch }}-cli-deps - restore_cache: - key: v5-{{ .Branch }}-root-deps + key: v5-{{ arch }}-{{ .Branch }}-root-deps - restore_cache: - key: v5-{{ .Branch }}-deps-coffee + key: v5-{{ arch }}-{{ .Branch }}-deps-coffee - restore_cache: - key: v5-{{ .Branch }}-deps-desktop-gui + key: v5-{{ arch }}-{{ .Branch }}-deps-desktop-gui - restore_cache: - key: v5-{{ .Branch }}-deps-driver + key: v5-{{ arch }}-{{ .Branch }}-deps-driver - restore_cache: - key: v5-{{ .Branch }}-deps-example + key: v5-{{ arch }}-{{ .Branch }}-deps-example - restore_cache: - key: v7-{{ .Branch }}-deps-electron + key: v7-{{ arch }}-{{ .Branch }}-deps-electron - restore_cache: - key: v5-{{ .Branch }}-deps-extension + key: v5-{{ arch }}-{{ .Branch }}-deps-extension - restore_cache: - key: v5-{{ .Branch }}-deps-https-proxy + key: v5-{{ arch }}-{{ .Branch }}-deps-https-proxy - restore_cache: - key: v5-{{ .Branch }}-deps-launcher + key: v5-{{ arch }}-{{ .Branch }}-deps-launcher - restore_cache: - key: v5-{{ .Branch }}-deps-reporter + key: v5-{{ arch }}-{{ .Branch }}-deps-reporter - restore_cache: - key: v5-{{ .Branch }}-deps-runner + key: v5-{{ arch }}-{{ .Branch }}-deps-runner - restore_cache: - key: v5-{{ .Branch }}-deps-server + key: v5-{{ arch }}-{{ .Branch }}-deps-server - restore_cache: - key: v5-{{ .Branch }}-deps-socket + key: v5-{{ arch }}-{{ .Branch }}-deps-socket - restore_cache: - key: v5-{{ .Branch }}-deps-static + key: v5-{{ arch }}-{{ .Branch }}-deps-static - restore_cache: - key: v5-{{ .Branch }}-deps-ts + key: v5-{{ arch }}-{{ .Branch }}-deps-ts # show what is already cached globally - run: ls $(npm -g bin) @@ -105,69 +115,69 @@ jobs: # save each node_modules folder per package - save_cache: - key: v6-{{ .Branch }}-cli-deps-{{ checksum "cli/package.json" }} + key: v6-{{ arch }}-{{ .Branch }}-cli-deps-{{ checksum "cli/package.json" }} paths: - cli/node_modules - save_cache: - key: v5-{{ .Branch }}-root-deps-{{ checksum "package.json" }} + key: v5-{{ arch }}-{{ .Branch }}-root-deps-{{ checksum "package.json" }} paths: - node_modules - save_cache: - key: v5-{{ .Branch }}-deps-coffee-{{ checksum "packages/coffee/package.json" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v7-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .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" }} + key: v5-{{ arch }}-{{ .Branch }}-deps-ts-{{ checksum "packages/ts/package.json" }} paths: - packages/ts/node_modules @@ -175,7 +185,8 @@ jobs: ## we update stop-only # - run: npm run stop-only ## now go build all of subpackages - - run: npm run build + - run: npm run prebuild -- --serial + - run: npm run build -- --serial ## save entire folder as artifact for other jobs to run without reinstalling - persist_to_workspace: @@ -191,7 +202,7 @@ jobs: - run: npm run lint - run: npm run all lint - "unit-tests": + unit-tests: <<: *defaults parallelism: 1 steps: @@ -323,7 +334,7 @@ jobs: - store_test_results: path: /tmp/cypress - "3x-driver-integration-tests": + "driver-integration-tests-3x": <<: *defaults parallelism: 3 steps: @@ -347,7 +358,7 @@ jobs: - store_artifacts: path: /tmp/artifacts - "2x-desktop-gui-integration-tests": + "desktop-gui-integration-tests-2x": <<: *defaults parallelism: 2 steps: @@ -395,14 +406,14 @@ jobs: command: node index.js working_directory: packages/launcher - "build-binary": + build-binary: <<: *defaults steps: - attach_workspace: at: ~/ - run: $(npm bin)/print-arch - - run: npm run binary-build -- --platform linux --version $NEXT_DEV_VERSION - - run: npm run binary-zip -- --platform linux + - run: npm run binary-build -- --platform $PLATFORM --version $NEXT_DEV_VERSION + - run: npm run binary-zip -- --platform $PLATFORM - run: ls -l *.zip - run: name: upload unique binary @@ -597,12 +608,22 @@ jobs: CYPRESS_ENV=staging \ $(npm bin)/cypress run --record + mac-os-build: + executor: mac + steps: + - run: + name: Show keychains + command: security list-keychains + - run: + name: Find code signing identity + command: security find-identity -v -p codesigning + workflows: - version: 2 - build_and_test: + linux: jobs: - build - lint: + name: Linux lint requires: - build # unit, integration and e2e tests @@ -639,10 +660,10 @@ workflows: - server-e2e-tests-8: requires: - build - - 3x-driver-integration-tests: + - driver-integration-tests-3x: requires: - build - - 2x-desktop-gui-integration-tests: + - desktop-gui-integration-tests-2x: requires: - build - run-launcher: @@ -676,6 +697,7 @@ workflows: branches: only: - develop + - build-osx-on-circle-2958 requires: - build - test-next-version: @@ -702,3 +724,35 @@ workflows: requires: - build-npm-package - build-binary + + # disable Mac build until we can figure CircleCI v2 story + # for code signing the built binary + # https://github.com/cypress-io/cypress/issues/2958 + + # mac: + # jobs: + # - build: + # name: Mac build + # executor: mac + # - lint: + # name: Mac lint + # executor: mac + # requires: + # - Mac build + # # maybe run unit tests? + # - mac-os-build: + # filters: + # branches: + # only: + # - develop + + # - build-binary: + # name: Mac binary + # executor: mac + # filters: + # branches: + # only: + # - develop + # requires: + # - Mac build + # - mac-os-build diff --git a/package.json b/package.json index d8a84ea96a..7a46b27d4b 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "decaffeinate-bulk": "bulk-decaffeinate", "check-deps": "node ./scripts/check-deps.js --verbose", "check-deps-pre": "node ./scripts/check-deps.js --verbose --prescript", - "prebuild": "npm run check-deps-pre", + "prebuild": "npm run check-deps-pre && npm run all prebuild", "build": "npm run all build", "all": "node ./scripts/run.js", "test": "echo '⚠️ This root monorepo is only for local development and new contributions. There are no tests.'", @@ -52,7 +52,9 @@ "test-scripts": "mocha --reporter spec scripts/unit/*spec.js", "test-mocha": "mocha --reporter spec scripts/spec.js", "test-mocha-snapshot": "mocha scripts/mocha-snapshot-spec.js", - "check-node-version": "node scripts/check-node-version.js" + "check-node-version": "node scripts/check-node-version.js", + "check-terminal": "node scripts/check-terminal.js", + "effective:circle:config": "circleci config process circle.yml | sed /^#/d" }, "lint-staged": { "*.js": [ diff --git a/packages/desktop-gui/package.json b/packages/desktop-gui/package.json index 59c3cc8ba3..b023bcbe71 100644 --- a/packages/desktop-gui/package.json +++ b/packages/desktop-gui/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "postinstall": "echo '@packages/desktop-gui needs: npm run build'", - "prebuild": "npm run check-deps-pre", + "prebuild": "npm run check-deps-pre && rebuild-node-sass", "build": "node ./scripts/build-dev.js", "prebuild-prod": "npm run check-deps-pre", "build-prod": "node ./scripts/build-prod.js", @@ -47,6 +47,7 @@ "prop-types": "^15.5.10", "rc-collapse": "^1.6.11", "react": "^15.6.1", + "rebuild-node-sass": "1.1.0", "react-bootstrap-modal": "3.0.1", "react-dom": "^15.6.1", "react-loader": "^2.4.0", diff --git a/packages/runner/package.json b/packages/runner/package.json index a6f5f7f13c..0d479a5527 100644 --- a/packages/runner/package.json +++ b/packages/runner/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "postinstall": "echo '@packages/runner needs: npm run build'", - "prebuild": "npm run check-deps-pre rebuild-node-sass", + "prebuild": "npm run check-deps-pre && rebuild-node-sass", "build": "node ./scripts/build-dev.js", "prebuild-prod": "npm run check-deps-pre", "build-prod": "node ./scripts/build-prod.js", diff --git a/scripts/check-terminal.js b/scripts/check-terminal.js new file mode 100644 index 0000000000..4b1e8f94b0 --- /dev/null +++ b/scripts/check-terminal.js @@ -0,0 +1,14 @@ +// checks if the terminal has all the variables set (especially on Linux Docker) + +const assert = require('assert') +const isLinux = process.platform === 'linux' + +if (isLinux) { + assert.ok(process.env.TERM === 'xterm', `process.env.TERM=${process.env.TERM} and must be set to "xterm" for Docker to work`) +} + +assert.ok(process.env.COLUMNS === '100', `process.env.COLUMNS=${process.env.COLUMNS} must be set to 100 for snapshots to pass`) + +/* eslint-disable no-console */ +console.log('stdout.isTTY?', process.stdout.isTTY) +console.log('stderr.isTTY?', process.stderr.isTTY) diff --git a/scripts/win-appveyor-build.js b/scripts/win-appveyor-build.js index 78911348e5..9e30e7990c 100755 --- a/scripts/win-appveyor-build.js +++ b/scripts/win-appveyor-build.js @@ -17,6 +17,7 @@ shell.set('-e') // any error is fatal const isRightBranch = () => { const branch = process.env.APPVEYOR_REPO_BRANCH + return branch === 'develop' } @@ -49,9 +50,11 @@ shell.exec(`npm run binary-build -- --platform windows --version ${version}`) // make sure we are not including dev dependencies accidentally // TODO how to get the server package folder? const serverPackageFolder = 'C:/projects/cypress/dist/win32/packages/server' + shell.echo(`Checking prod and dev dependencies in ${serverPackageFolder}`) -shell.exec('npm ls --prod --depth 0 || true', {cwd: serverPackageFolder}) -const result = shell.exec('npm ls --dev --depth 0 || true', {cwd: serverPackageFolder}) +shell.exec('npm ls --prod --depth 0 || true', { cwd: serverPackageFolder }) +const result = shell.exec('npm ls --dev --depth 0 || true', { cwd: serverPackageFolder }) + if (result.stdout.includes('nodemon')) { console.error('Hmm, server package includes dev dependency "nodemon"') console.error('which means somehow we are including dev dependencies in the output bundle')