Files
cypress/scripts/check-node-version.js
Zach Bloomquist db752f5f93 Only package Windows builds of ffmpeg with Windows, build for win32 and win64 (#3877)
* 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>
2019-04-08 11:48:14 -04:00

76 lines
2.0 KiB
JavaScript

const os = require('os')
const assert = require('assert')
// TODO make this check a 3rd party little tool
// on CircleCI Mac machine, we need to use on of the laer executors
// that already has Node 10 / 11
const isMac = () => {
return os.platform() === 'darwin'
}
const isWindows = () => {
return os.platform() === 'win32'
}
if (isMac() && process.env.CIRCLECI) {
// eslint-disable-next-line no-console
console.log('Skipping Node version check on CircleCI Mac')
return
}
// if we're windows + in appveyor...
if (isWindows() && process.env.APPVEYOR) {
// check to ensure that the cpuArch + nodeArch are in sync
const cpuArch = process.env.Platform
const nodeArch = os.arch()
const getErrMsg = (expectedArch) => {
return `Appveyor CPU arch is set to: '${cpuArch}' but the node version that is being used is running: '${nodeArch}'. Expected it to equal: '${expectedArch}'`
}
// if we're in the x86 CPU architecture check
// to ensure that os.arch() is ia32
// eslint-disable-next-line default-case
switch (cpuArch) {
case 'x86':
assert.equal(
os.arch(),
'ia32',
getErrMsg('ia32')
)
break
case 'x64':
assert.equal(
os.arch(),
'x64',
getErrMsg('x64')
)
break
}
}
// we want to ensure we are building using the same major version
// as the one specified in ../.node-version file
const read = require('fs').readFileSync
const join = require('path').join
const nodeVersionNeededString = read(
join(__dirname, '..', '.node-version'),
'utf8'
)
const nodeVersionNeeded = nodeVersionNeededString.split('.')
const nodeVersion = process.versions.node.split('.')
// check just major version for now
if (nodeVersionNeeded[0] !== nodeVersion[0]) {
/* eslint-disable no-console */
console.error('🛑 .node-version specified %s', nodeVersionNeededString)
console.error('but current Node is %s', process.versions.node)
/* eslint-enable no-console */
process.exit(1)
}