diff options
-rw-r--r-- | mod/mod-ci-github-gq.hxx | 4 | ||||
-rw-r--r-- | mod/mod-ci-github.cxx | 82 |
2 files changed, 47 insertions, 39 deletions
diff --git a/mod/mod-ci-github-gq.hxx b/mod/mod-ci-github-gq.hxx index 269b881..19c4924 100644 --- a/mod/mod-ci-github-gq.hxx +++ b/mod/mod-ci-github-gq.hxx @@ -93,10 +93,6 @@ namespace brep // // Title and summary are required and cannot be empty. // - // @@ TMP Neither this function nor the gq_create_check_run() equivalent are - // ever called with queued (only building) so should we hardcode - // build_state::building (and remove the build_state argument)? - // bool gq_update_check_run (const basic_mark& error, check_run& cr, diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index c090014..e3ac13f 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -602,15 +602,51 @@ namespace brep // Let's capitalize the synthetic conclusion check run name to make it // easier to distinguish from the regular ones. // - static string conclusion_check_run_name ("CONCLUSION"); + static const string conclusion_check_run_name ("CONCLUSION"); - static check_run::description_type conclusion_check_run_building_description { - "\U0001F7E1 IN PROGRESS", // Yellow circle. - "Waiting for all builds to complete"}; + // Yellow circle. + // + static const string conclusion_building_title ("\U0001F7E1 IN PROGRESS"); + static const string conclusion_building_summary ( + "Waiting for all the builds to complete."); + + // "Medium white" circle. + // + static const string check_run_queued_title ("\U000026AA QUEUED"); + static const string check_run_queued_summary ( + "Waiting for the build to start."); - static check_run::description_type check_run_queued_description { - "\U000026AA QUEUED", // "Medium white" circle. - "Waiting for build to start"}; + // Yellow circle. + // + static const string check_run_building_title ("\U0001F7E1 BUILDING"); + static const string check_run_building_summary ( + "Waiting for the build to complete."); + + // Return the colored circle corresponding to a result_status. + // + // Note: the rest of the title is produced by to_string(result_status). + // + static string + circle (result_status rs) + { + switch (rs) + { + case result_status::success: return "\U0001F7E2"; // Green circle. + case result_status::warning: return "\U0001F7E0"; // Orange circle. + case result_status::error: + case result_status::abort: + case result_status::abnormal: return "\U0001F534"; // Red circle. + + // Valid values we should never encounter. + // + case result_status::skip: + case result_status::interrupt: + throw invalid_argument ("unexpected result_status value: " + + to_string (rs)); + } + + return ""; // Should never reach. + } bool ci_github:: handle_branch_push (gh_push_event ps, bool warning_success) @@ -1144,30 +1180,6 @@ namespace brep return true; } - // Return the colored circle corresponding to a result_status. - // - static string - circle (result_status rs) - { - switch (rs) - { - case result_status::success: return "\U0001F7E2"; // Green circle. - case result_status::warning: return "\U0001F7E0"; // Orange circle. - case result_status::error: - case result_status::abort: - case result_status::abnormal: return "\U0001F534"; // Red circle. - - // Valid values we should never encounter. - // - case result_status::skip: - case result_status::interrupt: - throw invalid_argument ("unexpected result_status value: " + - to_string (rs)); - } - - return ""; // Should never reach. - } - // Make a check run summary from a CI start_result. // static string @@ -1971,7 +1983,7 @@ namespace brep &sd, &error, this] (string name, - const check_run::description_type& output) + const check_run::description_type& descr) -> optional<check_run> { check_run cr; @@ -1986,7 +1998,7 @@ namespace brep sd.report_sha, details_url (tenant_id), build_state::building, - output.title, output.summary)) + descr.title, descr.summary)) { return cr; } @@ -2551,8 +2563,8 @@ namespace brep sd.repository_node_id, *cr->node_id, build_state::building, - "\U0001F7E1 IN PROGRESS", // Yellow circle - "Waiting for build to complete")) + check_run_buildin_title, + check_run_buildin_summary)) { // Do nothing further if the state was already built on GitHub (note // that this is based on the above-mentioned special GitHub semantics |