electron/script/cibuild
2015-05-28 16:03:06 +08:00

69 lines
1.8 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-4.8',
'g++-4.8',
'gcc-multilib',
'g++-multilib',
]
def main():
os.environ['CI'] = '1'
is_travis = (os.getenv('TRAVIS') == 'true')
if is_travis and sys.platform == 'linux2':
print 'Setup travis CI'
execute(['sudo', 'add-apt-repository', '-y', 'ppa:ubuntu-toolchain-r/test'])
execute(['sudo', 'apt-get', 'update'])
execute(['sudo', 'apt-get', 'install'] + LINUX_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'))
if is_travis and sys.platform == 'linux2':
with scoped_env('CXX', 'g++-4.8'):
with scoped_env('CC', 'gcc-4.8'):
run_script('bootstrap.py', ['--dev'])
run_script('update.py')
else:
run_script('bootstrap.py', ['--dev'])
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())