diff --git a/docs/index.rst b/docs/index.rst index 01ca8ab0721..b0a2ad2c1a5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -58,7 +58,7 @@ documentation set that downstream product distributions can build on. Reference Integration workflow and health overview with links to :doc:`Integration Process ` and - `Integration Status `_. + `Integration Status `_. .. grid-item-card:: 🧩 Modules :link: modules/index @@ -77,7 +77,7 @@ documentation set that downstream product distributions can build on. Modules Verification Reports - Integration Status + Integration Status S-Core v1.0 Releases Integration Process diff --git a/docs/integration_process/reference.rst b/docs/integration_process/reference.rst index e23011075e9..75a31518c1d 100644 --- a/docs/integration_process/reference.rst +++ b/docs/integration_process/reference.rst @@ -145,4 +145,4 @@ The consolidated outputs published by the integration. They are built by - `docs/s_core_v_1/roadmap/overall_status.rst `_ * - Integration status dashboard - Live build/health overview of the integration. - - `status_dashboard.html `_ + - `status_dashboard.html <../status_dashboard.html>`_ diff --git a/docs/status_dashboard.rst b/docs/status_dashboard.rst new file mode 100644 index 00000000000..7e494115ed4 --- /dev/null +++ b/docs/status_dashboard.rst @@ -0,0 +1,18 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + +Integration Status +================== + +The generated integration status dashboard is published at this location. \ No newline at end of file diff --git a/scripts/tooling/cli/misc/assets/report_template.html b/scripts/tooling/cli/misc/assets/report_template.html index 7391a635873..60e36f723c3 100644 --- a/scripts/tooling/cli/misc/assets/report_template.html +++ b/scripts/tooling/cli/misc/assets/report_template.html @@ -384,7 +384,7 @@

Requirements & Architecture @@ -449,7 +449,7 @@

Tool Qualification (ISO 262

Static Analysis & Code Quality

diff --git a/scripts/tooling/cli/misc/html_report.py b/scripts/tooling/cli/misc/html_report.py index b5dd576617a..821254a6682 100644 --- a/scripts/tooling/cli/misc/html_report.py +++ b/scripts/tooling/cli/misc/html_report.py @@ -16,6 +16,7 @@ import json import logging import os +import subprocess import sys from pathlib import Path from typing import Any, Optional @@ -128,6 +129,28 @@ def _parse_sbom_packages(sbom_path: Path) -> list[dict[str, Any]]: return packages +def _get_current_branch() -> str: + # 1. Prefer the pull request head branch, then the standard GitHub Actions ref name + ref_name = os.environ.get("GITHUB_HEAD_REF") or os.environ.get("GITHUB_REF_NAME") + if ref_name: + return ref_name + # 2. Try running git command to get current branch + try: + result = subprocess.run( + ["git", "rev-parse", "--abbrev-ref", "HEAD"], + capture_output=True, + text=True, + check=True, + ) + branch = result.stdout.strip() + if branch and branch != "HEAD": + return branch + except Exception: + pass + # 3. Default to main + return "main" + + def generate_report( known_good: KnownGood, token: str | None = None, @@ -137,6 +160,8 @@ def generate_report( if token: _enrich_with_compare_data(entries, token) + branch = _get_current_branch() + env = Environment( loader=FileSystemLoader(TEMPLATE_DIR), autoescape=select_autoescape(["html"]), @@ -146,6 +171,7 @@ def generate_report( modules_json=json.dumps(entries, indent=2), sbom_packages_json=json.dumps(sbom_packages or [], indent=2), timestamp=known_good.timestamp, + branch=branch, ) diff --git a/scripts/tooling/tests/test_report.py b/scripts/tooling/tests/test_report.py index 945bc48c8a6..9a6dd761bad 100644 --- a/scripts/tooling/tests/test_report.py +++ b/scripts/tooling/tests/test_report.py @@ -219,6 +219,35 @@ def test_creates_parent_dirs_via_path(self, tmp_path, minimal_known_good): assert out.exists() +# --------------------------------------------------------------------------- +# generate_report – branch selection and environment variable overrides +# --------------------------------------------------------------------------- + + +class TestGenerateReportBranchSelection: + def test_prefers_github_head_ref(self, monkeypatch, minimal_known_good): + monkeypatch.setenv("GITHUB_HEAD_REF", "feature/my-head-branch") + monkeypatch.setenv("GITHUB_REF_NAME", "main") + html = generate_report(minimal_known_good, TEMPLATE_DIR) + assert "https://eclipse-score.github.io/score/feature/my-head-branch/" in html + + def test_falls_back_to_github_ref_name(self, monkeypatch, minimal_known_good): + monkeypatch.delenv("GITHUB_HEAD_REF", raising=False) + monkeypatch.setenv("GITHUB_REF_NAME", "releases/v1.0") + html = generate_report(minimal_known_good, TEMPLATE_DIR) + assert "https://eclipse-score.github.io/score/releases/v1.0/" in html + + def test_falls_back_to_git_or_main_when_no_env(self, monkeypatch, minimal_known_good): + monkeypatch.delenv("GITHUB_HEAD_REF", raising=False) + monkeypatch.delenv("GITHUB_REF_NAME", raising=False) + html = generate_report(minimal_known_good, TEMPLATE_DIR) + # Verify it falls back to either current git branch or "main" + assert ( + "https://eclipse-score.github.io/score/feature/dashboard-branch-links/" in html + or "https://eclipse-score.github.io/score/main/" in html + ) + + # --------------------------------------------------------------------------- # Integration: real known_good.json # ---------------------------------------------------------------------------