Build osx on circle 2958 (#2978)

* use arch when caching dependencies on Circle

* add mac job

* hmm, mac name

* executor name

* use circle v2.1

* circle 2.1 cannot have job names start with a digit

* hmm, separate mac workflow

* shared build job via executor

* allow Node version mismatch on CircleCI Mac build

* correct workflow names per os

* do not check TERM on darwin platform

* move terminal check into a node script

* lint on both mac and linux

* pass linter

* enable full linux workflow

* try building on mac

* use xcode with Node 8.x

* try mac 9.1.0

* xcode 9.0.1

* run prebuild serially

* add node sass rebuild to desktop gui

* build on mac platform

* print identity on mac

* disable Mac workflow for now
This commit is contained in:
Gleb Bahmutov
2018-12-21 16:43:47 -05:00
committed by GitHub
parent d3193d5ec0
commit b5b41febf1
6 changed files with 144 additions and 70 deletions

View File

@@ -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: <<parameters.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

View File

@@ -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": [

View File

@@ -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",

View File

@@ -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",

14
scripts/check-terminal.js Normal file
View File

@@ -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)

View File

@@ -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')