@@ -138,7 +138,7 @@ def session_state():
138138 }
139139
140140
141- def create_test_report (msg , ecs_with_res , init_session_state , pr_nr = None , gist_log = False , easyblock_pr_nrs = None ):
141+ def create_test_report (msg , ecs_with_res , init_session_state , pr_nrs = None , gist_log = False , easyblock_pr_nrs = None ):
142142 """Create test report for easyconfigs PR, in Markdown format."""
143143
144144 github_user = build_option ('github_user' )
@@ -149,10 +149,11 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nr=None, gist_l
149149
150150 # create a gist with a full test report
151151 test_report = []
152- if pr_nr is not None :
152+ if pr_nrs is not None :
153153 repo = pr_target_repo or GITHUB_EASYCONFIGS_REPO
154+ pr_urls = ["https://github.com/%s/%s/pull/%s" % (pr_target_account , repo , pr_nr ) for pr_nr in pr_nrs ]
154155 test_report .extend ([
155- "Test report for https://github.com/%s/%s/pull/%s " % ( pr_target_account , repo , pr_nr ),
156+ "Test report for %s " % ', ' . join ( pr_urls ),
156157 "" ,
157158 ])
158159 if easyblock_pr_nrs :
@@ -190,10 +191,13 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nr=None, gist_l
190191 logtxt = read_file (ec_res ['log_file' ])
191192 partial_log_txt = '\n ' .join (logtxt .split ('\n ' )[- 500 :])
192193 descr = "(partial) EasyBuild log for failed build of %s" % ec ['spec' ]
193- if pr_nr is not None :
194- descr += " (PR #%s)" % pr_nr
194+
195+ if pr_nrs is not None :
196+ descr += " (PR #%s)" % ', #' .join (pr_nrs )
197+
195198 if easyblock_pr_nrs :
196199 descr += "" .join (" (easyblock PR #%s)" % nr for nr in easyblock_pr_nrs )
200+
197201 fn = '%s_partial.log' % os .path .basename (ec ['spec' ])[:- 3 ]
198202 gist_url = create_gist (partial_log_txt , fn , descr = descr , github_user = github_user )
199203 test_log = "(partial log available at %s)" % gist_url
@@ -291,7 +295,7 @@ def post_pr_test_report(pr_nr, repo_type, test_report, msg, init_session_state,
291295
292296 if build_option ('include_easyblocks_from_pr' ):
293297 if repo_type == GITHUB_EASYCONFIGS_REPO :
294- easyblocks_pr_nrs = map ( int , build_option ('include_easyblocks_from_pr' ))
298+ easyblocks_pr_nrs = [ int ( pr_nr ) for pr_nr in build_option ('include_easyblocks_from_pr' )]
295299 comment_lines .append ("Using easyblocks from PR(s) %s" %
296300 ", " .join (["https://github.com/%s/%s/pull/%s" %
297301 (pr_target_account , GITHUB_EASYBLOCKS_REPO , easyblocks_pr_nr )
@@ -327,22 +331,35 @@ def overall_test_report(ecs_with_res, orig_cnt, success, msg, init_session_state
327331 :param init_session_state: initial session state info to include in test report
328332 """
329333 dump_path = build_option ('dump_test_report' )
330- pr_nr = build_option ('from_pr' )
331- easyblock_pr_nrs = build_option ('include_easyblocks_from_pr' )
334+
335+ try :
336+ pr_nrs = [int (pr_nr ) for pr_nr in build_option ('from_pr' )]
337+ except ValueError :
338+ raise EasyBuildError ("Argument to --from-pr must be a comma separated list of PR #s." )
339+
340+ try :
341+ easyblock_pr_nrs = [int (pr_nr ) for pr_nr in build_option ('include_easyblocks_from_pr' )]
342+ except ValueError :
343+ raise EasyBuildError ("Argument to --include-easyblocks-from-pr must be a comma separated list of PR #s." )
344+
332345 upload = build_option ('upload_test_report' )
333346
334347 if upload :
335348 msg = msg + " (%d easyconfigs in total)" % orig_cnt
336- test_report = create_test_report (msg , ecs_with_res , init_session_state , pr_nr = pr_nr , gist_log = True ,
349+
350+ test_report = create_test_report (msg , ecs_with_res , init_session_state , pr_nrs = pr_nrs , gist_log = True ,
337351 easyblock_pr_nrs = easyblock_pr_nrs )
338- if pr_nr :
352+ if pr_nrs :
339353 # upload test report to gist and issue a comment in the PR to notify
340- txt = post_pr_test_report (pr_nr , GITHUB_EASYCONFIGS_REPO , test_report , msg , init_session_state , success )
354+ for pr_nr in pr_nrs :
355+ txt = post_pr_test_report (pr_nr , GITHUB_EASYCONFIGS_REPO , test_report , msg , init_session_state ,
356+ success )
341357 elif easyblock_pr_nrs :
342358 # upload test report to gist and issue a comment in the easyblocks PR to notify
343- for easyblock_pr_nr in map ( int , easyblock_pr_nrs ) :
359+ for easyblock_pr_nr in easyblock_pr_nrs :
344360 txt = post_pr_test_report (easyblock_pr_nr , GITHUB_EASYBLOCKS_REPO , test_report , msg ,
345361 init_session_state , success )
362+
346363 else :
347364 # only upload test report as a gist
348365 gist_url = upload_test_report_as_gist (test_report ['full' ])
0 commit comments