Commit 35f451dc authored by Jan Kiene's avatar Jan Kiene
Browse files

integrate new coverage jobs into gtlab pages setup

parent fd6dda87
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -11,9 +11,6 @@

  <h2>Test Coverage</h2>

  <ul>
    <li><a href="coverage/index.html">Coverage report</a></li>
    <li><a href="coverage_stv/index.html">Coverage of short test vectors</a></li>
  </ul>
  {}

</body>
+27 −8
Original line number Diff line number Diff line
@@ -40,7 +40,10 @@ JOBS_FLOAT_REPO = {
    "complexity-osba-in-binaural_room_ir-out": "OSBA in, BINAURAL_ROOM_IR out",
    "complexity-StereoDmxEVS-stereo-in-mono-out": "StereoDmxEVS, Stereo in, Mono out",
    # "timeless" jobs (not complexity)
    "coverage-test-on-main-scheduled": "Coverage",
    "coverage-test-on-main-scheduled-stv": "Short test vector coverage (~ merge request pipelines)",
    "coverage-test-on-main-scheduled-ltv": "Long test vector coverage (for test_param_file.py, test_sba.py and test_renderer.py)",
    "ivas-conformance-linux": "Conformance test coverage",
    "coverage-merge": "Merged coverage (all of the above combined)",
}
JOBS_BASOP_REPO = {
    "ivas-pytest-compare_ref-long-dec": "Pytest decoder compare to ref LTV",
@@ -77,6 +80,13 @@ JOBS_FOR_PROJECT_ID = {
    PROJECT_ID_BASOP_REPO: JOBS_BASOP_REPO,
}

ARTIFACT_FOLDER_4_COVERAGE_JOBS = {
    "coverage-test-on-main-scheduled-stv": "coverage_stv",
    "coverage-test-on-main-scheduled-ltv": "coverage_ltv",
    "ivas-conformance-linux": "coverage_conformance",
    "coverage-merge": "coverage-merged",
}

ARTIFACTS = "artifacts.zip"
API_URL_BASE = "https://forge.3gpp.org/rep/api/v4/projects/{}/jobs"
PUBLIC_FOLDER = pathlib.Path("./public").absolute()
@@ -104,15 +114,20 @@ def main():

def create_landing_page(jobs, index_html, project_id):
    # dynamically create the complexity links on the landing page
    link_html = list()
    link_html = ["<ul>"]
    link_html_complexity = ["<ul>"]
    link_html_coverage = ["<ul>"]

    for job, link_text in jobs.items():
        if job.startswith("complexity"):
            line = f'<li><a href="{job}-public/index.html">{link_text}</a></li>'
            link_html.append(line)
    link_html.append("</ul>")
    link_html_text = "\n".join(link_html)
            link_html_complexity.append(line)
        elif job.startswith("coverage") or job == "ivas-conformance-linux":
            artifact_folder = ARTIFACT_FOLDER_4_COVERAGE_JOBS[job]
            line = f'<li><a href="{artifact_folder}/index.html">{link_text}</a></li>'
            link_html_coverage.append(line)

    link_html_complexity.append("</ul>")
    link_html_coverage.append("</ul>")

    if project_id == PROJECT_ID_FLOAT_REPO:
        index_template = "index-pages.html"
@@ -126,14 +141,18 @@ def create_landing_page(jobs, index_html, project_id):
    with open(index_pages_tmpl_path) as f:
        index_pages_tmpl = f.read()

    index_pages_tmpl = index_pages_tmpl.format(link_html_text)
    link_html_complexity_text = "\n".join(link_html_complexity)
    link_html_coverage_text = "\n".join(link_html_coverage)
    index_pages_tmpl = index_pages_tmpl.format(
        link_html_complexity_text, link_html_coverage_text
    )

    with open(index_html, "w") as f:
        f.write(index_pages_tmpl)


def get_artifacts_for_jobs_and_return_num_failed(
    jobs: list, project_id: int, success_only: bool
    jobs: dict, project_id: int, success_only: bool
) -> int:
    """
    Get specified artifact folders for all jobs given and put them into the public folder.