mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-04 05:29:45 -06:00
* electron@7.x * node12.8.1-chrome78-ff70 * Revert "node12.8.1-chrome78-ff70" for now This reverts commitdb2d521994. * update sendCommand to log on all sendcommands * promisification in 6.x * Revert "Revert "node12.8.1-chrome78-ff70" for now" This reverts commit57fe764098. * fix sendcommand * fix cdp in electron * fix desktop-gui test * skip tests that will be fixed by #4973 * bump MAX_ALLOWED_FILE_SIZE :/ * update electron browser spec * make new dialog code null-proof * add failing e2e test for issue 5475 * bump electron packager * add e2e snapshot * update deprecated electron getters/setters https://github.com/electron/electron/blob/7-1-x/docs/api/modernization/property-updates.md * build and test on Mac * use electron-builder 20.41.0 that adds an option to use hardened Mac OS, which is necessary for code notarization later. See https://github.com/electron-userland/electron-builder/releases/tag/v20.41.0 and https://github.com/electron-userland/electron-builder/pull/3858 * electron-builder and pass hardenedRuntime: true * uncomment build * upload built binary on mac * back to 20.41.0, trying after sign hook without success * use current electron-builder alias instead of build * retry smoke test on first failure * testing * trying to notarize signed app (that does not have node_modules yet) * env variable names * copy node_modules ourselves * build and bundle binary on mac on circle, inject new context * enable build steps before electron build * increase mac build timeout * update build folder on mac * uncomment actual electron build command * set linux target to zip * set zip as target for all platforms * updated steps * put notarization hook back * tweaks for icons * remove dist electron before code sign * icons per platform * make node_modules copy path platform-specific * fix linux build unpacked folder * build mac * fix lint * test new mac binary against kitchensink * working on Linux build * try building entire thing on Linux * removing correct electron dist folder * increase zip size limit for now * add folder rename on Linux from linux-unpacked to Cypress * print file sizes before zipping * move linux-unpacked to build dir function * try deleting second electron file, but code signing probably would not work * test windows build [build binary] * ignore tsc errors * windows build path * windows [build binary] * update windows build folder * increase binary build timeout on Mac * no need to pass our dist folder * adding explicit list of additional binaries to code sign on mac * yarn lock * uncomment necessary build steps * electron dir for Linux * yarn lock again * back to execa v3 * use execa v4 in packages launcher * yarn lock again and again * updated tests that use execa * print build folder * add executable name on Linux * get rid of execa.shell in build scripts * remove old and commented out code * need to test building binary on Windows * throw error from after sign hook if fails * use execa to zip * yarn lock * fix after merge variable * update test * add nohoist ffmpeg installer * patch * yarn types pass * yarn lock has binary Co-authored-by: Zach Bloomquist <github@chary.us> Co-authored-by: Brian Mann <brian.mann86@gmail.com>
226 lines
6.3 KiB
CoffeeScript
226 lines
6.3 KiB
CoffeeScript
## store the cwd
|
|
cwd = process.cwd()
|
|
|
|
path = require("path")
|
|
_ = require("lodash")
|
|
os = require("os")
|
|
gift = require("gift")
|
|
chalk = require("chalk")
|
|
Promise = require("bluebird")
|
|
minimist = require("minimist")
|
|
la = require("lazy-ass")
|
|
check = require("check-more-types")
|
|
debug = require("debug")("cypress:binary")
|
|
questionsRemain = require("@cypress/questions-remain")
|
|
R = require("ramda")
|
|
|
|
zip = require("./zip")
|
|
ask = require("./ask")
|
|
bump = require("./bump")
|
|
meta = require("./meta")
|
|
build = require("./build")
|
|
upload = require("./upload")
|
|
uploadUtils = require("./util/upload")
|
|
{uploadNpmPackage} = require("./upload-npm-package")
|
|
{uploadUniqueBinary} = require("./upload-unique-binary")
|
|
{moveBinaries} = require('./move-binaries')
|
|
|
|
## initialize on existing repo
|
|
repo = Promise.promisifyAll(gift(cwd))
|
|
|
|
success = (str) ->
|
|
console.log chalk.bgGreen(" " + chalk.black(str) + " ")
|
|
|
|
fail = (str) ->
|
|
console.log chalk.bgRed(" " + chalk.black(str) + " ")
|
|
|
|
zippedFilename = R.always(upload.zipName)
|
|
|
|
# goes through the list of properties and asks relevant question
|
|
# resolves with all relevant options set
|
|
# if the property already exists, skips the question
|
|
askMissingOptions = (properties = []) ->
|
|
questions = {
|
|
platform: ask.whichPlatform,
|
|
version: ask.deployNewVersion,
|
|
# note: zip file might not be absolute
|
|
zip: ask.whichZipFile
|
|
nextVersion: ask.nextVersion
|
|
commit: ask.toCommit
|
|
}
|
|
pickedQuestions = _.pick(questions, properties)
|
|
questionsRemain(pickedQuestions)
|
|
|
|
## hack for @packages/server modifying cwd
|
|
process.chdir(cwd)
|
|
|
|
commitVersion = (version) ->
|
|
msg = "release #{version} [skip ci]"
|
|
|
|
repo.commitAsync(msg, {
|
|
'allow-empty': true,
|
|
})
|
|
|
|
deploy = {
|
|
meta: meta
|
|
|
|
parseOptions: (argv) ->
|
|
opts = minimist(argv, {
|
|
boolean: ["skip-clean"]
|
|
default: {
|
|
"skip-clean": false
|
|
}
|
|
alias: {
|
|
skipClean: "skip-clean",
|
|
zip: ["zipFile", "zip-file", "filename"]
|
|
}
|
|
})
|
|
opts.runTests = false if opts["skip-tests"]
|
|
if not opts.platform and os.platform() == meta.platforms.linux
|
|
# only can build Linux on Linux
|
|
opts.platform = meta.platforms.linux
|
|
|
|
# windows aliases
|
|
if opts.platform == "win32" or opts.platform == "win" or opts.platform == "windows"
|
|
opts.platform = meta.platforms.windows
|
|
|
|
if not opts.platform and os.platform() == meta.platforms.windows
|
|
# only can build Windows binary on Windows platform
|
|
opts.platform = meta.platforms.windows
|
|
|
|
# be a little bit user-friendly and allow aliased values
|
|
if opts.platform == "mac"
|
|
opts.platform = meta.platforms.darwin
|
|
|
|
debug("parsed command line options")
|
|
debug(opts)
|
|
opts
|
|
|
|
bump: ->
|
|
ask.whichBumpTask()
|
|
.then (task) ->
|
|
switch task
|
|
when "run"
|
|
bump.runTestProjects()
|
|
when "version"
|
|
ask.whichVersion(meta.distDir(""))
|
|
.then (v) ->
|
|
bump.version(v)
|
|
|
|
## sets environment variable on each CI provider
|
|
## to NEXT version to build
|
|
setNextVersion: ->
|
|
options = @parseOptions(process.argv)
|
|
|
|
askMissingOptions(['nextVersion'])(options)
|
|
.then ({nextVersion}) ->
|
|
bump.nextVersion(nextVersion)
|
|
|
|
release: ->
|
|
## read off the argv
|
|
options = @parseOptions(process.argv)
|
|
|
|
release = ({ version, commit, nextVersion }) =>
|
|
upload.s3Manifest(version)
|
|
.then ->
|
|
if commit
|
|
commitVersion(version)
|
|
.then ->
|
|
bump.nextVersion(nextVersion)
|
|
.then ->
|
|
success("Release Complete")
|
|
.catch (err) ->
|
|
fail("Release Failed")
|
|
throw err
|
|
|
|
askMissingOptions(['version', 'nextVersion'])(options)
|
|
.then(release)
|
|
|
|
build: (options) ->
|
|
console.log('#build')
|
|
options ?= @parseOptions(process.argv)
|
|
debug("parsed build options %o", options)
|
|
|
|
askMissingOptions(['version', 'platform'])(options)
|
|
.then ->
|
|
debug("building binary: platform %s version %s", options.platform, options.version)
|
|
build(options.platform, options.version, options)
|
|
|
|
zip: (options) ->
|
|
console.log('#zip')
|
|
if !options then options = @parseOptions(process.argv)
|
|
askMissingOptions(['platform'])(options)
|
|
.then (options) ->
|
|
zipDir = meta.zipDir(options.platform)
|
|
console.log("directory to zip %s", zipDir)
|
|
options.zip = path.resolve(zippedFilename(options.platform))
|
|
zip.ditto(zipDir, options.zip)
|
|
|
|
# upload Cypress NPM package file
|
|
"upload-npm-package": (args = process.argv) ->
|
|
console.log('#packageUpload')
|
|
uploadNpmPackage(args)
|
|
|
|
# upload Cypress binary zip file under unique hash
|
|
"upload-unique-binary": (args = process.argv) ->
|
|
console.log('#uniqueBinaryUpload')
|
|
uploadUniqueBinary(args)
|
|
|
|
# uploads a single built Cypress binary ZIP file
|
|
# usually a binary is built on CI and is uploaded
|
|
upload: (options) ->
|
|
console.log('#upload')
|
|
|
|
if not options
|
|
options = @parseOptions(process.argv)
|
|
|
|
askMissingOptions(['version', 'platform', 'zip'])(options)
|
|
.then (options) ->
|
|
la(check.unemptyString(options.zip),
|
|
"missing zipped filename", options)
|
|
options.zip = path.resolve(options.zip)
|
|
options
|
|
.then (options) ->
|
|
console.log("Need to upload file %s", options.zip)
|
|
console.log("for platform %s version %s",
|
|
options.platform, options.version)
|
|
|
|
upload.toS3({
|
|
zipFile: options.zip,
|
|
version: options.version,
|
|
platform: options.platform,
|
|
})
|
|
|
|
"move-binaries": (args = process.argv) ->
|
|
console.log('#moveBinaries')
|
|
moveBinaries(args)
|
|
|
|
# purge all platforms of a desktop app for specific version
|
|
"purge-version": (args = process.argv) ->
|
|
console.log('#purge-version')
|
|
options = minimist(args, {
|
|
string: 'version',
|
|
alias: {
|
|
version: 'v'
|
|
}
|
|
})
|
|
la(check.unemptyString(options.version), "missing app version to purge", options)
|
|
uploadUtils.purgeDesktopAppAllPlatforms(options.version, upload.zipName)
|
|
|
|
# goes through the entire pipeline:
|
|
# - build
|
|
# - zip
|
|
# - upload
|
|
deploy: ->
|
|
options = @parseOptions(process.argv)
|
|
|
|
askMissingOptions(['version', 'platform'])(options)
|
|
.then (options) =>
|
|
@build(options)
|
|
.then => @zip(options)
|
|
# assumes options.zip contains the zipped filename
|
|
.then => @upload(options)
|
|
}
|
|
|
|
module.exports = _.bindAll(deploy, _.functions(deploy))
|