diff --git a/pixi.toml b/pixi.toml index 39286b5..488b849 100644 --- a/pixi.toml +++ b/pixi.toml @@ -9,12 +9,14 @@ platforms = ["osx-arm64", "linux-64", "osx-64", "win-64"] [tasks] # Rewrite the html with the updated data generate-html = { cmd = "repror generate-html", inputs = [ + "src/repror/**", "src/repror/cli/templates/index.html.jinja", "repro.local.db", ], outputs = [ "docs.local/index.html", ] } generate-html-prod = { cmd = "repror generate-html", env = { REPRO_DB_NAME = "repro.db" }, inputs = [ + "src/repror/**", "repro.db", "src/repror/cli/templates/index.html.jinja", ], outputs = [ diff --git a/src/repror/cli/generate_html.py b/src/repror/cli/generate_html.py index fa60bf4..21a3723 100644 --- a/src/repror/cli/generate_html.py +++ b/src/repror/cli/generate_html.py @@ -44,19 +44,32 @@ def get_platform_fa(platform): return "fa-solid fa-question" # Default emoji if platform is unknown -def get_build_state_fa(build_state: BuildState): - if build_state == BuildState.SUCCESS: - return "fa-solid fa-check text-green-600" +reproducible = "fa-solid fa-thumbs-up text-green-600" +failure = "fa-solid fa-times text-red-600" +non_reproducible = "fa-solid fa-thumbs-down text-red-300" + + +def get_build_state_fa( + build_state: BuildState, rebuild_state: Optional[BuildState] = None +): + if build_state == BuildState.SUCCESS and ( + rebuild_state is None or rebuild_state == BuildState.SUCCESS + ): + return reproducible elif build_state == BuildState.FAIL: - return "fa-solid fa-times text-red-600" + return failure + elif build_state == BuildState.SUCCESS and rebuild_state == BuildState.FAIL: + return non_reproducible + else: + return "fa-solid fa-question" def platform_fa(platform): return get_platform_fa(platform) -def build_state_fa(platform): - return get_build_state_fa(platform) +def build_state_fa(build, rebuild): + return get_build_state_fa(build, rebuild) def get_docs_dir(root_folder: Path): @@ -78,7 +91,6 @@ def rerender_html(root_folder: Path, update_remote: bool = False): loader=FileSystemLoader(searchpath=Path(__file__).parent / "templates") ) env.filters["platform_fa"] = platform_fa - env.filters["build_state_fa"] = build_state_fa builds = get_rebuild_data() @@ -115,7 +127,13 @@ def rerender_html(root_folder: Path, update_remote: bool = False): template = env.get_template("index.html.jinja") - html_content = template.render(by_platform=by_platform) + html_content = template.render( + by_platform=by_platform, + build_state_fa=build_state_fa, + reproducible=reproducible, + failure=failure, + non_reproducible=non_reproducible, + ) # Save the table to README.md index_html_path = docs_folder / Path("index.html") index_html_path.parent.mkdir(exist_ok=True) diff --git a/src/repror/cli/templates/index.html.jinja b/src/repror/cli/templates/index.html.jinja index 89d1973..c2d7460 100644 --- a/src/repror/cli/templates/index.html.jinja +++ b/src/repror/cli/templates/index.html.jinja @@ -120,7 +120,13 @@
- +
+
Reproducible:
+ +
Non-reproducible:
+ +
Failure:
+
{% for platform, builds in by_platform.items() %}
@@ -140,7 +146,7 @@ {% for build in builds | sort(attribute='build_state') %}
- + {{ build.recipe_name }}