mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-08 07:29:44 -06:00
* appveyor build for this branch * don't force install ffmpeg on windows don't force install ffmpeg on windows * derp * fix * build in appveyor * oops * delete using del * use RMDIR instead of DEL * only build 32-bit * build for x64 and x86 windows * separate win32 and win64 * require lodash * make electron arch configurable * cross-compile 32, only run in 64-bit * force install ffmpeg if necessary * it's all win10 x64, but we can force it to build for ia32 in x32 mode * add windows util * who's idea was it to make whitespace meaningful? * pass arch to npm install, pass arch to uploader * add TARGET_PLATFORM * fun fact: appveyor titlecases env var names fun fact: appveyor titlecases env var names * fix: pass args * use process * cli: use arch package to send arch to server * pass TARGET_ARCH to all npm installs * run-all * always call getUploadNameByOs * use the precise version of node, enable both x64 and ia32 arch * quotes * uh wat * move console logs to script because windows * add yet another env var to install the right node arch * use x86, not x32 * give ia32 a try, why not * use platform env again * and also try x86 again * remove notion of target_arch since we're using the right node version with arch set correctly * more comprehensive checks to ensure the arch is correct * simplify building the binary, do not accept arch as options * build the binary and test it on this branch * remove arch, ensure that process.env.Platform is set to x86 * do build the binary unless this is a forked PR * attempt to verify that this is a 32bit or 64bit windows binary * remove unused dep * consolidate commands * don't install packages in windows - just build the binary - this avoids needing to reinstall all node_modules and build-js twice * build the binary on more branches * cd up appveyor * ugh * right logic for whether or not this is a forked PR * remove unused deps * fix undefined var * platformArch * set in options * turns out we do have to npm install before building the binary * options.platformArch * comment out appveyor build 32bit/64bit verification temporarily Co-authored-by: Brian Mann <brian.mann86@gmail.com>
110 lines
3.2 KiB
CoffeeScript
110 lines
3.2 KiB
CoffeeScript
minimist = require("minimist")
|
|
Promise = require("bluebird")
|
|
la = require("lazy-ass")
|
|
check = require("check-more-types")
|
|
fs = require("fs")
|
|
path = require("path")
|
|
awspublish = require('gulp-awspublish')
|
|
rename = require('gulp-rename')
|
|
debug = require('gulp-debug')
|
|
gulp = require("gulp")
|
|
human = require("human-interval")
|
|
R = require("ramda")
|
|
|
|
konfig = require("../../packages/server/lib/konfig")
|
|
uploadUtils = require("./util/upload")
|
|
|
|
binaryExtension = ".zip"
|
|
uploadFileName = "cypress.zip"
|
|
|
|
isBinaryFile = check.extension(binaryExtension)
|
|
|
|
# wonder if our CDN url would just work
|
|
# https://cdn.cypress.io/desktop/0.20.1/osx64/cypress.zip
|
|
# in our case something like this
|
|
# https://cdn.cypress.io/desktop/binary/0.20.2/<platform>/<some unique version info>/cypress.tgz
|
|
rootFolder = "beta"
|
|
folder = "binary"
|
|
|
|
getCDN = ({version, hash, filename, platform}) ->
|
|
[konfig("cdn_url"), rootFolder, folder, version, platform, hash, filename].join("/")
|
|
|
|
getUploadDirName = (options) ->
|
|
la(check.unemptyString(options.version), 'missing version', options)
|
|
la(check.unemptyString(options.hash), 'missing hash', options)
|
|
la(check.unemptyString(options.platformArch), 'missing platformArch', options)
|
|
|
|
dir = [rootFolder, folder, options.version, options.platformArch, options.hash, null].join("/")
|
|
dir
|
|
|
|
uploadFile = (options) ->
|
|
new Promise (resolve, reject) ->
|
|
publisher = uploadUtils.getPublisher()
|
|
|
|
headers = {}
|
|
headers["Cache-Control"] = "no-cache"
|
|
|
|
gulp.src(options.file)
|
|
.pipe rename (p) =>
|
|
p.basename = path.basename(uploadFileName, binaryExtension)
|
|
p.dirname = getUploadDirName(options)
|
|
console.log("renaming upload to", p.dirname, p.basename)
|
|
la(check.unemptyString(p.basename), "missing basename")
|
|
la(check.unemptyString(p.dirname), "missing dirname")
|
|
p
|
|
.pipe debug()
|
|
.pipe publisher.publish(headers)
|
|
.pipe awspublish.reporter()
|
|
.on "error", reject
|
|
.on "end", resolve
|
|
|
|
uploadUniqueBinary = (args = []) ->
|
|
options = minimist(args, {
|
|
string: ["version", "file", "hash", "platform"],
|
|
alias: {
|
|
version: "v",
|
|
file: "f",
|
|
hash: "h"
|
|
}
|
|
})
|
|
console.log("Upload unique binary options")
|
|
pickOptions = R.pick(["file", "version", "hash"])
|
|
console.log(pickOptions(options))
|
|
|
|
la(check.unemptyString(options.file), "missing file to upload", options)
|
|
la(isBinaryFile(options.file),
|
|
"invalid file to upload extension", options.file)
|
|
|
|
if not options.hash
|
|
options.hash = uploadUtils.formHashFromEnvironment()
|
|
|
|
la(check.unemptyString(options.hash), "missing hash to give", options)
|
|
la(check.unemptyString(options.version), "missing version", options)
|
|
|
|
la(fs.existsSync(options.file), "cannot find file", options.file)
|
|
|
|
platform = options.platform ? process.platform
|
|
|
|
options.platformArch = uploadUtils.getUploadNameByOsAndArch(platform)
|
|
|
|
uploadFile(options)
|
|
.then () ->
|
|
cdnUrl = getCDN({
|
|
version: options.version,
|
|
hash: options.hash,
|
|
filename: uploadFileName
|
|
platform: options.platformArch
|
|
})
|
|
console.log("Binary can be downloaded using URL")
|
|
console.log(cdnUrl)
|
|
cdnUrl
|
|
.then uploadUtils.saveUrl("binary-url.json")
|
|
|
|
module.exports = {
|
|
uploadUniqueBinary,
|
|
getCDN
|
|
}
|
|
|
|
if not module.parent
|
|
uploadUniqueBinary(process.argv)
|