7 from lib.config import PLATFORM
8 from lib.util import execute, rm_rf, scoped_env
11 SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
16 'libgnome-keyring-dev',
26 'libc6-dev-armhf-cross',
27 'linux-libc-dev-armhf-cross',
28 'g++-arm-linux-gnueabihf',
33 os.environ['CI'] = '1'
35 if os.environ.has_key('JANKY_SHA1'):
39 if os.environ.has_key('TARGET_ARCH'):
40 target_arch = os.environ['TARGET_ARCH']
42 is_travis = (os.getenv('TRAVIS') == 'true')
43 if is_travis and PLATFORM == 'linux':
44 print 'Setup travis CI'
45 execute(['sudo', 'apt-get', 'update'])
47 if target_arch == 'arm':
48 deps += LINUX_DEPS_ARM
49 execute(['sudo', 'apt-get', 'install'] + deps)
51 execute(['sh', '-e', '/etc/init.d/xvfb', 'start'])
53 if PLATFORM == 'linux':
54 os.environ['DISPLAY'] = ':99.0'
56 # CI's npm is not reliable.
57 npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
58 execute([npm, 'install', 'npm@2.12.1'])
62 is_release = os.environ.has_key('ELECTRON_RELEASE')
63 args = ['--target_arch=' + target_arch]
66 run_script('bootstrap.py', args)
68 if PLATFORM != 'win32':
69 sys.stderr.write('\nRunning `npm run lint`\n')
71 execute([npm, 'run', 'lint'])
72 run_script('pylint.py')
74 run_script('build.py', ['-c', 'R'])
75 run_script('create-dist.py')
76 run_script('upload.py')
78 if PLATFORM == 'win32':
79 os.environ['OUTPUT_TO_FILE'] = 'output.log'
80 run_script('build.py', ['-c', 'D'])
81 if PLATFORM == 'win32' or target_arch == 'x64':
82 run_script('test.py', ['--ci'])
85 def run_script(script, args=[]):
86 sys.stderr.write('\nRunning ' + script +'\n')
88 script = os.path.join(SOURCE_ROOT, 'script', script)
89 subprocess.check_call([sys.executable, script] + args)
93 sys.stderr.write('\nnode --version\n')
95 subprocess.call(['node', '--version'])
97 sys.stderr.write('\nnpm --version\n')
99 npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
100 subprocess.call([npm, '--version'])
104 if os.path.isdir('/usr/local/share/nodenv'):
105 os.environ['NODENV_ROOT'] = '/usr/local/share/nodenv'
106 os.environ['PATH'] = '/usr/local/share/nodenv/bin:/usr/local/share/nodenv/shims:' + os.environ['PATH']
107 os.environ['NODENV_VERSION'] = 'v0.10.21'
110 if __name__ == '__main__':