2013-08-20 21:15:22 -06:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import os
|
|
|
|
import subprocess
|
2013-08-21 07:41:34 -06:00
|
|
|
import sys
|
2013-08-20 21:15:22 -06:00
|
|
|
|
2015-07-02 20:35:40 -06:00
|
|
|
from lib.config import PLATFORM
|
2014-08-08 19:22:06 -06:00
|
|
|
from lib.util import execute, rm_rf, scoped_env
|
2013-11-25 18:39:24 -07:00
|
|
|
|
2013-08-20 21:15:22 -06:00
|
|
|
|
2013-08-21 07:41:34 -06:00
|
|
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
|
|
|
2014-08-08 09:32:51 -06:00
|
|
|
LINUX_DEPS = [
|
2014-10-21 01:01:24 -06:00
|
|
|
'libdbus-1-dev',
|
2014-11-14 19:37:27 -07:00
|
|
|
'libgconf2-dev',
|
2014-08-08 09:32:51 -06:00
|
|
|
'libgnome-keyring-dev',
|
|
|
|
'libgtk2.0-dev',
|
|
|
|
'libnotify-dev',
|
2015-07-07 00:42:02 -06:00
|
|
|
'libnss3-dev',
|
2015-07-01 23:27:12 -06:00
|
|
|
'gcc-multilib',
|
|
|
|
'g++-multilib',
|
2014-08-08 09:32:51 -06:00
|
|
|
]
|
|
|
|
|
2015-07-01 22:47:43 -06:00
|
|
|
LINUX_DEPS_ARM = [
|
2015-07-01 22:42:36 -06:00
|
|
|
'libc6-dev-armhf-cross',
|
|
|
|
'linux-libc-dev-armhf-cross',
|
|
|
|
'g++-arm-linux-gnueabihf',
|
|
|
|
]
|
|
|
|
|
2013-08-21 07:41:34 -06:00
|
|
|
|
|
|
|
def main():
|
2014-02-17 02:50:25 -07:00
|
|
|
os.environ['CI'] = '1'
|
|
|
|
|
2015-07-01 22:42:36 -06:00
|
|
|
target_arch = 'x64'
|
|
|
|
if os.environ.has_key('TARGET_ARCH'):
|
|
|
|
target_arch = os.environ['TARGET_ARCH']
|
|
|
|
|
2014-08-08 19:22:06 -06:00
|
|
|
is_travis = (os.getenv('TRAVIS') == 'true')
|
2015-07-02 20:35:40 -06:00
|
|
|
if is_travis and PLATFORM == 'linux':
|
2014-08-08 19:48:37 -06:00
|
|
|
print 'Setup travis CI'
|
2014-08-08 19:22:06 -06:00
|
|
|
execute(['sudo', 'apt-get', 'update'])
|
2015-07-01 22:42:36 -06:00
|
|
|
deps = LINUX_DEPS
|
|
|
|
if target_arch == 'arm':
|
2015-07-01 22:47:43 -06:00
|
|
|
deps += LINUX_DEPS_ARM
|
2015-07-01 22:42:36 -06:00
|
|
|
execute(['sudo', 'apt-get', 'install'] + deps)
|
2014-08-08 19:48:37 -06:00
|
|
|
|
|
|
|
execute(['sh', '-e', '/etc/init.d/xvfb', 'start'])
|
2014-08-08 09:10:20 -06:00
|
|
|
|
2015-07-02 22:04:27 -06:00
|
|
|
if PLATFORM == 'linux':
|
|
|
|
os.environ['DISPLAY'] = ':99.0'
|
|
|
|
|
2015-07-02 23:54:29 -06:00
|
|
|
run_script('clean.py')
|
2013-11-25 18:39:24 -07:00
|
|
|
|
2015-07-02 08:45:26 -06:00
|
|
|
# CI's npm is not reliable.
|
2015-07-02 20:35:40 -06:00
|
|
|
npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
|
2015-07-02 18:54:03 -06:00
|
|
|
execute([npm, 'install', 'npm@2.12.1'])
|
2015-07-02 08:45:26 -06:00
|
|
|
|
2015-07-03 02:31:33 -06:00
|
|
|
is_release = os.environ.has_key('ELECTRON_RELEASE')
|
2015-07-02 20:14:13 -06:00
|
|
|
args = ['--target_arch=' + target_arch]
|
|
|
|
if not is_release:
|
|
|
|
args += ['--dev']
|
|
|
|
run_script('bootstrap.py', args)
|
2014-08-08 19:22:06 -06:00
|
|
|
|
2013-08-21 07:41:34 -06:00
|
|
|
run_script('cpplint.py')
|
2015-07-02 20:35:40 -06:00
|
|
|
if PLATFORM != 'win32':
|
2014-03-03 04:31:45 -07:00
|
|
|
run_script('pylint.py')
|
2013-09-26 20:49:55 -06:00
|
|
|
run_script('coffeelint.py')
|
2015-07-02 20:14:13 -06:00
|
|
|
if is_release:
|
|
|
|
run_script('build.py', ['-c', 'R'])
|
|
|
|
run_script('create-dist.py')
|
2015-07-02 23:43:20 -06:00
|
|
|
run_script('upload.py')
|
2015-07-02 21:17:58 -06:00
|
|
|
elif PLATFORM == 'win32' or target_arch == 'x64':
|
2015-07-02 20:14:13 -06:00
|
|
|
run_script('build.py', ['-c', 'D'])
|
2015-07-02 20:35:40 -06:00
|
|
|
if PLATFORM != 'win32':
|
|
|
|
run_script('test.py', ['--ci'])
|
2013-08-21 07:41:34 -06:00
|
|
|
|
2015-07-07 00:05:47 -06:00
|
|
|
run_script('clean.py')
|
|
|
|
|
2013-08-21 07:41:34 -06:00
|
|
|
|
|
|
|
def run_script(script, args=[]):
|
2014-05-08 20:17:02 -06:00
|
|
|
print 'Running', script
|
2013-08-21 07:41:34 -06:00
|
|
|
script = os.path.join(SOURCE_ROOT, 'script', script)
|
|
|
|
subprocess.check_call([sys.executable, script] + args)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2015-07-03 00:36:45 -06:00
|
|
|
sys.exit(main())
|