Add job url to test reports

This commit is contained in:
Mikhail f. Shiryaev 2022-08-09 18:49:55 +02:00
parent 32efae4f1b
commit bcf430b382
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4
2 changed files with 17 additions and 6 deletions

View File

@ -34,6 +34,7 @@ th {{ cursor: pointer; }}
<a href="{commit_url}">Commit</a> <a href="{commit_url}">Commit</a>
{additional_urls} {additional_urls}
<a href="{task_url}">Task (github actions)</a> <a href="{task_url}">Task (github actions)</a>
<a href="{job_url}">Job (github actions)</a>
</p> </p>
{test_part} {test_part}
</body> </body>
@ -150,6 +151,7 @@ def create_test_html_report(
test_result, test_result,
raw_log_url, raw_log_url,
task_url, task_url,
job_url,
branch_url, branch_url,
branch_name, branch_name,
commit_url, commit_url,
@ -236,12 +238,17 @@ def create_test_html_report(
[_get_html_url(url) for url in sorted(additional_urls, key=_get_html_url_name)] [_get_html_url(url) for url in sorted(additional_urls, key=_get_html_url_name)]
) )
raw_log_name = os.path.basename(raw_log_url)
if raw_log_name.endswith("?check_suite_focus=true"):
raw_log_name = "Job (github actions)"
result = HTML_BASE_TEST_TEMPLATE.format( result = HTML_BASE_TEST_TEMPLATE.format(
title=_format_header(header, branch_name), title=_format_header(header, branch_name),
header=_format_header(header, branch_name, branch_url), header=_format_header(header, branch_name, branch_url),
raw_log_name=os.path.basename(raw_log_url), raw_log_name=raw_log_name,
raw_log_url=raw_log_url, raw_log_url=raw_log_url,
task_url=task_url, task_url=task_url,
job_url=job_url,
test_part=test_part, test_part=test_part,
branch_name=branch_name, branch_name=branch_name,
commit_url=commit_url, commit_url=commit_url,

View File

@ -2,7 +2,12 @@ import os
import logging import logging
import ast import ast
from env_helper import GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_URL from env_helper import (
GITHUB_JOB_URL,
GITHUB_REPOSITORY,
GITHUB_RUN_URL,
GITHUB_SERVER_URL,
)
from report import ReportColorTheme, create_test_html_report from report import ReportColorTheme, create_test_html_report
@ -66,13 +71,11 @@ def upload_results(
branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/pull/{pr_number}" branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/pull/{pr_number}"
commit_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commit/{commit_sha}" commit_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commit/{commit_sha}"
task_url = GITHUB_RUN_URL
if additional_urls: if additional_urls:
raw_log_url = additional_urls[0] raw_log_url = additional_urls[0]
additional_urls.pop(0) additional_urls.pop(0)
else: else:
raw_log_url = task_url raw_log_url = GITHUB_JOB_URL()
statuscolors = ( statuscolors = (
ReportColorTheme.bugfixcheck if "bugfix validate check" in check_name else None ReportColorTheme.bugfixcheck if "bugfix validate check" in check_name else None
@ -82,7 +85,8 @@ def upload_results(
check_name, check_name,
test_results, test_results,
raw_log_url, raw_log_url,
task_url, GITHUB_RUN_URL,
GITHUB_JOB_URL(),
branch_url, branch_url,
branch_name, branch_name,
commit_url, commit_url,