mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-03 21:19: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>
133 lines
3.6 KiB
CoffeeScript
133 lines
3.6 KiB
CoffeeScript
awspublish = require('gulp-awspublish')
|
|
rename = require('gulp-rename')
|
|
debug = require('gulp-debug')
|
|
fs = require("fs-extra")
|
|
cp = require("child_process")
|
|
path = require("path")
|
|
gulp = require("gulp")
|
|
human = require("human-interval")
|
|
konfig = require("../../packages/server/lib/konfig")
|
|
Promise = require("bluebird")
|
|
meta = require("./meta")
|
|
la = require("lazy-ass")
|
|
check = require("check-more-types")
|
|
uploadUtils = require("./util/upload")
|
|
|
|
fs = Promise.promisifyAll(fs)
|
|
|
|
## TODO: refactor this
|
|
# system expects desktop application to be inside a file
|
|
# with this name
|
|
zipName = "cypress.zip"
|
|
|
|
module.exports = {
|
|
zipName
|
|
|
|
getPublisher: ->
|
|
uploadUtils.getPublisher(@getAwsObj)
|
|
|
|
getAwsObj: ->
|
|
uploadUtils.getS3Credentials()
|
|
|
|
# store uploaded application in subfolders by platform and version
|
|
# something like desktop/0.20.1/osx64/
|
|
getUploadDirName: ({version, platform}) ->
|
|
aws = @getAwsObj()
|
|
platformArch = uploadUtils.getUploadNameByOsAndArch(platform)
|
|
dirName = [aws.folder, version, platformArch, null].join("/")
|
|
console.log("target directory %s", dirName)
|
|
dirName
|
|
|
|
createRemoteManifest: (folder, version) ->
|
|
getUrl = (uploadOsName) ->
|
|
{
|
|
url: [konfig('cdn_url'), folder, version, uploadOsName, zipName].join("/")
|
|
}
|
|
|
|
obj = {
|
|
name: "Cypress"
|
|
version: version
|
|
packages: {
|
|
## keep these for compatibility purposes
|
|
## although they are now deprecated
|
|
mac: getUrl("osx64")
|
|
win: getUrl("win64")
|
|
linux64: getUrl("linux64")
|
|
|
|
## start adding the new ones
|
|
## using node's platform
|
|
darwin: getUrl("osx64")
|
|
win32: getUrl("win32")
|
|
win64: getUrl("win64")
|
|
linux: getUrl("linux64")
|
|
}
|
|
}
|
|
|
|
src = path.resolve("manifest.json")
|
|
fs.outputJsonAsync(src, obj).return(src)
|
|
|
|
s3Manifest: (version) ->
|
|
publisher = @getPublisher()
|
|
|
|
aws = @getAwsObj()
|
|
|
|
headers = {}
|
|
headers["Cache-Control"] = "no-cache"
|
|
|
|
manifest = null
|
|
|
|
new Promise (resolve, reject) =>
|
|
@createRemoteManifest(aws.folder, version)
|
|
.then (src) ->
|
|
manifest = src
|
|
|
|
gulp.src(src)
|
|
.pipe rename (p) ->
|
|
p.dirname = aws.folder + "/" + p.dirname
|
|
p
|
|
.pipe debug()
|
|
.pipe publisher.publish(headers)
|
|
.pipe awspublish.reporter()
|
|
.on "error", reject
|
|
.on "end", resolve
|
|
.finally ->
|
|
fs.removeAsync(manifest)
|
|
|
|
toS3: ({zipFile, version, platform}) ->
|
|
console.log("#uploadToS3 ⏳")
|
|
|
|
la(check.unemptyString(version), "expected version string", version)
|
|
la(check.unemptyString(zipFile), "expected zip filename", zipFile)
|
|
la(check.extension("zip", zipFile),
|
|
"zip filename should end with .zip", zipFile)
|
|
la(meta.isValidPlatform(platform), "invalid platform", platform)
|
|
|
|
console.log("zip filename #{zipFile}")
|
|
|
|
if !fs.existsSync(zipFile)
|
|
throw new Error("Cannot find zip file #{zipFile}")
|
|
|
|
upload = =>
|
|
new Promise (resolve, reject) =>
|
|
publisher = @getPublisher()
|
|
|
|
headers = {}
|
|
headers["Cache-Control"] = "no-cache"
|
|
|
|
gulp.src(zipFile)
|
|
.pipe rename (p) =>
|
|
# rename to standard filename zipName
|
|
p.basename = path.basename(zipName, p.extname)
|
|
p.dirname = @getUploadDirName({version, platform})
|
|
p
|
|
.pipe debug()
|
|
.pipe publisher.publish(headers)
|
|
.pipe awspublish.reporter()
|
|
.on "error", reject
|
|
.on "end", resolve
|
|
|
|
upload()
|
|
.then ->
|
|
uploadUtils.purgeDesktopAppFromCache({version, platform, zipName})
|
|
}
|