aboutsummaryrefslogtreecommitdiff
path: root/.ci/generate_test_report_github.py
blob: 6785e82f3440b1f495e9791dae596fe2f47d1466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Script to generate a build report for Github."""

import argparse
import platform

import generate_test_report_lib

def compute_platform_title() -> str:
    logo = ":window:" if platform.system() == "Windows" else ":penguin:"
    # On Linux the machine value is x86_64 on Windows it is AMD64.
    if platform.machine() == "x86_64" or platform.machine() == "AMD64":
        arch = "x64"
    else:
        arch = platform.machine()
    return f"{logo} {platform.system()} {arch} Test Results"


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("return_code", help="The build's return code.", type=int)
    parser.add_argument(
        "build_test_logs", help="Paths to JUnit report files and ninja logs.", nargs="*"
    )
    args = parser.parse_args()

    report = generate_test_report_lib.generate_report_from_files(
        compute_platform_title(), args.return_code, args.build_test_logs
    )

    print(report)