From 3ba558b4b864b6346a2a26e664fe80daf82de2f3 Mon Sep 17 00:00:00 2001 From: Miguel Dias Costa Date: Sun, 25 Oct 2020 11:13:10 +0800 Subject: [PATCH] take into account multiple easyblock PRs when uploading test reports --- easybuild/tools/options.py | 10 +++++----- easybuild/tools/testing.py | 18 +++++++++++------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/easybuild/tools/options.py b/easybuild/tools/options.py index 24ee5f7c3c..38640056cf 100644 --- a/easybuild/tools/options.py +++ b/easybuild/tools/options.py @@ -1454,11 +1454,11 @@ def set_up_configuration(args=None, logfile=None, testing=False, silent=False): init_build_options(build_options=build_options, cmdline_options=options) # done here instead of in _postprocess_include because github integration requires build_options to be initialized - try: - easyblock_prs = map(int, eb_go.options.include_easyblocks_from_pr) - except ValueError: - raise EasyBuildError("Argument to --include-easyblocks-from-pr must be a comma separated list of PR numbers.") - if easyblock_prs: + if eb_go.options.include_easyblocks_from_pr: + try: + easyblock_prs = map(int, eb_go.options.include_easyblocks_from_pr) + except ValueError: + raise EasyBuildError("Argument to --include-easyblocks-from-pr must be a comma separated list of PR #s.") if eb_go.options.include_easyblocks: # check if you are including the same easyblock twice diff --git a/easybuild/tools/testing.py b/easybuild/tools/testing.py index 70b89de95e..c1086446b3 100644 --- a/easybuild/tools/testing.py +++ b/easybuild/tools/testing.py @@ -279,11 +279,13 @@ def post_pr_test_report(pr_nr, repo_type, test_report, msg, init_session_state, comment_lines = ["Test report by @%s" % github_user] - easyblocks_pr_nr = build_option('include_easyblocks_from_pr') - if easyblocks_pr_nr: + if build_option('include_easyblocks_from_pr'): if repo_type == GITHUB_EASYCONFIGS_REPO: - comment_lines.append("Using easyblocks from https://github.com/%s/%s/pull/%s" % ( - pr_target_account, GITHUB_EASYBLOCKS_REPO, easyblocks_pr_nr)) + easyblocks_pr_nrs = map(int, build_option('include_easyblocks_from_pr')) + comment_lines.append("Using easyblocks from PR(s) %s" % + ", ".join(["https://github.com/%s/%s/pull/%s" % + (pr_target_account, GITHUB_EASYBLOCKS_REPO, easyblocks_pr_nr) + for easyblocks_pr_nr in easyblocks_pr_nrs])) elif repo_type == GITHUB_EASYBLOCKS_REPO: comment_lines.append(test_report['overview']) else: @@ -316,7 +318,7 @@ def overall_test_report(ecs_with_res, orig_cnt, success, msg, init_session_state """ dump_path = build_option('dump_test_report') pr_nr = build_option('from_pr') - eb_pr_nr = build_option('include_easyblocks_from_pr') + eb_pr_nrs = build_option('include_easyblocks_from_pr') upload = build_option('upload_test_report') if upload: @@ -325,9 +327,11 @@ def overall_test_report(ecs_with_res, orig_cnt, success, msg, init_session_state if pr_nr: # upload test report to gist and issue a comment in the PR to notify txt = post_pr_test_report(pr_nr, GITHUB_EASYCONFIGS_REPO, test_report, msg, init_session_state, success) - elif eb_pr_nr: + elif eb_pr_nrs: # upload test report to gist and issue a comment in the easyblocks PR to notify - txt = post_pr_test_report(eb_pr_nr, GITHUB_EASYBLOCKS_REPO, test_report, msg, init_session_state, success) + for eb_pr_nr in map(int, eb_pr_nrs): + txt = post_pr_test_report(eb_pr_nr, GITHUB_EASYBLOCKS_REPO, test_report, msg, init_session_state, + success) else: # only upload test report as a gist gist_url = upload_test_report_as_gist(test_report['full'])