electron/script/cibuild

120 строки
3.0 KiB
Plaintext
Исходник Обычный вид История

#!/usr/bin/env python
import os
import subprocess
import sys
2015-07-03 05:35:40 +03:00
from lib.config import PLATFORM
from lib.util import execute, rm_rf, scoped_env
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
LINUX_DEPS = [
'libdbus-1-dev',
2014-11-15 05:37:27 +03:00
'libgconf2-dev',
'libgnome-keyring-dev',
'libgtk2.0-dev',
'libnotify-dev',
2015-07-07 09:42:02 +03:00
'libnss3-dev',
2015-12-08 12:32:42 +03:00
'libxtst-dev',
]
LINUX_DEPS_NO_ARM = [
'gcc-multilib',
'g++-multilib',
]
2015-07-02 07:47:43 +03:00
LINUX_DEPS_ARM = [
'binutils-aarch64-linux-gnu',
'libc6-dev-armhf-cross',
'linux-libc-dev-armhf-cross',
'g++-arm-linux-gnueabihf',
'g++-4.8-multilib-arm-linux-gnueabihf',
'gcc-4.8-multilib-arm-linux-gnueabihf',
2015-07-02 07:42:36 +03:00
]
def main():
2014-02-17 13:50:25 +04:00
os.environ['CI'] = '1'
2016-07-26 13:24:28 +03:00
# Ignore the CXX and CC env in CI.
try:
del os.environ['CC']
del os.environ['CXX']
except KeyError:
pass
2015-07-02 07:42:36 +03:00
target_arch = 'x64'
if os.environ.has_key('TARGET_ARCH'):
target_arch = os.environ['TARGET_ARCH']
is_travis = (os.getenv('TRAVIS') == 'true')
2015-07-03 05:35:40 +03:00
if is_travis and PLATFORM == 'linux':
2014-08-09 05:48:37 +04:00
print 'Setup travis CI'
execute(['sudo', 'apt-get', 'update'])
2015-07-02 07:42:36 +03:00
deps = LINUX_DEPS
if target_arch == 'arm':
2015-07-02 07:47:43 +03:00
deps += LINUX_DEPS_ARM
else:
deps += LINUX_DEPS_NO_ARM
2015-07-02 07:42:36 +03:00
execute(['sudo', 'apt-get', 'install'] + deps)
2014-08-09 05:48:37 +04:00
2017-07-22 00:35:06 +03:00
if PLATFORM == 'linux':
os.environ['DISPLAY'] = ':99.0'
execute(['sh', '-e', '/etc/init.d/xvfb', 'start'])
# CI's npm is not reliable.
2015-07-03 05:35:40 +03:00
npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
execute([npm, 'install', 'npm@2.12.1'])
2016-04-07 20:03:16 +03:00
log_versions()
# Add "./node_modules/.bin" to the beginning of $PATH, which will ensure
# future "npm" invocations use the right version.
node_bin_dir = os.path.join(SOURCE_ROOT, 'node_modules', '.bin')
os.environ['PATH'] = os.path.pathsep.join([node_bin_dir,
os.environ.get('PATH', '')])
2016-04-07 20:03:16 +03:00
2017-07-21 20:05:12 +03:00
is_release = os.environ.get('ELECTRON_RELEASE', '') == '1'
args = ['--target_arch=' + target_arch]
if not is_release:
args += ['--dev']
run_script('bootstrap.py', args)
2015-07-03 05:35:40 +03:00
if PLATFORM != 'win32':
2016-03-31 00:21:07 +03:00
sys.stderr.write('\nRunning `npm run lint`\n')
sys.stderr.flush()
execute([npm, 'run', 'lint'])
if is_release:
run_script('build.py', ['-c', 'R'])
run_script('create-dist.py')
2015-07-03 08:43:20 +03:00
run_script('upload.py')
2015-08-21 09:18:04 +03:00
else:
run_script('build.py', ['-c', 'D'])
2016-04-30 11:17:23 +03:00
if PLATFORM == 'win32' or target_arch == 'x64':
run_script('test.py', ['--ci', '--rebuild_native_modules'])
run_script('verify-ffmpeg.py')
def run_script(script, args=[]):
2015-09-03 11:20:48 +03:00
sys.stderr.write('\nRunning ' + script +'\n')
sys.stderr.flush()
script = os.path.join(SOURCE_ROOT, 'script', script)
subprocess.check_call([sys.executable, script] + args)
2016-04-07 20:03:16 +03:00
def log_versions():
sys.stderr.write('\nnode --version\n')
sys.stderr.flush()
2016-04-07 20:15:31 +03:00
subprocess.call(['node', '--version'])
2016-04-07 20:03:16 +03:00
sys.stderr.write('\nnpm --version\n')
sys.stderr.flush()
npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
2016-04-07 20:15:31 +03:00
subprocess.call([npm, '--version'])
2016-04-07 20:03:16 +03:00
if __name__ == '__main__':
2015-07-03 09:36:45 +03:00
sys.exit(main())