successful builds on both platforms, upload and install

This commit is contained in:
Gleb Bahmutov
2017-06-28 12:52:08 -04:00
parent 87f839c6cb
commit cf95c01679
6 changed files with 38 additions and 18 deletions
+4 -2
View File
@@ -39,7 +39,7 @@ class Base
@uploadOsName = @getUploadNameByOs(os)
buildPathToAppFolder: ->
path.join meta.buildDir, @osName
meta.buildDir(@osName)
buildPathToZip: ->
path.join @buildPathToAppFolder(), @zipName
@@ -385,8 +385,10 @@ class Base
smokeTest = =>
new Promise (resolve, reject) =>
rand = "" + Math.random()
executable = @buildPathToAppExecutable()
console.log("executable path #{executable}")
cp.exec "#{@buildPathToAppExecutable()} --smoke-test --ping=#{rand}", (err, stdout, stderr) ->
cp.exec "#{executable} --smoke-test --ping=#{rand}", (err, stdout, stderr) ->
stdout = stdout.replace(/\s/, "")
if err
+10 -9
View File
@@ -109,9 +109,10 @@ module.exports = (platform, version) ->
symlinkBuildPackages = ->
log("#symlinkBuildPackages", platform)
wildCard = buildAppDir("packages", "*", "package.json")
console.log("packages", wildCard)
packages.symlinkAll(
buildAppDir("packages", "*", "package.json"),
wildCard,
buildAppDir
)
@@ -152,11 +153,15 @@ module.exports = (platform, version) ->
elBuilder = ->
log("#elBuilder", platform)
dir = distDir()
dist = buildDir()
console.log("from #{dir}")
console.log("into #{dist}")
electron.install({
dir: distDir()
dist: buildDir()
platform: platform
dir
dist
platform
"app-version": version
})
@@ -166,8 +171,6 @@ module.exports = (platform, version) ->
smokeTest = smokeTests[platform]
smokeTest()
# Promise
# .bind(@)
Promise.resolve()
.then(cleanupPlatform)
.then(buildPackages)
@@ -183,7 +186,6 @@ module.exports = (platform, version) ->
.then(@cleanupSrc)
.then(@npmInstall)
.then(@npmInstall)
.then(@elBuilder)
.then(elBuilder)
.then(symlinkBuildPackages)
.then(runSmokeTest)
@@ -194,7 +196,6 @@ module.exports = (platform, version) ->
# .then(@cleanupCy)
# .then(@codeSign) ## codesign after running smoke tests due to changing .cy
# .then(@verifyAppCanOpen)
# .return(@)
.return({
buildDir: buildDir()
})
+14 -4
View File
@@ -1,4 +1,8 @@
path = require("path")
la = require("lazy-ass")
check = require("check-more-types")
isValidPlatform = check.oneOf(["darwin", "linux"])
## returns a path into the /build directory
## the output folder should look something like this
@@ -6,7 +10,12 @@ path = require("path")
## <platform>/ = linux or darwin
## ... platform-specific files
buildDir = (platform, args...) ->
path.resolve("build", platform, args...)
la(isValidPlatform(platform), "invalid platform", platform)
switch platform
when "darwin"
path.resolve("build", platform, args...)
when "linux"
path.resolve("build", platform, "Cypress", args...)
## returns a path into the /dist directory
distDir = (platform, args...) ->
@@ -18,18 +27,19 @@ zipDir = (platform) ->
when "darwin"
buildDir(platform, "Cypress.app")
when "linux"
buildDir(platform, "Cypress")
buildDir(platform)
## returns a path into the /build/*/app directory
## specific to each platform
buildAppDir = (platform, args...) ->
switch platform
when "darwin"
buildDir("Cypress.app", "Contents", "resources", "app", args...)
buildDir(platform, "Cypress.app", "Contents", "resources", "app", args...)
when "linux"
buildDir("resources", "app", args...)
buildDir(platform, "resources", "app", args...)
module.exports = {
isValidPlatform
buildDir
distDir
zipDir
+1 -3
View File
@@ -14,8 +14,6 @@ check = require("check-more-types")
fs = Promise.promisifyAll(fs)
isValidPlatform = check.oneOf(["darwin", "linux"])
uploadNames = {
darwin: "osx64"
linux: "linux64"
@@ -117,7 +115,7 @@ module.exports = {
console.log("#uploadToS3 ⏳")
la(check.unemptyString(version), "expected version string", version)
la(check.unemptyString(zipFile), "expected zip filename", zipFile)
la(isValidPlatform(platform), "invalid platform", platform)
la(meta.isValidPlatform(platform), "invalid platform", platform)
upload = =>
new Promise (resolve, reject) =>
+7
View File
@@ -4,6 +4,8 @@ cp = require("child_process")
path = require("path")
glob = require("glob")
Promise = require("bluebird")
la = require("lazy-ass")
check = require("check-more-types")
fs = Promise.promisifyAll(fs)
glob = Promise.promisify(glob)
@@ -83,6 +85,8 @@ npmInstallAll = (pathToPackages) ->
## 1,060,495,784 bytes (1.54 GB on disk) for 179,156 items
## 313,416,512 bytes (376.6 MB on disk) for 23,576 items
console.log("npmInstallAll packages in #{pathToPackages}")
started = new Date()
retryGlobbing = ->
@@ -123,6 +127,9 @@ ensureFoundSomething = (files) ->
symlinkAll = (pathToDistPackages, pathTo) ->
console.log("symlink these packages", pathToDistPackages)
la(check.unemptyString(pathToDistPackages),
"missing paths to dist packages", pathToDistPackages)
baseDir = path.dirname(pathTo())
toBase = path.relative.bind(null, baseDir)
+2
View File
@@ -6,6 +6,8 @@ execa = require("execa")
# resolves with zipped filename
macZip = (src, dest) ->
new Promise (resolve, reject) =>
if os.platform() != "darwin"
throw new Error("Can only zip on Mac platform")
# Ditto (Mac) options
# http://www.unix.com/man-page/OSX/1/ditto/
# -c create archive