electron/script/cibuild

91 lines
2.1 KiB
Text
Raw Normal View History

#!/usr/bin/env python
import os
import subprocess
import sys
2015-07-03 02:35:40 +00: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 02:37:27 +00:00
'libgconf2-dev',
'libgnome-keyring-dev',
'libgtk2.0-dev',
'libnotify-dev',
2015-07-07 06:42:02 +00:00
'libnss3-dev',
2015-12-08 09:32:42 +00:00
'libxtst-dev',
'gcc-multilib',
'g++-multilib',
]
2015-07-02 04:47:43 +00:00
LINUX_DEPS_ARM = [
2015-07-02 04:42:36 +00:00
'libc6-dev-armhf-cross',
'linux-libc-dev-armhf-cross',
'g++-arm-linux-gnueabihf',
]
def main():
2014-02-17 09:50:25 +00:00
os.environ['CI'] = '1'
2015-07-02 04:42:36 +00: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 02:35:40 +00:00
if is_travis and PLATFORM == 'linux':
2014-08-09 01:48:37 +00:00
print 'Setup travis CI'
execute(['sudo', 'apt-get', 'update'])
2015-07-02 04:42:36 +00:00
deps = LINUX_DEPS
if target_arch == 'arm':
2015-07-02 04:47:43 +00:00
deps += LINUX_DEPS_ARM
2015-07-02 04:42:36 +00:00
execute(['sudo', 'apt-get', 'install'] + deps)
2014-08-09 01:48:37 +00:00
execute(['sh', '-e', '/etc/init.d/xvfb', 'start'])
2015-07-03 04:04:27 +00:00
if PLATFORM == 'linux':
os.environ['DISPLAY'] = ':99.0'
2015-07-03 05:54:29 +00:00
run_script('clean.py')
# CI's npm is not reliable.
2015-07-03 02:35:40 +00:00
npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
execute([npm, 'install', 'npm@2.12.1'])
is_release = os.environ.has_key('ELECTRON_RELEASE')
args = ['--target_arch=' + target_arch]
if not is_release:
args += ['--dev']
run_script('bootstrap.py', args)
2015-07-03 02:35:40 +00:00
if PLATFORM != 'win32':
2016-03-30 21:21:07 +00:00
sys.stderr.write('\nRunning `npm run lint`\n')
sys.stderr.flush()
execute([npm, 'run', 'lint'])
2014-03-03 11:31:45 +00:00
run_script('pylint.py')
if is_release:
run_script('build.py', ['-c', 'R'])
run_script('create-dist.py')
2015-07-03 05:43:20 +00:00
run_script('upload.py')
2015-08-21 06:18:04 +00:00
else:
run_script('build.py', ['-c', 'D'])
2015-09-15 05:29:03 +00:00
if PLATFORM != 'win32' and target_arch == 'x64':
2015-07-03 02:35:40 +00:00
run_script('test.py', ['--ci'])
2015-07-07 06:05:47 +00:00
run_script('clean.py')
def run_script(script, args=[]):
2015-09-03 08:20:48 +00: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)
if __name__ == '__main__':
2015-07-03 06:36:45 +00:00
sys.exit(main())