Merge pull request #567 from atom/linux-ci

Add Linux CI
This commit is contained in:
Cheng Zhao 2014-08-09 10:24:18 +08:00
commit b8d5aa586e
5 changed files with 55 additions and 10 deletions

View file

@ -1,4 +1,8 @@
language: objective-c
language: cpp
compiler: clang
os:
- linux
- osx
notifications:
email:

View file

@ -20,7 +20,9 @@ def main():
args = parse_args()
for config in args.configuration:
build_path = os.path.join('out', config)
subprocess.call([ninja, '-C', build_path, args.target])
ret = subprocess.call([ninja, '-C', build_path, args.target])
if ret != 0:
sys.exit(ret)
def parse_args():

View file

@ -4,15 +4,32 @@ import os
import subprocess
import sys
from lib.util import rm_rf
from lib.util import execute, rm_rf, scoped_env
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
LINUX_DEPS = [
'libgnome-keyring-dev',
'libgtk2.0-dev',
'libnotify-dev',
'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', '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'))
@ -21,7 +38,14 @@ def main():
rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'download',
'libchromiumcontent'))
run_script('bootstrap.py')
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')
run_script('cpplint.py')
if sys.platform != 'win32':
run_script('pylint.py')

View file

@ -29,6 +29,18 @@ def scoped_cwd(path):
os.chdir(cwd)
@contextlib.contextmanager
def scoped_env(key, value):
origin = ''
if key in os.environ:
origin = os.environ[key]
os.environ[key] = value
try:
yield
finally:
os.environ[key] = origin
def download(text, url, path):
safe_mkdir(os.path.dirname(path))
with open(path, 'wb') as local_file:

View file

@ -35,12 +35,15 @@ def update_gyp():
if sys.platform == 'cygwin':
# Force using win32 python on cygwin.
python = os.path.join('vendor', 'python_26', 'python.exe')
subprocess.call([python, gyp,
'-f', 'ninja', '--depth', '.', 'atom.gyp',
'-Icommon.gypi', '-Ivendor/brightray/brightray.gypi',
'-Dlinux_clang=0', # Disable brightray's clang setting
'-Dtarget_arch={0}'.format(arch),
'-Dlibrary=static_library'])
ret = subprocess.call([python, gyp,
'-f', 'ninja', '--depth', '.', 'atom.gyp',
'-Icommon.gypi', '-Ivendor/brightray/brightray.gypi',
'-Dlinux_clang=0', # Disable brightray's clang setting
'-Dtarget_arch={0}'.format(arch),
'-Dlibrary=static_library'])
if ret != 0:
sys.exit(ret)
if __name__ == '__main__':