electron/script/cibuild
2015-07-02 04:47:43 +00:00

84 lines
2 KiB
Python
Executable file

#!/usr/bin/env python
import os
import subprocess
import sys
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',
'libgconf2-dev',
'libgnome-keyring-dev',
'libgtk2.0-dev',
'libnotify-dev',
'gcc-multilib',
'g++-multilib',
]
LINUX_DEPS_ARM = [
'libc6-dev-armhf-cross',
'linux-libc-dev-armhf-cross',
'g++-arm-linux-gnueabihf',
]
LINUX_DEPS_I386 = [
'linux-libc-dev:i386',
'libdbus-1-dev:i386',
'libgconf2-dev:i386',
'libgnome-keyring-dev:i386',
'libgtk2.0-dev:i386',
'libnotify-dev:i386',
]
def main():
os.environ['CI'] = '1'
target_arch = 'x64'
if os.environ.has_key('TARGET_ARCH'):
target_arch = os.environ['TARGET_ARCH']
is_travis = (os.getenv('TRAVIS') == 'true')
if is_travis and sys.platform == 'linux2':
print 'Setup travis CI'
execute(['sudo', 'apt-get', 'update'])
deps = LINUX_DEPS
if target_arch == 'arm':
deps += LINUX_DEPS_ARM
elif target_arch == 'ia32':
deps += LINUX_DEPS_I386
execute(['sudo', 'apt-get', 'install'] + deps)
os.environ['DISPLAY'] = ':99.0'
execute(['sh', '-e', '/etc/init.d/xvfb', 'start'])
rm_rf(os.path.join(SOURCE_ROOT, 'out'))
rm_rf(os.path.join(SOURCE_ROOT, 'node_modules'))
rm_rf(os.path.join(SOURCE_ROOT, 'frameworks'))
rm_rf(os.path.join(SOURCE_ROOT, 'external_binaries'))
rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'apm', 'node_modules'))
rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'download',
'libchromiumcontent'))
run_script('bootstrap.py', ['--dev', '--target_arch=' + target_arch])
run_script('cpplint.py')
if sys.platform != 'win32':
run_script('pylint.py')
run_script('coffeelint.py')
run_script('build.py', ['-c', 'Debug'])
run_script('test.py', ['--ci'])
def run_script(script, args=[]):
print 'Running', script
script = os.path.join(SOURCE_ROOT, 'script', script)
subprocess.check_call([sys.executable, script] + args)
if __name__ == '__main__':
sys.exit(main())