diff --git a/tools/jenkins-scripts/cocos-console-test.py b/tools/jenkins-scripts/cocos-console-test.py index 2c67ab746d..7f2682e27a 100755 --- a/tools/jenkins-scripts/cocos-console-test.py +++ b/tools/jenkins-scripts/cocos-console-test.py @@ -4,11 +4,24 @@ import os import sys +import json + + +# get payload argvs +console_param = 'create' +# payload = '' +if os.environ.has_key('payload'): + payload_str = os.environ['payload'] + payload = json.loads(payload_str) + if payload.has_key('console'): + console_cmd = payload['console'] +print 'console_param:',console_param project_types = ['cpp', 'lua'] PROJ_SUFFIX = 'Proj' phonePlats = ['mac','ios','android'] +#need use console's position, perhaps should be set an env-param cocos_console_dir = 'tools/cocos2d-console/bin/' #now cocos2d-console suport different run on Platforms, e.g: only run android on win @@ -18,17 +31,8 @@ runSupport = { 'linux' : [0, 0, 1] } -_argvs = sys.argv -print 'input argvs:', _argvs[1], _argvs[2] -_will_create = False _will_run = False -if _argvs[1]=='create' || _argvs[2]=='create': - _will_create = True -if _argvs[1]=='run' || _argvs[2]=='run': - _will_create = True - _will_run = True -if _will_create == False and _will_run == False: - _will_create = True +if console_cmd=='run': _will_run = True curPlat = sys.platform @@ -50,7 +54,7 @@ def create_project(): idx = 0 for proj in project_types: print 'proj: ', proj - cmd = 'cocos new -l '+proj+' '+proj+PROJ_SUFFIX + cmd = './'+cocos_console_dir+'cocos new -l '+proj+' '+proj+PROJ_SUFFIX print proj,'cmd:',cmd idx += 1 info_create = os.system(cmd) #call cmd on win is diff @@ -60,7 +64,7 @@ def build_run(): for proj in project_types: idx = 0 for phone in phonePlats: - cmd = 'cocos run -p '+phone+' -s '+proj+PROJ_SUFFIX + cmd = './'+cocos_console_dir+'cocos run -p '+phone+' -s '+proj+PROJ_SUFFIX print proj,'cmd:',cmd if runSupport[curPlat][idx]: info_run = os.system(cmd) @@ -68,9 +72,8 @@ def build_run(): idx += 1 def main(): - if _will_create: - clean_project() - create_project() + clean_project() + create_project() if _will_run: build_run() diff --git a/tools/jenkins-scripts/job-comment-trigger.py b/tools/jenkins-scripts/job-comment-trigger.py index 5d1bfd1493..e0964f4c32 100644 --- a/tools/jenkins-scripts/job-comment-trigger.py +++ b/tools/jenkins-scripts/job-comment-trigger.py @@ -26,7 +26,16 @@ def main(): print comment_body pattern = re.compile("\[ci(\s+)rebuild\]", re.I) result = pattern.search(comment_body) - if result is None: + + # will check console/console create + patternCrt = re.compile("\[console(\s+)create\]", re.I) + resCrt = patternCrt.search(comment_body) + resRun = None + if resCrt = None: + patternRun = re.compile("\[console\]", re.I) + resRun = patternRun.search(comment_body); + + if result is None and resCrt is None and resRun is None: print 'skip build for pull request #' + str(pr_num) return(0) @@ -75,7 +84,17 @@ def main(): except: traceback.print_exc() - job_trigger_url = os.environ['JOB_TRIGGER_URL'] + job_trigger_url = '' + if result: + job_trigger_url = os.environ['JOB_TRIGGER_URL'] + if resultCrt: + job_trigger_url = os.environ['JOB_CONSOLE_TEST_URL'] + payload_forword['console'] = 'create' + if resultRun: + job_trigger_url = os.environ['JOB_CONSOLE_TEST_URL'] + payload_forword['console'] = 'run' + print 'job_trigger_url is: ', job_trigger_url + #send trigger and payload post_data = {'payload':""} post_data['payload']= json.dumps(payload_forword)