mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-06 06:29:45 -06:00
build: building all the way on Windows
- disabled video recording in smoke project on win32 - smoke test still crashes at the very end
This commit is contained in:
@@ -62,6 +62,7 @@
|
||||
"eslint-plugin-cypress-dev": "^1.0.0",
|
||||
"eslint-plugin-mocha": "^4.11.0",
|
||||
"eslint-plugin-react": "^7.3.0",
|
||||
"execa": "^0.8.0",
|
||||
"filesize": "^3.5.10",
|
||||
"fs-extra": "^2.1.2",
|
||||
"gulp": "^3.9.1",
|
||||
|
||||
@@ -76,8 +76,11 @@ module.exports = {
|
||||
pkgr(options)
|
||||
.then (appPaths) ->
|
||||
appPaths[0]
|
||||
# Promise.resolve("tmp\\Cypress-win32-x64")
|
||||
.then (appPath) =>
|
||||
## and now move the tmp into dist
|
||||
console.log("moving created file from", appPath)
|
||||
console.log("to", options.dist)
|
||||
@move(appPath, options.dist)
|
||||
|
||||
.catch (err) ->
|
||||
|
||||
@@ -17,6 +17,9 @@ electron = require("@packages/electron")
|
||||
signOsxApp = require("electron-osx-sign")
|
||||
debug = require("debug")("cypress:binary")
|
||||
R = require("ramda")
|
||||
la = require("lazy-ass")
|
||||
check = require("check-more-types")
|
||||
execa = require("execa")
|
||||
|
||||
meta = require("./meta")
|
||||
smoke = require("./smoke")
|
||||
@@ -48,6 +51,16 @@ buildCypressApp = (platform, version, options = {}) ->
|
||||
|
||||
log = _.partialRight(logger, platform)
|
||||
|
||||
testVersion = (folderNameFn) -> () ->
|
||||
dir = folderNameFn()
|
||||
la(check.unemptyString(dir), "missing folder for platform", platform)
|
||||
console.log("testing package version in folder", dir)
|
||||
execa("node", ["index.js", "--version"], {
|
||||
cwd: dir
|
||||
}).then (result) ->
|
||||
# TODO validate version string
|
||||
console.log(result.stdout)
|
||||
|
||||
canBuildInDocker = ->
|
||||
platform is "linux" and os.platform() is "darwin"
|
||||
|
||||
@@ -74,7 +87,9 @@ buildCypressApp = (platform, version, options = {}) ->
|
||||
log("skipClean")
|
||||
return
|
||||
|
||||
cleanup = =>
|
||||
cleanup = ->
|
||||
dir = distDir()
|
||||
la(check.unemptyString(dir), "empty dist dir", dir, "for platform", platform)
|
||||
fs.removeAsync(distDir())
|
||||
|
||||
cleanup()
|
||||
@@ -199,6 +214,9 @@ buildCypressApp = (platform, version, options = {}) ->
|
||||
# hint: you can see all symlinks in the build folder
|
||||
# using "find build/darwin/Cypress.app/ -type l -ls"
|
||||
electronDistFolder = meta.buildAppDir(platform, "packages", "electron", "dist")
|
||||
la(check.unemptyString(electronDistFolder),
|
||||
"empty electron dist folder for platform", platform)
|
||||
|
||||
console.log("Removing unnecessary folder #{electronDistFolder}")
|
||||
fs.removeAsync(electronDistFolder).catch(_.noop)
|
||||
|
||||
@@ -217,6 +235,7 @@ buildCypressApp = (platform, version, options = {}) ->
|
||||
|
||||
codeSign = ->
|
||||
if platform isnt "darwin"
|
||||
# do we need to code sign on Windows?
|
||||
return Promise.resolve()
|
||||
|
||||
appFolder = meta.zipDir(platform)
|
||||
@@ -244,18 +263,20 @@ buildCypressApp = (platform, version, options = {}) ->
|
||||
|
||||
Promise.resolve()
|
||||
.then(checkPlatform)
|
||||
# .then(cleanupPlatform)
|
||||
# .then(buildPackages)
|
||||
# .then(copyPackages)
|
||||
# .then(npmInstallPackages)
|
||||
.then(cleanupPlatform)
|
||||
.then(buildPackages)
|
||||
.then(copyPackages)
|
||||
.then(npmInstallPackages)
|
||||
.then(createRootPackage)
|
||||
.then(copyPackageProxies(distDir))
|
||||
.then(convertCoffeeToJs)
|
||||
.then(removeTypeScript)
|
||||
.then(cleanJs)
|
||||
.then(elBuilder)
|
||||
.then(testVersion(distDir))
|
||||
.then(elBuilder) # should we delete everything in the buildDir()?
|
||||
.then(removeDevElectronApp)
|
||||
.then(copyPackageProxies(buildAppDir))
|
||||
.then(testVersion(buildAppDir))
|
||||
.then(runSmokeTests)
|
||||
.then(codeSign) ## codesign after running smoke tests due to changing .cy
|
||||
.then(verifyAppCanOpen)
|
||||
|
||||
@@ -12,14 +12,17 @@ platforms = {
|
||||
|
||||
isValidPlatform = check.oneOf(R.values(platforms))
|
||||
|
||||
checkPlatform = (platform) ->
|
||||
la(isValidPlatform(platform),
|
||||
"invalid build platform", platform, "valid choices", R.values(platforms))
|
||||
|
||||
## returns a path into the /build directory
|
||||
## the output folder should look something like this
|
||||
## build/
|
||||
## <platform>/ = linux or darwin
|
||||
## ... platform-specific files
|
||||
buildDir = (platform, args...) ->
|
||||
la(isValidPlatform(platform),
|
||||
"invalid build platform", platform, "valid choices", R.values(platforms))
|
||||
checkPlatform(platform)
|
||||
switch platform
|
||||
when "darwin"
|
||||
path.resolve("build", platform, args...)
|
||||
@@ -30,31 +33,41 @@ buildDir = (platform, args...) ->
|
||||
|
||||
## returns a path into the /dist directory
|
||||
distDir = (platform, args...) ->
|
||||
checkPlatform(platform)
|
||||
path.resolve("dist", platform, args...)
|
||||
|
||||
## returns folder to zip before uploading
|
||||
zipDir = (platform) ->
|
||||
checkPlatform(platform)
|
||||
switch platform
|
||||
when "darwin"
|
||||
buildDir(platform, "Cypress.app")
|
||||
when "linux"
|
||||
buildDir(platform)
|
||||
when "win32"
|
||||
buildDir(platform)
|
||||
|
||||
## returns a path into the /build/*/app directory
|
||||
## specific to each platform
|
||||
buildAppDir = (platform, args...) ->
|
||||
checkPlatform(platform)
|
||||
switch platform
|
||||
when "darwin"
|
||||
buildDir(platform, "Cypress.app", "Contents", "resources", "app", args...)
|
||||
when "linux"
|
||||
buildDir(platform, "resources", "app", args...)
|
||||
when "win32"
|
||||
buildDir(platform, "resources", "app", args...)
|
||||
|
||||
buildAppExecutable = (platform) ->
|
||||
checkPlatform(platform)
|
||||
switch platform
|
||||
when "darwin"
|
||||
buildDir(platform, "Cypress.app", "Contents", "MacOS", "Cypress")
|
||||
when "linux"
|
||||
buildDir(platform, "Cypress")
|
||||
when "win32"
|
||||
buildDir(platform, "Cypress")
|
||||
|
||||
module.exports = {
|
||||
isValidPlatform
|
||||
|
||||
@@ -3,15 +3,25 @@ fse = require("fs-extra")
|
||||
cp = require("child_process")
|
||||
path = require("path")
|
||||
Promise = require("bluebird")
|
||||
os = require("os")
|
||||
Fixtures = require("../../packages/server/test/support/helpers/fixtures")
|
||||
|
||||
fs = Promise.promisifyAll(fse)
|
||||
|
||||
canRecordVideo = () ->
|
||||
os.platform() != "win32"
|
||||
|
||||
runSmokeTest = (buildAppExecutable) ->
|
||||
new Promise (resolve, reject) ->
|
||||
rand = "" + Math.random()
|
||||
console.log("executable path #{buildAppExecutable}")
|
||||
|
||||
hasRightResponse = (stdout) ->
|
||||
# there could be more debug lines in the output, so find 1 line with
|
||||
# expected random value
|
||||
lines = stdout.split('\n').map((s) -> s.trim())
|
||||
return lines.includes(rand)
|
||||
|
||||
cp.exec "#{buildAppExecutable} --smoke-test --ping=#{rand}", (err, stdout, stderr) ->
|
||||
stdout = stdout.replace(/\s/, "")
|
||||
|
||||
@@ -19,7 +29,7 @@ runSmokeTest = (buildAppExecutable) ->
|
||||
console.error("smoke test failed with error %s", err.message)
|
||||
return reject(err)
|
||||
|
||||
if stdout isnt rand
|
||||
if !hasRightResponse(stdout)
|
||||
throw new Error("Stdout: '#{stdout}' did not match the random number: '#{rand}'")
|
||||
else
|
||||
console.log("smokeTest passes")
|
||||
@@ -31,8 +41,13 @@ runProjectTest = (buildAppExecutable, e2e) ->
|
||||
new Promise (resolve, reject) ->
|
||||
env = _.omit(process.env, "CYPRESS_ENV")
|
||||
|
||||
if !canRecordVideo()
|
||||
console.log("cannot record video on this platform yet, disabling")
|
||||
env.CYPRESS_VIDEO_RECORDING = "false"
|
||||
|
||||
cp.spawn(buildAppExecutable, [
|
||||
"--run-project=#{e2e}", "--spec=cypress/integration/simple_passing_spec.coffee"
|
||||
"--run-project=#{e2e}",
|
||||
"--spec=cypress/integration/simple_passing_spec.coffee"
|
||||
], {
|
||||
stdio: "inherit", env: env
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user