2015-09-05 03:06:09 +03:00
|
|
|
#!/usr/bin/env python2.7
|
|
|
|
from __future__ import division
|
|
|
|
from __future__ import print_function
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
from subprocess import call
|
|
|
|
|
|
|
|
BOLD = '\033[1m'
|
|
|
|
RED = '\033[91m'
|
|
|
|
GREEN = '\033[92m'
|
|
|
|
YELLOW = '\033[33m'
|
|
|
|
RESET = '\033[0m'
|
|
|
|
|
|
|
|
TARGETS = [
|
|
|
|
'itest_lucid',
|
|
|
|
'itest_precise',
|
|
|
|
'itest_trusty',
|
2016-04-27 22:54:04 +03:00
|
|
|
'itest_xenial',
|
2015-09-05 03:06:09 +03:00
|
|
|
'itest_wheezy',
|
|
|
|
'itest_jessie',
|
|
|
|
'itest_stretch',
|
2015-09-18 20:14:49 +03:00
|
|
|
'itest_tox',
|
2015-09-05 03:06:09 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
def log(line, color=''):
|
|
|
|
print(BOLD + color + line + RESET)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2015-09-17 03:16:05 +03:00
|
|
|
num_workers = int(os.environ['CIRCLE_NODE_TOTAL'])
|
2015-09-05 03:06:09 +03:00
|
|
|
node_index = int(os.environ['CIRCLE_NODE_INDEX'])
|
2015-09-17 03:16:05 +03:00
|
|
|
assert node_index < num_workers
|
2015-09-05 03:06:09 +03:00
|
|
|
|
2015-09-17 03:16:05 +03:00
|
|
|
my_targets = TARGETS[node_index::num_workers]
|
2015-09-05 03:06:09 +03:00
|
|
|
status = 0
|
|
|
|
|
|
|
|
for target in my_targets:
|
|
|
|
log('Executing target {}...'.format(target), color=YELLOW)
|
|
|
|
target_status = call(('make', target))
|
|
|
|
|
|
|
|
if target_status == 0:
|
|
|
|
log(
|
|
|
|
'Target {} completed successfully'.format(target),
|
|
|
|
color=GREEN,
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
status = target_status
|
|
|
|
log(
|
|
|
|
'Error! Target {} failed with exit status {}'.format(
|
|
|
|
target,
|
|
|
|
target_status,
|
|
|
|
),
|
|
|
|
color=RED,
|
|
|
|
)
|
|
|
|
|
|
|
|
sys.exit(status)
|