forked from electron/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcibuild
executable file
·116 lines (92 loc) · 2.87 KB
/
cibuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env python
import os
import subprocess
import sys
from lib.config import PLATFORM
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',
'libnss3-dev',
'libxtst-dev',
]
LINUX_DEPS_NO_ARM = [
'gcc-multilib',
'g++-multilib',
]
LINUX_DEPS_ARM = [
'binutils-aarch64-linux-gnu',
'libc6-dev-armhf-cross',
'linux-libc-dev-armhf-cross',
'g++-arm-linux-gnueabihf',
'g++-4.8-multilib-arm-linux-gnueabihf',
'gcc-4.8-multilib-arm-linux-gnueabihf',
]
LINUX_DEPS_ARM64 = [
'binutils-aarch64-linux-gnu',
'libc6-dev-arm64-cross',
'linux-libc-dev-arm64-cross',
'g++-4.8-aarch64-linux-gnu',
'gcc-4.8-aarch64-linux-gnu',
'gcc-aarch64-linux-gnu',
]
def main():
os.environ['CI'] = '1'
# Ignore the CXX and CC env in CI.
try:
del os.environ['CC']
del os.environ['CXX']
except KeyError:
pass
target_arch = 'x64'
if os.environ.has_key('TARGET_ARCH'):
target_arch = os.environ['TARGET_ARCH']
if PLATFORM == 'linux' and target_arch == 'x64':
os.environ['DISPLAY'] = ':99.0'
execute(['sh', '-e', '/etc/init.d/xvfb', 'start'])
# CI's npm is not reliable.
npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
execute([npm, 'install', '[email protected]'])
log_versions()
# Add "./node_modules/.bin" to the beginning of $PATH, which will ensure
# future "npm" invocations use the right version.
node_bin_dir = os.path.join(SOURCE_ROOT, 'node_modules', '.bin')
os.environ['PATH'] = os.path.pathsep.join([node_bin_dir,
os.environ.get('PATH', '')])
is_release = os.environ.get('ELECTRON_RELEASE', '') == '1'
args = ['--target_arch=' + target_arch]
if not is_release:
args += ['--dev']
run_script('bootstrap.py', args)
if PLATFORM != 'win32':
sys.stderr.write('\nRunning `npm run lint`\n')
sys.stderr.flush()
execute([npm, 'run', 'lint'])
if is_release:
run_script('build.py', ['-c', 'R'])
run_script('create-dist.py')
run_script('upload.py')
else:
run_script('build.py', ['-c', 'D'])
if PLATFORM == 'win32' or target_arch == 'x64':
run_script('test.py', ['--ci', '--rebuild_native_modules'])
run_script('verify-ffmpeg.py')
def run_script(script, args=[]):
sys.stderr.write('\nRunning ' + script +'\n')
sys.stderr.flush()
script = os.path.join(SOURCE_ROOT, 'script', script)
subprocess.check_call([sys.executable, script] + args)
def log_versions():
sys.stderr.write('\nnode --version\n')
sys.stderr.flush()
subprocess.call(['node', '--version'])
sys.stderr.write('\nnpm --version\n')
sys.stderr.flush()
npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
subprocess.call([npm, '--version'])
if __name__ == '__main__':
sys.exit(main())