mirror of https://github.com/axmolengine/axmol.git
modify job-comment-trigger to support [console].
This commit is contained in:
parent
d523fc6a2a
commit
2f5e9ed654
|
@ -4,11 +4,24 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
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']
|
project_types = ['cpp', 'lua']
|
||||||
PROJ_SUFFIX = 'Proj'
|
PROJ_SUFFIX = 'Proj'
|
||||||
phonePlats = ['mac','ios','android']
|
phonePlats = ['mac','ios','android']
|
||||||
|
|
||||||
|
#need use console's position, perhaps should be set an env-param
|
||||||
cocos_console_dir = 'tools/cocos2d-console/bin/'
|
cocos_console_dir = 'tools/cocos2d-console/bin/'
|
||||||
|
|
||||||
#now cocos2d-console suport different run on Platforms, e.g: only run android on win
|
#now cocos2d-console suport different run on Platforms, e.g: only run android on win
|
||||||
|
@ -18,17 +31,8 @@ runSupport = {
|
||||||
'linux' : [0, 0, 1]
|
'linux' : [0, 0, 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
_argvs = sys.argv
|
|
||||||
print 'input argvs:', _argvs[1], _argvs[2]
|
|
||||||
_will_create = False
|
|
||||||
_will_run = False
|
_will_run = False
|
||||||
if _argvs[1]=='create' || _argvs[2]=='create':
|
if console_cmd=='run':
|
||||||
_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
|
|
||||||
_will_run = True
|
_will_run = True
|
||||||
|
|
||||||
curPlat = sys.platform
|
curPlat = sys.platform
|
||||||
|
@ -50,7 +54,7 @@ def create_project():
|
||||||
idx = 0
|
idx = 0
|
||||||
for proj in project_types:
|
for proj in project_types:
|
||||||
print 'proj: ', proj
|
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
|
print proj,'cmd:',cmd
|
||||||
idx += 1
|
idx += 1
|
||||||
info_create = os.system(cmd) #call cmd on win is diff
|
info_create = os.system(cmd) #call cmd on win is diff
|
||||||
|
@ -60,7 +64,7 @@ def build_run():
|
||||||
for proj in project_types:
|
for proj in project_types:
|
||||||
idx = 0
|
idx = 0
|
||||||
for phone in phonePlats:
|
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
|
print proj,'cmd:',cmd
|
||||||
if runSupport[curPlat][idx]:
|
if runSupport[curPlat][idx]:
|
||||||
info_run = os.system(cmd)
|
info_run = os.system(cmd)
|
||||||
|
@ -68,9 +72,8 @@ def build_run():
|
||||||
idx += 1
|
idx += 1
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if _will_create:
|
clean_project()
|
||||||
clean_project()
|
create_project()
|
||||||
create_project()
|
|
||||||
if _will_run:
|
if _will_run:
|
||||||
build_run()
|
build_run()
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,16 @@ def main():
|
||||||
print comment_body
|
print comment_body
|
||||||
pattern = re.compile("\[ci(\s+)rebuild\]", re.I)
|
pattern = re.compile("\[ci(\s+)rebuild\]", re.I)
|
||||||
result = pattern.search(comment_body)
|
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)
|
print 'skip build for pull request #' + str(pr_num)
|
||||||
return(0)
|
return(0)
|
||||||
|
|
||||||
|
@ -75,7 +84,17 @@ def main():
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
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
|
#send trigger and payload
|
||||||
post_data = {'payload':""}
|
post_data = {'payload':""}
|
||||||
post_data['payload']= json.dumps(payload_forword)
|
post_data['payload']= json.dumps(payload_forword)
|
||||||
|
|
Loading…
Reference in New Issue