2013-08-21 07:15:22 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import os
|
|
|
|
import subprocess
|
2013-08-21 17:41:34 +04:00
|
|
|
import sys
|
2013-08-21 07:15:22 +04:00
|
|
|
|
2014-08-09 05:22:06 +04:00
|
|
|
from lib.util import execute, rm_rf, scoped_env
|
2013-11-26 05:39:24 +04:00
|
|
|
|
2013-08-21 07:15:22 +04:00
|
|
|
|
2013-08-21 17:41:34 +04:00
|
|
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
|
|
|
2014-08-08 19:32:51 +04:00
|
|
|
LINUX_DEPS = [
|
2014-10-21 11:01:24 +04:00
|
|
|
'libdbus-1-dev',
|
2014-08-08 19:32:51 +04:00
|
|
|
'libgnome-keyring-dev',
|
|
|
|
'libgtk2.0-dev',
|
|
|
|
'libnotify-dev',
|
|
|
|
'gcc-multilib',
|
|
|
|
'g++-multilib',
|
|
|
|
]
|
|
|
|
|
2013-08-21 17:41:34 +04:00
|
|
|
|
|
|
|
def main():
|
2014-02-17 13:50:25 +04:00
|
|
|
os.environ['CI'] = '1'
|
|
|
|
|
2014-08-09 05:22:06 +04:00
|
|
|
is_travis = (os.getenv('TRAVIS') == 'true')
|
|
|
|
if is_travis and sys.platform == 'linux2':
|
2014-08-09 05:48:37 +04:00
|
|
|
print 'Setup travis CI'
|
2014-08-09 05:22:06 +04:00
|
|
|
execute(['sudo', 'apt-get', 'update'])
|
|
|
|
execute(['sudo', 'apt-get', 'install'] + LINUX_DEPS)
|
2014-08-09 05:48:37 +04:00
|
|
|
|
|
|
|
os.environ['DISPLAY'] = ':99.0'
|
|
|
|
execute(['sh', '-e', '/etc/init.d/xvfb', 'start'])
|
2014-08-08 19:10:20 +04:00
|
|
|
|
2013-11-26 05:39:24 +04:00
|
|
|
rm_rf(os.path.join(SOURCE_ROOT, 'out'))
|
2013-12-16 11:15:33 +04:00
|
|
|
rm_rf(os.path.join(SOURCE_ROOT, 'node_modules'))
|
2014-02-02 15:58:25 +04:00
|
|
|
rm_rf(os.path.join(SOURCE_ROOT, 'frameworks'))
|
2014-05-18 19:35:07 +04:00
|
|
|
rm_rf(os.path.join(SOURCE_ROOT, 'external_binaries'))
|
2014-03-10 20:01:06 +04:00
|
|
|
rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'apm', 'node_modules'))
|
2013-11-26 07:04:37 +04:00
|
|
|
rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'download',
|
|
|
|
'libchromiumcontent'))
|
2013-11-26 05:39:24 +04:00
|
|
|
|
2014-08-09 05:22:06 +04:00
|
|
|
if is_travis and sys.platform == 'linux2':
|
|
|
|
with scoped_env('CXX', 'g++'):
|
|
|
|
with scoped_env('CC', 'gcc'):
|
|
|
|
run_script('bootstrap.py')
|
|
|
|
run_script('update.py')
|
|
|
|
else:
|
|
|
|
run_script('bootstrap.py')
|
|
|
|
|
2013-08-21 17:41:34 +04:00
|
|
|
run_script('cpplint.py')
|
2014-03-03 15:31:45 +04:00
|
|
|
if sys.platform != 'win32':
|
|
|
|
run_script('pylint.py')
|
2013-09-27 06:49:55 +04:00
|
|
|
run_script('coffeelint.py')
|
2014-05-18 19:52:14 +04:00
|
|
|
run_script('build.py', ['-c', 'Debug'])
|
2013-08-21 17:41:34 +04:00
|
|
|
run_script('test.py', ['--ci'])
|
|
|
|
|
|
|
|
|
|
|
|
def run_script(script, args=[]):
|
2014-05-09 06:17:02 +04:00
|
|
|
print 'Running', script
|
2013-08-21 17:41:34 +04:00
|
|
|
script = os.path.join(SOURCE_ROOT, 'script', script)
|
|
|
|
subprocess.check_call([sys.executable, script] + args)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|