OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[GHA][Coverage] coverage_toolkit composite action (#35688)
Marcin Kruszynski05faed4f97ed
diff --git a/.github/actions/coverage_toolkit/action.yml b/.github/actions/coverage_toolkit/action.ymlnew file mode 100644index 00000000000..9f31a247691--- /dev/null+++ b/.github/actions/coverage_toolkit/action.yml@@ -0,0 +1,530 @@+name: Coverage Toolkit+description: Run OpenVINO coverage toolkit script steps from reusable workflows.++inputs:+ command:+ description: One of install-requirements, validate-config, run-suite, collect-native, collect-results, render-summary, merge-durations, resolve-uploads, resolve-upload-files.+ required: true+ workspace:+ description: Repository workspace that owns the checked-out sources and coverage artifacts.+ required: false+ default: ''+ config-dir:+ description: Directory containing tests_cpp.yml, tests_python.yml, and tests_js.yml.+ required: false+ default: ''+ suite:+ description: 'Coverage suite. run-suite supports cpp, python, and js; reporting commands accept any suite defined in .github/coverage.'+ required: false+ default: ''+ profile:+ description: Test profile, usually cpu or gpu.+ required: false+ default: cpu+ lane:+ description: Coverage lane name used in summaries and artifact metadata.+ required: false+ default: ''+ test-names:+ description: Comma-separated test scenario names selected for the suite.+ required: false+ default: ''+ artifact-name:+ description: Coverage artifact name for collect-results. Defaults to the suite reporting artifact_name_template.+ required: false+ default: ''+ artifact-dir:+ description: Directory where collect-results writes the artifact payload. Defaults to RUNNER_TEMP/artifact-name.+ required: false+ default: ''+ extra-cpp-coverage-dirs:+ description: Additional native coverage build directories, separated by the OS path separator.+ required: false+ default: ''+ selected-lanes:+ description: Active lanes for render-summary.+ required: false+ default: ''+ selection:+ description: Human-readable selection label for render-summary. Defaults to selected-lanes.+ required: false+ default: ''+ summary-file:+ description: Summary file path for render-summary. Defaults to GITHUB_STEP_SUMMARY.+ required: false+ default: ''+ duration-output:+ description: Merged duration CSV path for merge-durations.+ required: false+ default: ''+ uploads-output-file:+ description: Output file for resolve-uploads. Defaults to GITHUB_OUTPUT.+ required: false+ default: ''+ install-requirements:+ description: Install coverage toolkit Python requirements before running the command.+ required: false+ default: 'false'+ build-type:+ description: CMake build type passed to coverage.py.+ required: false+ default: ''+ python-package:+ description: Python package name used for coverage source detection.+ required: false+ default: ''+ python-installed-package:+ description: Installed Python package to import when it differs from python-package.+ required: false+ default: ''+ python-source-dir:+ description: Workspace-relative or absolute Python source directory for coverage XML rewriting.+ required: false+ default: ''+ python-path-alias:+ description: Coverage.py [paths] alias and package prefix stripped from Python XML filenames.+ required: false+ default: ''+ python-coverage-omit:+ description: Newline-separated Python coverage omit patterns.+ required: false+ default: ''+ python-tests-dir:+ description: Workspace-relative or absolute Python tests directory exposed as TESTS_DIR.+ required: false+ default: ''+ python-layer-tests-dir:+ description: Workspace-relative or absolute layer tests directory exposed as WORKSPACE_LAYER_TESTS_DIR.+ required: false+ default: ''+ python-runtime-extra-paths:+ description: Extra runtime library paths for Python tests, separated by the OS path separator or newlines.+ required: false+ default: ''+ python-wheel-lib-dir:+ description: Runtime library path for installed OpenVINO wheel libraries.+ required: false+ default: ''+ js-dir:+ description: Workspace-relative or absolute JavaScript package directory.+ required: false+ default: ''+ model-path:+ description: Workspace-relative or absolute C++ test model path used for __MODEL_PATH__ replacement.+ required: false+ default: ''+ artifact-group:+ description: Artifact group directory under workspace/artifacts for resolve-upload-files.+ required: false+ default: ''+ artifact-names-json:+ description: JSON array of artifact names for resolve-upload-files.+ required: false+ default: ''+ upload-key:+ description: Dynamic Codecov upload key for resolve-upload-files.+ required: false+ default: ''+ upload-file:+ description: Coverage file name inside each downloaded artifact for resolve-upload-files.+ required: false+ default: ''+outputs:+ dir:+ description: Artifact directory produced by collect-results.+ value: ${{ steps.collect_results.outputs.dir }}+ artifact-dir:+ description: Artifact directory produced by collect-results.+ value: ${{ steps.collect_results.outputs['artifact-dir'] }}+ artifact-name:+ description: Artifact name produced by collect-results.+ value: ${{ steps.collect_results.outputs['artifact-name'] }}+ upload-files-json:+ description: JSON object mapping Codecov upload keys to resolved file paths.+ value: ${{ steps.resolve_uploads.outputs['upload-files-json'] || steps.resolve_upload_files.outputs['upload-files-json'] }}+ upload-matrix-json:+ description: JSON array used as the dynamic Codecov upload matrix.+ value: ${{ steps.resolve_uploads.outputs['upload-matrix-json'] }}+ files:+ description: Comma-separated coverage files resolved by resolve-upload-files.+ value: ${{ steps.resolve_upload_files.outputs.files }}++runs:+ using: composite+ steps:+ - name: Prepare coverage toolkit environment+ id: prepare+ shell: bash+ env:+ ACTION_PATH: ${{ github.action_path }}+ INPUT_COMMAND: ${{ inputs.command }}+ INPUT_WORKSPACE: ${{ inputs.workspace }}+ INPUT_CONFIG_DIR: ${{ inputs.config-dir }}+ INPUT_SUITE: ${{ inputs.suite }}+ INPUT_PROFILE: ${{ inputs.profile }}+ INPUT_LANE: ${{ inputs.lane }}+ INPUT_TEST_NAMES: ${{ inputs.test-names }}+ INPUT_ARTIFACT_NAME: ${{ inputs.artifact-name }}+ INPUT_ARTIFACT_DIR: ${{ inputs.artifact-dir }}+ INPUT_EXTRA_CPP_COVERAGE_DIRS: ${{ inputs.extra-cpp-coverage-dirs }}+ INPUT_SELECTED_LANES: ${{ inputs.selected-lanes }}+ INPUT_SELECTION: ${{ inputs.selection }}+ INPUT_SUMMARY_FILE: ${{ inputs.summary-file }}+ INPUT_DURATION_OUTPUT: ${{ inputs.duration-output }}+ INPUT_UPLOADS_OUTPUT_FILE: ${{ inputs.uploads-output-file }}+ INPUT_INSTALL_REQUIREMENTS: ${{ inputs.install-requirements }}+ INPUT_BUILD_TYPE: ${{ inputs.build-type }}+ INPUT_PYTHON_PACKAGE: ${{ inputs.python-package }}+ INPUT_PYTHON_INSTALLED_PACKAGE: ${{ inputs.python-installed-package }}+ INPUT_PYTHON_SOURCE_DIR: ${{ inputs.python-source-dir }}+ INPUT_PYTHON_PATH_ALIAS: ${{ inputs.python-path-alias }}+ INPUT_PYTHON_COVERAGE_OMIT: ${{ inputs.python-coverage-omit }}+ INPUT_PYTHON_TESTS_DIR: ${{ inputs.python-tests-dir }}+ INPUT_PYTHON_LAYER_TESTS_DIR: ${{ inputs.python-layer-tests-dir }}+ INPUT_PYTHON_RUNTIME_EXTRA_PATHS: ${{ inputs.python-runtime-extra-paths }}+ INPUT_PYTHON_WHEEL_LIB_DIR: ${{ inputs.python-wheel-lib-dir }}+ INPUT_JS_DIR: ${{ inputs.js-dir }}+ INPUT_MODEL_PATH: ${{ inputs.model-path }}+ INPUT_ARTIFACT_GROUP: ${{ inputs.artifact-group }}+ INPUT_ARTIFACT_NAMES_JSON: ${{ inputs.artifact-names-json }}+ INPUT_UPLOAD_KEY: ${{ inputs.upload-key }}+ INPUT_UPLOAD_FILE: ${{ inputs.upload-file }}+ run: |+ set -euo pipefail++ env_file="$(mktemp "${RUNNER_TEMP:-/tmp}/coverage-toolkit-env.XXXXXX")"+ scripts_dir="${ACTION_PATH}"+ coverage_py="${scripts_dir}/coverage.py"+ reports_py="${scripts_dir}/ci_reports.py"+ requirements_file="${scripts_dir}/requirements-ci.txt"++ workspace="${INPUT_WORKSPACE:-${GITHUB_WORKSPACE}}"+ profile="${INPUT_PROFILE:-cpu}"++ write_var() {+ printf '%s=' "$1" >> "${env_file}"+ printf '%q\n' "$2" >> "${env_file}"+ }++ write_export() {+ printf 'export %s=' "$1" >> "${env_file}"+ printf '%q\n' "$2" >> "${env_file}"+ }++ write_array() {+ local name="$1"+ shift+ printf '%s=(' "${name}" >> "${env_file}"+ local value+ for value in "$@"; do+ printf ' %q' "${value}" >> "${env_file}"+ done+ printf ' )\n' >> "${env_file}"+ }++ write_var scripts_dir "${scripts_dir}"+ write_var coverage_py "${coverage_py}"+ write_var reports_py "${reports_py}"+ write_var requirements_file "${requirements_file}"+ write_var workspace "${workspace}"+ write_var profile "${profile}"+ write_var input_suite "${INPUT_SUITE}"+ write_var input_lane "${INPUT_LANE}"+ write_var input_test_names "${INPUT_TEST_NAMES}"+ write_var input_artifact_name "${INPUT_ARTIFACT_NAME}"+ write_var input_artifact_dir "${INPUT_ARTIFACT_DIR}"+ write_var input_selected_lanes "${INPUT_SELECTED_LANES}"+ write_var input_selection "${INPUT_SELECTION}"+ write_var input_summary_file "${INPUT_SUMMARY_FILE}"+ write_var input_duration_output "${INPUT_DURATION_OUTPUT}"+ write_var input_uploads_output_file "${INPUT_UPLOADS_OUTPUT_FILE}"+ write_var input_artifact_group "${INPUT_ARTIFACT_GROUP}"+ write_var input_artifact_names_json "${INPUT_ARTIFACT_NAMES_JSON}"+ write_var input_upload_key "${INPUT_UPLOAD_KEY}"+ write_var input_upload_file "${INPUT_UPLOAD_FILE}"++ write_export OV_WORKSPACE "${workspace}"+ write_export TEST_PROFILE "${profile}"++ if [[ -n "${INPUT_CONFIG_DIR}" ]]; then+ write_export COVERAGE_CONFIG_DIR "${INPUT_CONFIG_DIR}"+ fi+ if [[ -n "${INPUT_BUILD_TYPE}" ]]; then+ write_export CMAKE_BUILD_TYPE "${INPUT_BUILD_TYPE}"+ fi+ if [[ -n "${INPUT_EXTRA_CPP_COVERAGE_DIRS}" ]]; then+ write_export EXTRA_CPP_COVERAGE_DIRS "${INPUT_EXTRA_CPP_COVERAGE_DIRS}"+ fi+ if [[ -n "${INPUT_PYTHON_PACKAGE}" ]]; then+ write_export COVERAGE_PYTHON_PACKAGE "${INPUT_PYTHON_PACKAGE}"+ fi+ if [[ -n "${INPUT_PYTHON_INSTALLED_PACKAGE}" ]]; then+ write_export COVERAGE_PYTHON_INSTALLED_PACKAGE "${INPUT_PYTHON_INSTALLED_PACKAGE}"+ fi+ if [[ -n "${INPUT_PYTHON_SOURCE_DIR}" ]]; then+ write_export COVERAGE_PYTHON_SOURCE_DIR "${INPUT_PYTHON_SOURCE_DIR}"+ fi+ if [[ -n "${INPUT_PYTHON_PATH_ALIAS}" ]]; then+ write_export COVERAGE_PYTHON_PATH_ALIAS "${INPUT_PYTHON_PATH_ALIAS}"+ fi+ if [[ -n "${INPUT_PYTHON_COVERAGE_OMIT}" ]]; then+ write_export COVERAGE_PYTHON_OMIT "${INPUT_PYTHON_COVERAGE_OMIT}"+ fi+ if [[ -n "${INPUT_PYTHON_TESTS_DIR}" ]]; then+ write_export COVERAGE_PYTHON_TESTS_DIR "${INPUT_PYTHON_TESTS_DIR}"+ fi+ if [[ -n "${INPUT_PYTHON_LAYER_TESTS_DIR}" ]]; then+ write_export COVERAGE_PYTHON_LAYER_TESTS_DIR "${INPUT_PYTHON_LAYER_TESTS_DIR}"+ fi+ if [[ -n "${INPUT_PYTHON_RUNTIME_EXTRA_PATHS}" ]]; then+ write_export COVERAGE_PYTHON_RUNTIME_EXTRA_PATHS "${INPUT_PYTHON_RUNTIME_EXTRA_PATHS}"+ fi+ if [[ -n "${INPUT_PYTHON_WHEEL_LIB_DIR}" ]]; then+ write_export COVERAGE_PYTHON_WHEEL_LIB_DIR "${INPUT_PYTHON_WHEEL_LIB_DIR}"+ fi+ if [[ -n "${INPUT_JS_DIR}" ]]; then+ write_export JS_DIR "${INPUT_JS_DIR}"+ fi+ if [[ -n "${INPUT_MODEL_PATH}" ]]; then+ write_export MODEL_PATH "${INPUT_MODEL_PATH}"+ fi++ coverage_common=(--workspace "${workspace}" --profile "${profile}")+ if [[ -n "${INPUT_CONFIG_DIR}" ]]; then+ coverage_common+=(--config-dir "${INPUT_CONFIG_DIR}")+ fi+ if [[ -n "${INPUT_BUILD_TYPE}" ]]; then+ coverage_common+=(--build-type "${INPUT_BUILD_TYPE}")+ fi++ validate_common=(--workspace "${workspace}")+ if [[ -n "${INPUT_CONFIG_DIR}" ]]; then+ validate_common+=(--config-dir "${INPUT_CONFIG_DIR}")+ fi++ reports_common=()+ if [[ -n "${INPUT_CONFIG_DIR}" ]]; then+ reports_common+=(--config-dir "${INPUT_CONFIG_DIR}")+ fi++ selection_env=""+ case "${INPUT_SUITE}" in+ cpp)+ selection_env="CXX_TEST_NAMES"+ ;;+ python)+ selection_env="PY_TEST_NAMES"+ ;;+ js)+ selection_env="JS_TEST_NAMES"+ ;;+ "")+ ;;+ esac++ if [[ -n "${INPUT_TEST_NAMES}" && -n "${selection_env}" ]]; then+ write_export "${selection_env}" "${INPUT_TEST_NAMES}"+ fi++ write_array coverage_common "${coverage_common[@]}"+ write_array validate_common "${validate_common[@]}"+ write_array reports_common "${reports_common[@]}"++ echo "env_file=${env_file}" >> "${GITHUB_OUTPUT}"++ - name: Reject unsupported run-suite suite+ if: ${{ inputs.command == 'run-suite' && inputs.suite != '' && inputs.suite != 'cpp' && inputs.suite != 'python' && inputs.suite != 'js' }}+ shell: bash+ env:+ INPUT_SUITE: ${{ inputs.suite }}+ run: |+ echo "Unsupported coverage suite for run-suite: ${INPUT_SUITE}" >&2+ exit 1++ - name: Install coverage toolkit requirements+ if: ${{ inputs.command == 'install-requirements' || inputs.install-requirements == 'true' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ python3 -m pip install -r "${requirements_file}"++ - name: Validate coverage config+ if: ${{ inputs.command == 'validate-config' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ python3 "${coverage_py}" validate-config "${validate_common[@]}"++ - name: Require run-suite suite+ if: ${{ inputs.command == 'run-suite' && inputs.suite == '' }}+ shell: bash+ run: |+ echo "run-suite requires suite=cpp, suite=python, or suite=js" >&2+ exit 1++ - name: Run suite (C++)+ if: ${{ inputs.command == 'run-suite' && inputs.suite == 'cpp' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ python3 "${coverage_py}" step "${coverage_common[@]}" run-cpp-tests++ - name: Run suite (Python)+ if: ${{ inputs.command == 'run-suite' && inputs.suite == 'python' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ python3 "${coverage_py}" step "${coverage_common[@]}" run-python-tests++ - name: Run suite (JavaScript)+ if: ${{ inputs.command == 'run-suite' && inputs.suite == 'js' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ python3 "${coverage_py}" step "${coverage_common[@]}" run-js-tests++ - name: Collect native coverage+ if: ${{ inputs.command == 'collect-native' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ python3 "${coverage_py}" step "${coverage_common[@]}" collect-cpp-coverage++ - name: Require collect-results suite+ if: ${{ inputs.command == 'collect-results' && inputs.suite == '' }}+ shell: bash+ run: |+ echo "collect-results requires suite" >&2+ exit 1++ - name: Collect suite results+ id: collect_results+ if: ${{ inputs.command == 'collect-results' && inputs.suite != '' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ lane="${input_lane:-${profile}}"+ collect_args=(+ --workspace "${workspace}"+ --suite "${input_suite}"+ --profile "${profile}"+ --lane "${lane}"+ --test-names "${input_test_names}"+ --outputs-file "${GITHUB_OUTPUT}"+ )+ if [[ -n "${input_artifact_name}" ]]; then+ collect_args+=(--artifact-name "${input_artifact_name}")+ fi+ if [[ -n "${input_artifact_dir}" ]]; then+ collect_args+=(--artifact-dir "${input_artifact_dir}")+ fi+ python3 "${reports_py}" collect-suite-results "${reports_common[@]}" \+ "${collect_args[@]}"++ - name: Render summary+ if: ${{ inputs.command == 'render-summary' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ summary_file="${input_summary_file:-${GITHUB_STEP_SUMMARY:-}}"+ if [[ -z "${summary_file}" ]]; then+ echo "render-summary requires summary-file or GITHUB_STEP_SUMMARY" >&2+ exit 1+ fi+ selection="${input_selection:-${input_selected_lanes:-all}}"+ selected_lanes="${input_selected_lanes:-${selection}}"+ python3 "${reports_py}" render-summary "${reports_common[@]}" \+ --workspace "${workspace}" \+ --summary-file "${summary_file}" \+ --selection "${selection}" \+ --selected-lanes "${selected_lanes}"++ - name: Merge durations+ if: ${{ inputs.command == 'merge-durations' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ duration_output="${input_duration_output:-${workspace}/coverage-test-durations-all.csv}"+ python3 "${reports_py}" merge-durations "${reports_common[@]}" \+ --workspace "${workspace}" \+ --output "${duration_output}"++ - name: Resolve uploads+ id: resolve_uploads+ if: ${{ inputs.command == 'resolve-uploads' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ uploads_output_file="${input_uploads_output_file:-${GITHUB_OUTPUT:-}}"+ if [[ -z "${uploads_output_file}" ]]; then+ echo "resolve-uploads requires uploads-output-file or GITHUB_OUTPUT" >&2+ exit 1+ fi+ python3 "${reports_py}" resolve-uploads "${reports_common[@]}" \+ --workspace "${workspace}" \+ --output-file "${uploads_output_file}"++ - name: Resolve upload files+ id: resolve_upload_files+ if: ${{ inputs.command == 'resolve-upload-files' }}+ shell: bash+ env:+ COVERAGE_TOOLKIT_ENV_FILE: ${{ steps.prepare.outputs.env_file }}+ run: |+ set -euo pipefail+ source "${COVERAGE_TOOLKIT_ENV_FILE}"+ uploads_output_file="${input_uploads_output_file:-${GITHUB_OUTPUT:-}}"+ if [[ -z "${uploads_output_file}" ]]; then+ echo "resolve-upload-files requires uploads-output-file or GITHUB_OUTPUT" >&2+ exit 1+ fi+ if [[ -z "${input_artifact_group}" || -z "${input_upload_file}" ]]; then+ echo "resolve-upload-files requires artifact-group and upload-file" >&2+ exit 1+ fi+ python3 "${reports_py}" resolve-upload-files \+ --workspace "${workspace}" \+ --artifact-group "${input_artifact_group}" \+ --artifact-names-json "${input_artifact_names_json}" \+ --upload-key "${input_upload_key}" \+ --file "${input_upload_file}" \+ --output-file "${uploads_output_file}"++ - name: Reject unsupported command+ if: ${{ !contains(fromJSON('["install-requirements","validate-config","run-suite","collect-native","collect-results","render-summary","merge-durations","resolve-uploads","resolve-upload-files"]'), inputs.command) }}+ shell: bash+ env:+ INPUT_COMMAND: ${{ inputs.command }}+ run: |+ echo "Unsupported coverage toolkit command: ${INPUT_COMMAND}" >&2+ exit 1diff --git a/.github/actions/coverage_toolkit/ci_reports.py b/.github/actions/coverage_toolkit/ci_reports.pynew file mode 100644index 00000000000..e5393795312--- /dev/null+++ b/.github/actions/coverage_toolkit/ci_reports.py@@ -0,0 +1,847 @@+# Copyright (C) 2018-2026 Intel Corporation+# SPDX-License-Identifier: Apache-2.0++from __future__ import annotations++import argparse+import csv+from fnmatch import fnmatchcase+import json+import os+from pathlib import Path+import shutil+import sys+from typing import Any+++SCRIPT_DIR = Path(__file__).resolve().parent+if str(SCRIPT_DIR) not in sys.path:+ sys.path.insert(0, str(SCRIPT_DIR))++from coverage import get_config_dir, resolve_workspace_path+++METADATA_FILE = "coverage-artifact-metadata.json"+REQUIRED_REPORTING_FIELDS = (+ "label",+ "stats_file",+ "duration_file",+ "coverage_file",+)+DEFAULT_COUNTER_KEYS = {+ "cpp": {+ "total": "CXX_TESTS_TOTAL",+ "executed": "CXX_TESTS_EXECUTED",+ "passed": "CXX_TESTS_PASSED",+ "failed": "CXX_TESTS_FAILED",+ "skipped": "CXX_TESTS_SKIPPED",+ "not_run": "CXX_TESTS_NOT_RUN",+ },+ "python": {+ "total": "PY_TESTS_TOTAL",+ "executed": None,+ "passed": "PY_TESTS_PASSED",+ "failed": "PY_TESTS_FAILED",+ "skipped": "PY_TESTS_SKIPPED",+ "not_run": "PY_TESTS_NOT_RUN",+ },+ "js": {+ "total": "JS_TESTS_TOTAL",+ "executed": None,+ "passed": "JS_TESTS_PASSED",+ "failed": "JS_TESTS_FAILED",+ "skipped": "JS_TESTS_SKIPPED",+ "not_run": "JS_TESTS_NOT_RUN",+ },+}+++def _apply_common_env(args: argparse.Namespace) -> None:+ config_dir = getattr(args, "config_dir", None)+ if config_dir:+ os.environ["COVERAGE_CONFIG_DIR"] = str(resolve_workspace_path(config_dir, workspace=args.workspace.resolve()))+++def _load_yaml(path: Path) -> dict[str, Any]:+ try:+ import yaml # type: ignore[import-not-found]+ except ModuleNotFoundError as exc:+ raise RuntimeError("PyYAML is required to read coverage reporting configs") from exc++ data = yaml.safe_load(path.read_text(encoding="utf-8")) or {}+ if not isinstance(data, dict):+ raise ValueError(f"Invalid YAML root in {path}")+ return data+++def _as_list(value: Any, *, field_name: str, suite: str) -> list[Any]:+ if value is None:+ return []+ if not isinstance(value, list):+ raise ValueError(f"Suite {suite!r} reporting field {field_name!r} must be a list")+ return value+++def _normalize_debug_dirs(value: Any, *, suite: str) -> list[dict[str, str]]:+ debug_dirs: list[dict[str, str]] = []+ for item in _as_list(value, field_name="debug_dirs", suite=suite):+ if not isinstance(item, dict):+ raise ValueError(f"Suite {suite!r} has an invalid debug_dirs entry")+ src = str(item.get("src", "")).strip()+ dest = str(item.get("dest", "")).strip()+ if not src or not dest:+ raise ValueError(f"Suite {suite!r} debug_dirs entries require src and dest")+ debug_dirs.append({"src": src, "dest": dest})+ return debug_dirs+++def _normalize_uploads(value: Any, *, suite: str) -> list[dict[str, Any]]:+ uploads: list[dict[str, Any]] = []+ for item in _as_list(value, field_name="uploads", suite=suite):+ if not isinstance(item, dict):+ raise ValueError(f"Suite {suite!r} has an invalid uploads entry")+ upload = dict(item)+ if not str(upload.get("file", "")).strip():+ raise ValueError(f"Suite {suite!r} uploads entries require file")+ if not str(upload.get("flag", upload.get("flag_template", ""))).strip():+ raise ValueError(f"Suite {suite!r} uploads entries require flag or flag_template")+ uploads.append(upload)+ return uploads+++def _normalize_suite_def(suite: str, reporting: dict[str, Any], *, config_file: Path | None = None) -> dict[str, Any]:+ missing = [field for field in REQUIRED_REPORTING_FIELDS if not str(reporting.get(field, "")).strip()]+ if missing:+ raise ValueError(f"Suite {suite!r} reporting is missing required field(s): {', '.join(missing)}")++ counter_keys = DEFAULT_COUNTER_KEYS.get(suite)+ if counter_keys is None:+ raise ValueError(f"Suite {suite!r} does not have default reporting counter keys")++ suite_def: dict[str, Any] = {+ "suite": suite,+ "label": str(reporting["label"]).strip(),+ "artifact_group": str(reporting.get("artifact_group", reporting.get("artifacts_dir", suite))).strip() or suite,+ "artifact_name_template": str(reporting.get("artifact_name_template", "coverage-{suite}-{lane}")).strip()+ or "coverage-{suite}-{lane}",+ "stats_file": str(reporting["stats_file"]).strip(),+ "duration_file": str(reporting["duration_file"]).strip(),+ "coverage_file": str(reporting["coverage_file"]).strip(),+ "selection_env": str(reporting.get("selection_env", "")).strip(),+ "extra_files": [str(item) for item in _as_list(reporting.get("extra_files"), field_name="extra_files", suite=suite)],+ "debug_dirs": _normalize_debug_dirs(reporting.get("debug_dirs"), suite=suite),+ "uploads": _normalize_uploads(reporting.get("uploads"), suite=suite),+ "total_key": str(counter_keys["total"]),+ "executed_key": str(counter_keys["executed"]) if counter_keys["executed"] else None,+ "passed_key": str(counter_keys["passed"]),+ "failed_key": str(counter_keys["failed"]),+ "skipped_key": str(counter_keys["skipped"]),+ "not_run_key": str(counter_keys["not_run"]),+ }++ tests_file = str(reporting.get("tests_file", "")).strip()+ if tests_file:+ suite_def["tests_file"] = tests_file+ elif config_file is not None:+ suite_def["tests_file"] = str(config_file)+ return suite_def+++def _load_suite_defs() -> dict[str, dict[str, Any]]:+ suite_defs: dict[str, dict[str, Any]] = {}+ config_dir = get_config_dir()+ for path in sorted(config_dir.glob("tests_*.yml")):+ data = _load_yaml(path)+ suite = str(data.get("suite", "")).strip()+ if not suite:+ raise ValueError(f"Coverage config {path} is missing suite")+ reporting = data.get("reporting")+ if not isinstance(reporting, dict):+ raise ValueError(f"Coverage config {path} is missing reporting section")+ suite_defs[suite] = _normalize_suite_def(suite, reporting, config_file=path)+ if not suite_defs:+ raise ValueError(f"No coverage reporting suite definitions were found in {config_dir}")+ return suite_defs+++def _get_suite_def(suite: str) -> dict[str, Any]:+ suite_defs = _load_suite_defs()+ if suite not in suite_defs:+ available = ", ".join(sorted(suite_defs))+ raise ValueError(f"Suite {suite!r} is not defined in coverage reporting configs. Available suites: {available}")+ return suite_defs[suite]+++def _read_json_file(path: Path) -> dict[str, object]:+ if not path.is_file():+ return {}+ return json.loads(path.read_text(encoding="utf-8"))+++def _read_env_file(path: Path) -> dict[str, str]:+ values: dict[str, str] = {}+ if not path.is_file():+ return values+ for raw_line in path.read_text(encoding="utf-8").splitlines():+ if "=" not in raw_line:+ continue+ key, value = raw_line.split("=", 1)+ values[key.strip()] = value.strip()+ return values+++def _to_int(values: dict[str, str], key: str | None) -> int:+ if not key:+ return 0+ try:+ return int(values.get(key, "0").strip())+ except ValueError:+ return 0+++def _load_tests_file_names(path: Path, profile: str) -> list[str]:+ if not path.is_file():+ raise FileNotFoundError(f"Suite tests file does not exist: {path}")++ try:+ import yaml # type: ignore[import-not-found]+ except ModuleNotFoundError as exc:+ raise RuntimeError("PyYAML is required to read suite tests files") from exc++ data = yaml.safe_load(path.read_text(encoding="utf-8")) or {}+ tests = data.get("tests", [])+ if not isinstance(tests, list):+ raise ValueError(f"Suite tests file {path} must contain a 'tests' list")++ names: list[str] = []+ for item in tests:+ if not isinstance(item, dict):+ continue+ profiles = item.get("profiles", [])+ if profiles and profile not in {str(profile_item) for profile_item in profiles}:+ continue+ name = str(item.get("name", "")).strip()+ if name:+ names.append(name)+ return names+++def _load_test_names(*, workspace: Path, suite_def: dict[str, Any], profile: str) -> list[str]:+ test_names = suite_def.get("test_names")+ if isinstance(test_names, list):+ return [str(name).strip() for name in test_names if str(name).strip()]++ tests_file = str(suite_def.get("tests_file", "")).strip()+ if tests_file:+ return _load_tests_file_names(resolve_workspace_path(tests_file, workspace=workspace), profile)++ return []+++def _selected_test_names(*, suite_def: dict[str, Any], test_names: str) -> list[str]:+ raw_value = test_names.strip()+ if not raw_value:+ selection_env = str(suite_def.get("selection_env", "")).strip()+ raw_value = os.environ.get(selection_env, "").strip() if selection_env else ""+ if not raw_value:+ return []+ return [name.strip() for name in raw_value.split(",") if name.strip()]+++def collect_suite_results(+ *,+ workspace: Path,+ suite: str,+ profile: str,+ lane: str,+ test_names: str,+ artifact_name: str,+ artifact_dir: Path | None,+ outputs_file: Path | None,+) -> tuple[str, Path]:+ suite_def = _get_suite_def(suite)+ lane = lane or profile+ artifact_name = artifact_name or _format_template(+ str(suite_def["artifact_name_template"]),+ _template_context(suite_def=suite_def, profile=profile, lane=lane),+ )+ if artifact_dir is None:+ runner_temp = os.environ.get("RUNNER_TEMP", "").strip()+ artifact_dir = Path(runner_temp or workspace) / artifact_name+ artifact_dir.mkdir(parents=True, exist_ok=True)++ tests = _load_test_names(workspace=workspace, suite_def=suite_def, profile=profile)+ selected_tests = _selected_test_names(suite_def=suite_def, test_names=test_names)+ if selected_tests:+ selected_set = set(selected_tests)+ tests = [test for test in tests if test in selected_set]+ total = len(tests)++ metadata = {+ "suite": suite,+ "profile": profile,+ "lane": lane,+ "artifact_name": artifact_name,+ "artifact_group": suite_def["artifact_group"],+ }+ (artifact_dir / METADATA_FILE).write_text(json.dumps(metadata, separators=(",", ":")) + "\n", encoding="utf-8")++ duration_path = artifact_dir / str(suite_def["duration_file"])+ with duration_path.open("w", encoding="utf-8", newline="") as handle:+ writer = csv.writer(handle)+ writer.writerow(["test_name", "status", "duration_seconds", "duration_minutes"])+ for test_name in tests:+ writer.writerow([test_name, "not_run", "0.000", "0.000"])++ stats_lines = [f"{suite_def['total_key']}={total}"]+ if suite_def["executed_key"]:+ stats_lines.append(f"{suite_def['executed_key']}=0")+ stats_lines.extend(+ [+ f"{suite_def['passed_key']}=0",+ f"{suite_def['failed_key']}=0",+ f"{suite_def['skipped_key']}=0",+ f"{suite_def['not_run_key']}={total}",+ ]+ )+ (artifact_dir / str(suite_def["stats_file"])).write_text("\n".join(stats_lines) + "\n", encoding="utf-8")++ files_to_copy = [+ str(suite_def["duration_file"]),+ str(suite_def["stats_file"]),+ str(suite_def["coverage_file"]),+ *[str(name) for name in suite_def.get("extra_files", [])],+ ]+ for filename in files_to_copy:+ source = workspace / filename+ if source.is_file():+ shutil.copy2(source, artifact_dir / filename)++ for debug_dir in suite_def.get("debug_dirs", []):+ source = resolve_workspace_path(str(debug_dir["src"]), workspace=workspace)+ if source.is_dir():+ destination = artifact_dir / str(debug_dir["dest"])+ shutil.rmtree(destination, ignore_errors=True)+ shutil.copytree(source, destination)++ if outputs_file is not None:+ with outputs_file.open("a", encoding="utf-8") as handle:+ handle.write(f"dir={artifact_dir}\n")+ handle.write(f"artifact-dir={artifact_dir}\n")+ handle.write(f"artifact-name={artifact_name}\n")++ return artifact_name, artifact_dir+++def _collect_artifacts(*, workspace: Path, suite_key: str) -> list[dict[str, object]]:+ suite_def = _get_suite_def(suite_key)+ root = workspace / "artifacts" / str(suite_def["artifact_group"])+ if not root.exists():+ return []++ artifacts: list[dict[str, object]] = []+ for metadata_path in sorted(root.rglob(METADATA_FILE)):+ metadata = _read_json_file(metadata_path)+ if not metadata or str(metadata.get("suite", "")).strip() != suite_key:+ continue+ artifacts.append(+ {+ "artifact_dir": metadata_path.parent,+ "artifact_name": str(metadata.get("artifact_name", metadata_path.parent.name)).strip(),+ "artifact_group": str(metadata.get("artifact_group", suite_def["artifact_group"])).strip(),+ "lane": str(metadata.get("lane", "")).strip() or "-",+ "profile": str(metadata.get("profile", "")).strip(),+ "suite": suite_key,+ }+ )+ return artifacts+++def _template_context(+ *,+ suite_def: dict[str, Any],+ profile: str = "",+ lane: str = "",+ artifact_name: str = "",+ extra: dict[str, Any] | None = None,+) -> dict[str, str]:+ context = {+ "suite": str(suite_def["suite"]),+ "label": str(suite_def["label"]),+ "artifact_group": str(suite_def["artifact_group"]),+ "profile": profile,+ "lane": lane,+ "artifact_name": artifact_name,+ }+ if extra:+ context.update({str(key): str(value) for key, value in extra.items()})+ return context+++def _artifact_context(suite_def: dict[str, Any], artifact: dict[str, object]) -> dict[str, str]:+ return _template_context(+ suite_def=suite_def,+ profile=str(artifact.get("profile", "")),+ lane=str(artifact.get("lane", "")),+ artifact_name=str(artifact.get("artifact_name", "")),+ )+++def _format_template(template: str, context: dict[str, str]) -> str:+ try:+ return template.format(**context)+ except KeyError as exc:+ available = ", ".join(sorted(context))+ raise ValueError(f"Unknown template variable {exc!s}; available variables: {available}") from exc+++def _format_upload_value(upload: dict[str, Any], *, field: str, template_field: str, context: dict[str, str], default: str = "") -> str:+ template = str(upload.get(template_field, upload.get(field, default))).strip()+ return _format_template(template, context) if template else ""+++def _artifact_upload_flags(suite_def: dict[str, Any], artifact: dict[str, object]) -> str:+ flags: list[str] = []+ artifact_name = str(artifact.get("artifact_name", ""))+ context = _artifact_context(suite_def, artifact)+ for upload in suite_def.get("uploads", []):+ pattern = str(upload.get("artifact_pattern", "")).strip()+ if pattern and not _artifact_name_matches(artifact_name, _format_template(pattern, context)):+ continue+ flag = _format_upload_value(upload, field="flag", template_field="flag_template", context=context)+ if flag and flag not in flags:+ flags.append(flag)+ return ", ".join(f"`{flag}`" for flag in flags) if flags else "-"+++def render_summary(*, workspace: Path, summary_file: Path, selection: str, selected_lanes: str) -> None:+ rows: list[dict[str, object]] = []+ overall = {"total": 0, "executed": 0, "passed": 0, "failed": 0, "skipped": 0, "not_run": 0}+ suite_defs = _load_suite_defs()++ for suite_key, suite_def in suite_defs.items():+ for artifact in _collect_artifacts(workspace=workspace, suite_key=suite_key):+ artifact_dir = Path(artifact["artifact_dir"])+ lane = str(artifact["lane"])+ stats = _read_env_file(artifact_dir / str(suite_def["stats_file"]))+ total = _to_int(stats, str(suite_def["total_key"]))+ passed = _to_int(stats, str(suite_def["passed_key"]))+ failed = _to_int(stats, str(suite_def["failed_key"]))+ skipped = _to_int(stats, str(suite_def["skipped_key"]))+ not_run = _to_int(stats, str(suite_def["not_run_key"]))+ executed = _to_int(stats, suite_def["executed_key"]) if suite_def["executed_key"] else max(0, total - skipped - not_run)+ coverage_file = artifact_dir / str(suite_def["coverage_file"])+ report_size = coverage_file.stat().st_size if coverage_file.is_file() else 0++ rows.append(+ {+ "lane": lane,+ "suite": suite_def["label"],+ "total": total,+ "executed": executed,+ "passed": passed,+ "failed": failed,+ "skipped": skipped,+ "not_run": not_run,+ "report_size": report_size,+ "flags": _artifact_upload_flags(suite_def, artifact),+ }+ )+ overall["total"] += total+ overall["executed"] += executed+ overall["passed"] += passed+ overall["failed"] += failed+ overall["skipped"] += skipped+ overall["not_run"] += not_run++ pass_rate = (overall["passed"] * 100.0) / overall["executed"] if overall["executed"] else 0.0++ lines = [+ "## Coverage Summary",+ "",+ f"**Selection:** `{selection}`",+ "",+ f"**Active lanes:** `{selected_lanes}`",+ "",+ f"**Executed pass rate:** `{pass_rate:.1f}%`",+ "",+ "### Overall",+ "| Metric | Value |",+ "| --- | ---: |",+ f"| Total test units | {overall['total']} |",+ f"| Executed | {overall['executed']} |",+ f"| Passed | {overall['passed']} |",+ f"| Failed | {overall['failed']} |",+ f"| Skipped | {overall['skipped']} |",+ f"| Not run | {overall['not_run']} |",+ "",+ "### By Lane And Suite",+ "| Lane | Suite | Total | Executed | Passed | Failed | Skipped | Not run | Report Size (bytes) | Codecov Flags |",+ "| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- |",+ ]++ if rows:+ for row in sorted(rows, key=lambda item: (str(item["lane"]), str(item["suite"]))):+ lines.append(+ f"| {row['lane']} | {row['suite']} | {row['total']} | {row['executed']} | "+ f"{row['passed']} | {row['failed']} | {row['skipped']} | {row['not_run']} | {row['report_size']} | {row['flags']} |"+ )+ else:+ lines.append("| - | - | 0 | 0 | 0 | 0 | 0 | 0 | 0 | - |")++ lines.extend(["", "Merged duration artifact: `coverage-test-durations` (`coverage-test-durations-all.csv`)", ""])+ summary_file.write_text("\n".join(lines), encoding="utf-8")+++def merge_durations(*, workspace: Path, output: Path) -> None:+ rows: list[dict[str, str]] = []+ suite_defs = _load_suite_defs()+ for suite_key, suite_def in suite_defs.items():+ for artifact in _collect_artifacts(workspace=workspace, suite_key=suite_key):+ artifact_dir = Path(artifact["artifact_dir"])+ report = artifact_dir / str(suite_def["duration_file"])+ if not report.is_file():+ continue+ artifact_name = str(artifact["artifact_name"])+ lane = str(artifact["lane"])+ with report.open(encoding="utf-8", newline="") as handle:+ reader = csv.DictReader(handle)+ for row in reader:+ rows.append(+ {+ "suite": suite_key,+ "lane": lane,+ "artifact": artifact_name,+ "test_name": row.get("test_name", ""),+ "status": row.get("status", ""),+ "duration_seconds": row.get("duration_seconds", "0"),+ "duration_minutes": row.get("duration_minutes", "0"),+ }+ )++ rows.sort(key=lambda row: (-float(row["duration_seconds"] or 0), row["suite"], row["lane"], row["test_name"]))+ with output.open("w", encoding="utf-8", newline="") as handle:+ writer = csv.DictWriter(+ handle,+ fieldnames=["suite", "lane", "artifact", "test_name", "status", "duration_seconds", "duration_minutes"],+ )+ writer.writeheader()+ writer.writerows(rows)++ print(f"Wrote {len(rows)} duration row(s) to {output}")+++def _artifact_name_matches(artifact_name: str, pattern: str) -> bool:+ return fnmatchcase(artifact_name, pattern)+++def _workspace_relative(path: Path, workspace: Path) -> str:+ try:+ return path.resolve().relative_to(workspace.resolve()).as_posix()+ except ValueError:+ return path.resolve().as_posix()+++def _parse_artifact_names(value: str) -> list[str]:+ raw_value = value.strip()+ if not raw_value:+ return []+ try:+ parsed = json.loads(raw_value)+ except json.JSONDecodeError:+ parsed = None+ if isinstance(parsed, list):+ return [str(item).strip() for item in parsed if str(item).strip()]+ return [item.strip() for item in raw_value.replace("\n", ",").split(",") if item.strip()]+++def _safe_relative_file(file_name: str) -> Path:+ relative_file = Path(file_name)+ if relative_file.is_absolute() or ".." in relative_file.parts:+ raise ValueError(f"Upload file must be a relative path inside the artifact: {file_name}")+ return relative_file+++def _append_unique_path(paths: list[Path], candidate: Path) -> None:+ if candidate.is_file() and candidate not in paths:+ paths.append(candidate)+++def resolve_upload_files(+ *,+ workspace: Path,+ artifact_group: str,+ artifact_names: str,+ file_name: str,+ upload_key: str,+ output_file: Path,+) -> None:+ root = workspace / "artifacts" / artifact_group+ if not root.is_dir():+ raise FileNotFoundError(f"Coverage artifact group directory does not exist: {root}")++ relative_file = _safe_relative_file(file_name)+ files: list[Path] = []+ parsed_artifact_names = _parse_artifact_names(artifact_names)++ for artifact_name in parsed_artifact_names:+ _append_unique_path(files, root / artifact_name / relative_file)++ if not files:+ _append_unique_path(files, root / relative_file)++ if not files:+ artifact_name_set = set(parsed_artifact_names)+ for candidate in sorted(root.rglob(relative_file.as_posix())):+ if not candidate.is_file():+ continue+ if artifact_name_set and candidate.parent.name not in artifact_name_set:+ relative_parts = candidate.relative_to(root).parts+ artifact_root = relative_parts[0] if len(relative_parts) > len(relative_file.parts) else ""+ if artifact_root not in artifact_name_set:+ continue+ _append_unique_path(files, candidate)++ if not files:+ expected = ", ".join(parsed_artifact_names) if parsed_artifact_names else "any downloaded artifact"+ raise FileNotFoundError(f"Could not find {file_name!r} for {expected} under {root}")++ files_csv = ",".join(_workspace_relative(path, workspace) for path in files)+ upload_files = {upload_key: files_csv} if upload_key else {}++ print(f"Resolved Codecov upload files: {files_csv}")+ with output_file.open("a", encoding="utf-8") as handle:+ handle.write(f"files={files_csv}\n")+ handle.write(f"upload-files-json={json.dumps(upload_files, sort_keys=True)}\n")+++def _upload_key(upload: dict[str, Any], context: dict[str, str], *, file_name: str) -> str:+ context = {**context, "file": file_name}+ raw_key = _format_upload_value(+ upload,+ field="key",+ template_field="key_template",+ context=context,+ default="{suite}_{lane}_{file}",+ )+ return "".join(character if character.isalnum() else "_" for character in raw_key).strip("_")+++def _upload_entry(+ *,+ suite_def: dict[str, Any],+ upload: dict[str, Any],+ artifacts: list[dict[str, object]],+ workspace: Path,+ context: dict[str, str],+ artifact_pattern: str,+) -> dict[str, Any] | None:+ file_name = _format_upload_value(upload, field="file", template_field="file_template", context=context)+ if not file_name:+ raise ValueError(f"Upload entry for suite {suite_def['suite']!r} resolved to an empty file name")++ files: list[str] = []+ artifact_names: list[str] = []+ for artifact in artifacts:+ artifact_name = str(artifact["artifact_name"])+ if not _artifact_name_matches(artifact_name, artifact_pattern):+ continue+ candidate = Path(artifact["artifact_dir"]) / file_name+ if candidate.is_file():+ files.append(_workspace_relative(candidate, workspace))+ artifact_names.append(artifact_name)++ if not files:+ return None++ flag = _format_upload_value(upload, field="flag", template_field="flag_template", context=context)+ name = _format_upload_value(+ upload,+ field="name",+ template_field="name_template",+ context=context,+ default="{label}, {lane}",+ )++ return {+ "key": _upload_key(upload, context, file_name=file_name),+ "name": name,+ "suite": suite_def["suite"],+ "artifact_group": suite_def["artifact_group"],+ "artifact_pattern": artifact_pattern,+ "artifact_names": artifact_names,+ "file": file_name,+ "files": files,+ "files_csv": ",".join(files),+ "flag": flag,+ }+++def _build_upload_matrix(*, workspace: Path) -> list[dict[str, Any]]:+ matrix: list[dict[str, Any]] = []+ suite_defs = _load_suite_defs()+ for suite_key, suite_def in suite_defs.items():+ artifacts = _collect_artifacts(workspace=workspace, suite_key=suite_key)+ if not artifacts:+ continue++ for upload in suite_def.get("uploads", []):+ artifact_pattern_template = str(upload.get("artifact_pattern", "")).strip()+ if artifact_pattern_template:+ context = _template_context(+ suite_def=suite_def,+ profile=str(upload.get("profile", "")),+ lane=str(upload.get("lane", "")),+ artifact_name=str(upload.get("artifact_name", "")),+ extra={key: value for key, value in upload.items() if isinstance(value, (str, int, float))},+ )+ artifact_pattern = _format_template(artifact_pattern_template, context)+ entry = _upload_entry(+ suite_def=suite_def,+ upload=upload,+ artifacts=artifacts,+ workspace=workspace,+ context=context,+ artifact_pattern=artifact_pattern,+ )+ if entry:+ matrix.append(entry)+ continue++ for artifact in artifacts:+ context = _artifact_context(suite_def, artifact)+ artifact_pattern = str(artifact["artifact_name"])+ entry = _upload_entry(+ suite_def=suite_def,+ upload=upload,+ artifacts=[artifact],+ workspace=workspace,+ context=context,+ artifact_pattern=artifact_pattern,+ )+ if entry:+ matrix.append(entry)+ return matrix+++def resolve_uploads(*, workspace: Path, output_file: Path) -> None:+ upload_matrix = _build_upload_matrix(workspace=workspace)+ upload_files = {str(entry["key"]): ",".join(entry["files"]) for entry in upload_matrix}+ output_lines = [+ f"upload-files-json={json.dumps(upload_files, sort_keys=True)}",+ f"upload-matrix-json={json.dumps(upload_matrix, sort_keys=True)}",+ ]++ for entry in upload_matrix:+ print(f"{entry['name']}: {','.join(entry['files'])}")+ if not upload_matrix:+ print("No Codecov upload files were resolved")++ with output_file.open("a", encoding="utf-8") as handle:+ handle.write("\n".join(output_lines) + "\n")+++def _parse_args() -> argparse.Namespace:+ parser = argparse.ArgumentParser(description="Coverage CI report helpers")+ subparsers = parser.add_subparsers(dest="command", required=True)+ common = argparse.ArgumentParser(add_help=False)+ common.add_argument("--config-dir", default=os.environ.get("COVERAGE_CONFIG_DIR"))++ collect = subparsers.add_parser(+ "collect-suite-results",+ parents=[common],+ help="Prepare one suite artifact with fallback files and real outputs",+ )+ collect.add_argument("--workspace", type=Path, required=True)+ collect.add_argument("--suite", required=True)+ collect.add_argument("--profile", required=True)+ collect.add_argument("--lane", required=True)+ collect.add_argument("--test-names", default="")+ collect.add_argument("--artifact-name", default="")+ collect.add_argument("--artifact-dir", type=Path)+ collect.add_argument("--outputs-file", type=Path)++ render = subparsers.add_parser(+ "render-summary",+ parents=[common],+ help="Render the aggregated GitHub summary from downloaded artifacts",+ )+ render.add_argument("--workspace", type=Path, required=True)+ render.add_argument("--summary-file", type=Path, required=True)+ render.add_argument("--selection", required=True)+ render.add_argument("--selected-lanes", required=True)++ merge = subparsers.add_parser(+ "merge-durations",+ parents=[common],+ help="Merge suite duration CSV files from downloaded artifacts",+ )+ merge.add_argument("--workspace", type=Path, required=True)+ merge.add_argument("--output", type=Path, required=True)++ uploads = subparsers.add_parser(+ "resolve-uploads",+ parents=[common],+ help="Resolve Codecov upload files from downloaded artifacts",+ )+ uploads.add_argument("--workspace", type=Path, required=True)+ uploads.add_argument("--output-file", type=Path, required=True)++ upload_files = subparsers.add_parser(+ "resolve-upload-files",+ help="Resolve one Codecov upload row from artifacts downloaded in the current job",+ )+ upload_files.add_argument("--workspace", type=Path, required=True)+ upload_files.add_argument("--artifact-group", required=True)+ upload_files.add_argument("--artifact-names-json", default="")+ upload_files.add_argument("--upload-key", default="")+ upload_files.add_argument("--file", required=True)+ upload_files.add_argument("--output-file", type=Path, required=True)++ return parser.parse_args()+++def main() -> int:+ args = _parse_args()+ _apply_common_env(args)+ if args.command == "collect-suite-results":+ collect_suite_results(+ workspace=args.workspace.resolve(),+ suite=args.suite,+ profile=args.profile,+ lane=args.lane,+ test_names=args.test_names,+ artifact_name=args.artifact_name,+ artifact_dir=args.artifact_dir.resolve() if args.artifact_dir else None,+ outputs_file=args.outputs_file.resolve() if args.outputs_file else None,+ )+ return 0+ if args.command == "render-summary":+ render_summary(+ workspace=args.workspace.resolve(),+ summary_file=args.summary_file.resolve(),+ selection=args.selection,+ selected_lanes=args.selected_lanes,+ )+ return 0+ if args.command == "merge-durations":+ merge_durations(workspace=args.workspace.resolve(), output=args.output.resolve())+ return 0+ if args.command == "resolve-uploads":+ resolve_uploads(workspace=args.workspace.resolve(), output_file=args.output_file.resolve())+ return 0+ if args.command == "resolve-upload-files":+ resolve_upload_files(+ workspace=args.workspace.resolve(),+ artifact_group=args.artifact_group,+ artifact_names=args.artifact_names_json,+ file_name=args.file,+ upload_key=args.upload_key,+ output_file=args.output_file.resolve(),+ )+ return 0+ raise ValueError(f"Unsupported command: {args.command}")+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/.github/scripts/coverage/collect_cpp_coverage.py b/.github/actions/coverage_toolkit/collect_cpp_coverage.pysimilarity index 96%rename from .github/scripts/coverage/collect_cpp_coverage.pyrename to .github/actions/coverage_toolkit/collect_cpp_coverage.pyindex 6aeeae6a9e6..f03de1eb248 100644--- a/.github/scripts/coverage/collect_cpp_coverage.py+++ b/.github/actions/coverage_toolkit/collect_cpp_coverage.py@@ -415,6 +415,14 @@ def _tool_version_report() -> str:return "\n".join(lines).rstrip() + "\n"+def _extra_coverage_dirs() -> list[Path]:+ """Return additional native build directories requested by the caller."""+ raw_dirs = os.environ.get("EXTRA_CPP_COVERAGE_DIRS", "").strip()+ if not raw_dirs:+ return []+ return [Path(item) for item in raw_dirs.split(os.pathsep) if item.strip()]++def _tree_inventory_report(*,root: Path,@@ -749,6 +757,24 @@ def run(ctx: CoverageContext) -> None:if has_main_gcda and main_info is not None:tracefiles.append(main_info)+ for index, extra_dir in enumerate(_extra_coverage_dirs(), start=1):+ label = f"extra native capture {index}"+ _prune_unwanted_gcda(extra_dir, label=label, run_gpu_tests=ctx.run_gpu_tests)+ _prefilter_incompatible_gcda(extra_dir, label=label)+ if not _has_gcda(extra_dir):+ LOGGER.warning("No .gcda files found in %s, skipping %s", extra_dir, label)+ continue+ extra_info = trace_dir / f"extra-build-{index}.info"+ _run_lcov_capture(+ directory=extra_dir,+ base_directory=src_dir,+ output_file=extra_info,+ label=label,+ debug_dir=trace_dir,+ branch_coverage=ctx.branch_coverage,+ )+ tracefiles.append(extra_info)+_merge_tracefiles(tracefiles, merged_info, branch_coverage=ctx.branch_coverage)normalization_stats = _normalize_and_filter_tracefile(diff --git a/.github/scripts/coverage/coverage.py b/.github/actions/coverage_toolkit/coverage.pysimilarity index 86%rename from .github/scripts/coverage/coverage.pyrename to .github/actions/coverage_toolkit/coverage.pyindex 80be466b733..1e35a8937b6 100644--- a/.github/scripts/coverage/coverage.py+++ b/.github/actions/coverage_toolkit/coverage.py@@ -18,6 +18,7 @@ from typing import AnySCRIPT_DIR = Path(__file__).resolve().parentCONFIG_DIR = SCRIPT_DIR / "config"+CONFIG_DIR_ENV = "COVERAGE_CONFIG_DIR"if str(SCRIPT_DIR) not in sys.path:sys.path.insert(0, str(SCRIPT_DIR))# Stable import alias used by step modules.@@ -44,6 +45,31 @@ def _build_logger() -> logging.Logger:LOGGER = _build_logger()+def resolve_workspace_path(value: str | Path, *, workspace: Path | None = None) -> Path:+ """Resolve an absolute or workspace-relative path from an environment/config value."""+ raw = os.path.expandvars(str(value)).strip()+ path = Path(raw).expanduser()+ if path.is_absolute():+ return path.resolve()++ base = workspace+ if base is None:+ base = Path(os.environ.get("OV_WORKSPACE") or os.environ.get("GITHUB_WORKSPACE") or Path.cwd())+ return (base / path).resolve()+++def get_config_dir() -> Path:+ """Return the active coverage test config directory."""+ raw = os.environ.get(CONFIG_DIR_ENV, "").strip()+ if raw:+ return resolve_workspace_path(raw)+ workspace = Path(os.environ.get("OV_WORKSPACE") or os.environ.get("GITHUB_WORKSPACE") or Path.cwd()).resolve()+ repo_config_dir = workspace / ".github" / "coverage"+ if repo_config_dir.is_dir():+ return repo_config_dir+ return CONFIG_DIR++@dataclass(frozen=True)class CppTestCase:name: str@@ -407,13 +433,42 @@ def validate_configs(config_dir: Path) -> list[ConfigValidationIssue]:"""Validate coverage YAML configs and return any issues found."""issues: list[ConfigValidationIssue] = []- suites = {+ known_suites = {"cpp": config_dir / "tests_cpp.yml","python": config_dir / "tests_python.yml","js": config_dir / "tests_js.yml",}+ suites = {suite: path for suite, path in known_suites.items() if path.is_file()}+ for path in sorted(config_dir.glob("tests_*.yml")):+ if path not in known_suites.values():+ issues.append(ConfigValidationIssue("config", path.name, "unsupported coverage suite config file"))++ if not suites:+ issues.append(ConfigValidationIssue("config", str(config_dir), "no coverage suite config files found"))+ return issues+for suite, path in suites.items():+ data = _load_yaml(path)+ reporting = data.get("reporting")+ if not isinstance(reporting, dict):+ issues.append(ConfigValidationIssue(suite, "<reporting>", "missing 'reporting' section"))+ else:+ for field in ("label", "stats_file", "duration_file", "coverage_file"):+ if not _as_text(reporting.get(field, "")).strip():+ issues.append(ConfigValidationIssue(suite, "<reporting>", f"missing '{field}'"))+ uploads = reporting.get("uploads")+ if not isinstance(uploads, list) or not uploads:+ issues.append(ConfigValidationIssue(suite, "<reporting>", "'uploads' must be a non-empty list"))+ else:+ for idx, upload in enumerate(uploads):+ if not isinstance(upload, dict):+ issues.append(ConfigValidationIssue(suite, f"<upload:{idx}>", "upload entry must be a mapping"))+ continue+ if not _as_text(upload.get("file", "")).strip():+ issues.append(ConfigValidationIssue(suite, f"<upload:{idx}>", "missing 'file'"))+ if not _as_text(upload.get("flag", upload.get("flag_template", ""))).strip():+ issues.append(ConfigValidationIssue(suite, f"<upload:{idx}>", "missing 'flag' or 'flag_template'"))tests = _load_tests(path, suite)for idx, test in enumerate(tests):name = _as_text(test.get("name", f"<index:{idx}>"))@@ -471,6 +526,11 @@ def _apply_common_env(args: argparse.Namespace) -> None:if build_type:os.environ["CMAKE_BUILD_TYPE"] = build_type+ config_dir = getattr(args, "config_dir", None)+ if config_dir:+ os.environ[CONFIG_DIR_ENV] = str(resolve_workspace_path(config_dir))++def _load_context(args: argparse.Namespace) -> CoverageContext:"""Create a coverage context for the current command."""_apply_common_env(args)@@ -507,7 +567,7 @@ def _command_step(args: argparse.Namespace) -> int:def _command_list_tests(args: argparse.Namespace) -> int:"""Print resolved tests for a suite/profile pair."""_apply_common_env(args)- config_dir = CONFIG_DIR+ config_dir = get_config_dir()if args.suite == "cpp":tests = load_cpp_tests(config_dir / "tests_cpp.yml", args.profile)@@ -560,7 +620,7 @@ def _command_list_tests(args: argparse.Namespace) -> int:def _command_validate_config(args: argparse.Namespace) -> int:"""Validate the coverage YAML configuration files."""_apply_common_env(args)- issues = validate_configs(CONFIG_DIR)+ issues = validate_configs(get_config_dir())if issues:for issue in issues:@@ -577,6 +637,7 @@ def _add_common_options(parser: argparse.ArgumentParser, *, include_profile: booparser.add_argument("--profile", choices=sorted(SUPPORTED_PROFILES), default=os.environ.get("TEST_PROFILE", "cpu"))parser.add_argument("--workspace", default=os.environ.get("OV_WORKSPACE") or os.environ.get("GITHUB_WORKSPACE"))parser.add_argument("--build-type", default=os.environ.get("CMAKE_BUILD_TYPE", "Release"))+ parser.add_argument("--config-dir", default=os.environ.get(CONFIG_DIR_ENV))def build_parser() -> argparse.ArgumentParser:@@ -593,10 +654,12 @@ def build_parser() -> argparse.ArgumentParser:list_parser.add_argument("--suite", required=True, choices=["cpp", "python", "js"])list_parser.add_argument("--profile", choices=sorted(SUPPORTED_PROFILES), default=os.environ.get("TEST_PROFILE", "cpu"))list_parser.add_argument("--workspace", default=os.environ.get("OV_WORKSPACE") or os.environ.get("GITHUB_WORKSPACE"))+ list_parser.add_argument("--config-dir", default=os.environ.get(CONFIG_DIR_ENV))list_parser.set_defaults(func=_command_list_tests)validate_parser = subparsers.add_parser("validate-config", help="Validate YAML coverage test configs")validate_parser.add_argument("--workspace", default=os.environ.get("OV_WORKSPACE") or os.environ.get("GITHUB_WORKSPACE"))+ validate_parser.add_argument("--config-dir", default=os.environ.get(CONFIG_DIR_ENV))validate_parser.set_defaults(func=_command_validate_config)return parserdiff --git a/.github/scripts/coverage/requirements-ci.txt b/.github/actions/coverage_toolkit/requirements-ci.txtsimilarity index 100%rename from .github/scripts/coverage/requirements-ci.txtrename to .github/actions/coverage_toolkit/requirements-ci.txtdiff --git a/.github/scripts/coverage/run_tests.py b/.github/actions/coverage_toolkit/run_tests.pysimilarity index 85%rename from .github/scripts/coverage/run_tests.pyrename to .github/actions/coverage_toolkit/run_tests.pyindex 8a1af4c0238..eb099cc985d 100644--- a/.github/scripts/coverage/run_tests.py+++ b/.github/actions/coverage_toolkit/run_tests.py@@ -18,14 +18,26 @@ from coverage_workflow import (CppTestCase,LOGGER,env_from_assignments,+ get_config_dir,load_cpp_tests,load_js_tests,load_python_tests,+ resolve_workspace_path,run_cmd,)SCRIPT_DIR = Path(__file__).resolve().parent-CONFIG_DIR = SCRIPT_DIR / "config"+DEFAULT_PYTHON_COVERAGE_OMIT = (+ "*/tests/*",+ "*/thirdparty/*",+ "*/docs/*",+ "*/samples/*",+ "*/tools/*",+ "*/src/bindings/js/node/tests/*",+ "*/src/bindings/python/tests/*",+ "*.pb.cc",+ "*.pb.h",+)@dataclass(frozen=True)@@ -299,6 +311,8 @@ def _pycov_config(repo_source_dir: Path,workspace: Path,installed_dirs: tuple[Path, ...] = (),+ path_alias: str = "openvino",+ omit_patterns: tuple[str, ...] = DEFAULT_PYTHON_COVERAGE_OMIT,) -> str:"""Build the coverage.py config used by pytest-cov and coverage CLI."""branch_line = "branch = True\n" if branch_coverage else ""@@ -316,22 +330,15 @@ def _pycov_config(if value not in path_entries:path_entries.append(value)path_entries_text = "\n ".join(path_entries)+ omit_entries_text = "\n ".join(omit_patterns)return f"""[run]source ={source_value}{branch_line}omit =- */tests/*- */thirdparty/*- */docs/*- */samples/*- */tools/*- */src/bindings/js/node/tests/*- */src/bindings/python/tests/*- *.pb.cc- *.pb.h+ {omit_entries_text}[paths]-openvino =+{path_alias} ={path_entries_text}"""@@ -429,7 +436,44 @@ def _run_logged_command(return completed.returncode-def _normalize_python_xml_filename(raw_path: str, *, repo_source_dir: Path, installed_dirs: tuple[Path, ...]) -> str:+def _env_text(name: str, default: str) -> str:+ """Read a stripped environment value with a default."""+ raw = os.environ.get(name, "").strip()+ return raw or default+++def _env_path(name: str, default: Path, *, workspace: Path) -> Path:+ """Read an absolute or workspace-relative path from the environment."""+ raw = os.environ.get(name, "").strip()+ if not raw:+ return default+ return resolve_workspace_path(raw, workspace=workspace)+++def _env_path_list(name: str, *, workspace: Path) -> list[Path]:+ """Read a path list from the environment, accepting pathsep and newlines."""+ raw = os.environ.get(name, "").strip()+ if not raw:+ return []+ normalized = raw.replace("\n", os.pathsep)+ return [resolve_workspace_path(item, workspace=workspace) for item in normalized.split(os.pathsep) if item.strip()]+++def _env_patterns(name: str, default: tuple[str, ...]) -> tuple[str, ...]:+ """Read newline-separated coverage patterns from the environment."""+ raw = os.environ.get(name, "").strip()+ if not raw:+ return default+ return tuple(line.strip() for line in raw.splitlines() if line.strip())+++def _normalize_python_xml_filename(+ raw_path: str,+ *,+ repo_source_dir: Path,+ installed_dirs: tuple[Path, ...],+ path_alias: str,+) -> str:"""Map coverage.py XML filenames back to repo-relative Python source paths."""raw = raw_path.strip()if not raw:@@ -438,8 +482,9 @@ def _normalize_python_xml_filename(raw_path: str, *, repo_source_dir: Path, instpath = Path(raw)if not path.is_absolute():stripped = raw.removeprefix("./")- if stripped.startswith("openvino/"):- stripped = stripped[len("openvino/") :]+ alias_prefix = f"{path_alias}/"+ if stripped.startswith(alias_prefix):+ stripped = stripped[len(alias_prefix) :]return Path(stripped).as_posix()try:@@ -459,12 +504,12 @@ def _normalize_python_xml_filename(raw_path: str, *, repo_source_dir: Path, instcontinueidx = parts.index(marker)tail = parts[idx + 1 :]- if tail and tail[0] == "openvino":+ if tail and tail[0] == path_alias:return Path(*tail[1:]).as_posix()- if "openvino" in parts:- openvino_indexes = [idx for idx, part in enumerate(parts) if part == "openvino"]- for idx in reversed(openvino_indexes):+ if path_alias in parts:+ alias_indexes = [idx for idx, part in enumerate(parts) if part == path_alias]+ for idx in reversed(alias_indexes):tail = parts[idx + 1 :]if tail:return Path(*tail).as_posix()@@ -472,7 +517,14 @@ def _normalize_python_xml_filename(raw_path: str, *, repo_source_dir: Path, instreturn raw-def _rewrite_python_coverage_xml(*, xml_path: Path, workspace: Path, repo_source_dir: Path, installed_dirs: tuple[Path, ...]) -> None:+def _rewrite_python_coverage_xml(+ *,+ xml_path: Path,+ workspace: Path,+ repo_source_dir: Path,+ installed_dirs: tuple[Path, ...],+ path_alias: str,+) -> None:"""Rewrite Python XML coverage paths to the repo source layout expected by Codecov."""if not xml_path.is_file():return@@ -496,6 +548,7 @@ def _rewrite_python_coverage_xml(*, xml_path: Path, workspace: Path, repo_sourcefilename,repo_source_dir=repo_source_dir,installed_dirs=installed_dirs,+ path_alias=path_alias,)tree.write(xml_path, encoding="utf-8", xml_declaration=True)@@ -535,7 +588,7 @@ def _run_cpp_test(if not os.access(exe, os.X_OK):return _TestRunResult(test.name, "skipped", f"{test.name} (binary not executable: {test.binary})")- env = env_from_assignments(test.extra_env)+ env = env_from_assignments(_expand(test.extra_env))existing_ld = env.get("LD_LIBRARY_PATH", "")if runtime_ld_library_path:env["LD_LIBRARY_PATH"] = f"{runtime_ld_library_path}:{existing_ld}" if existing_ld else runtime_ld_library_path@@ -630,7 +683,7 @@ def _copy_js_lcov(*, source: Path, target: Path, workspace: Path, branch_coveragdef run_cpp(ctx: CoverageContext) -> None:"""Execute configured C++ tests and record execution statistics."""- config = CONFIG_DIR / "tests_cpp.yml"+ config = get_config_dir() / "tests_cpp.yml"selected_names = _selected_test_names(CPP_SUITE.selection_env)tests = _filter_selected_tests(load_cpp_tests(config, ctx.test_profile), selected_names, suite_label=CPP_SUITE.label)@@ -665,7 +718,7 @@ def run_cpp(ctx: CoverageContext) -> None:def run_python(ctx: CoverageContext) -> None:"""Execute configured Python tests and export coverage results."""- config = CONFIG_DIR / "tests_python.yml"+ config = get_config_dir() / "tests_python.yml"selected_names = _selected_test_names(PYTHON_SUITE.selection_env)tests = _filter_selected_tests(load_python_tests(config, ctx.test_profile), selected_names, suite_label=PYTHON_SUITE.label)@@ -680,26 +733,39 @@ def run_python(ctx: CoverageContext) -> None:)return- tests_dir = ctx.paths.install_pkg_dir / "tests"- py_source_root = ctx.workspace / "src" / "bindings" / "python" / "src"- py_source_dir = py_source_root / "openvino"- layer_tests = ctx.workspace / "tests" / "layer_tests"+ python_package = _env_text("COVERAGE_PYTHON_PACKAGE", "openvino")+ installed_package = _env_text("COVERAGE_PYTHON_INSTALLED_PACKAGE", python_package)+ path_alias = _env_text("COVERAGE_PYTHON_PATH_ALIAS", python_package)+ tests_dir = _env_path("COVERAGE_PYTHON_TESTS_DIR", ctx.paths.install_pkg_dir / "tests", workspace=ctx.workspace)+ py_source_dir = _env_path(+ "COVERAGE_PYTHON_SOURCE_DIR",+ ctx.workspace / "src" / "bindings" / "python" / "src" / path_alias,+ workspace=ctx.workspace,+ )+ layer_tests = _env_path("COVERAGE_PYTHON_LAYER_TESTS_DIR", ctx.workspace / "tests" / "layer_tests", workspace=ctx.workspace)py_cov_config = ctx.workspace / ".python_coverage_ci.rc"python_coverage_debug_dir = ctx.workspace / ".tmp" / "python-coverage"pip_install_path = os.environ.get("PIP_INSTALL_PATH", "").strip()- installed_openvino_dir = _detect_installed_python_package_dir("openvino")- if installed_openvino_dir is None and pip_install_path:- fallback_dir = Path(pip_install_path) / "openvino"+ installed_python_package_dir = _detect_installed_python_package_dir(installed_package)+ if installed_python_package_dir is None and pip_install_path:+ fallback_dir = Path(pip_install_path) / installed_packageif fallback_dir.is_dir():- installed_openvino_dir = fallback_dir+ installed_python_package_dir = fallback_dir- py_cov_source_dir = installed_openvino_dir if installed_openvino_dir is not None else py_source_dir+ py_cov_source_dir = installed_python_package_dir if installed_python_package_dir is not None else py_source_dirpy_cov_source = str(py_cov_source_dir)- wheel_lib_dir = Path(pip_install_path) / "openvino" / "libs" if pip_install_path else None+ wheel_lib_dir = (+ _env_path("COVERAGE_PYTHON_WHEEL_LIB_DIR", Path(pip_install_path) / "openvino" / "libs", workspace=ctx.workspace)+ if pip_install_path+ else None+ )runtime_extra_paths = [tests_dir]+ if installed_python_package_dir is not None:+ runtime_extra_paths.append(installed_python_package_dir)if wheel_lib_dir is not None:runtime_extra_paths.append(wheel_lib_dir)+ runtime_extra_paths.extend(_env_path_list("COVERAGE_PYTHON_RUNTIME_EXTRA_PATHS", workspace=ctx.workspace))os.environ["LD_LIBRARY_PATH"] = (f"{_runtime_ld_library_path(ctx, extra_paths=tuple(runtime_extra_paths))}:{os.environ.get('LD_LIBRARY_PATH', '')}"@@ -713,7 +779,9 @@ def run_python(ctx: CoverageContext) -> None:os.environ["PYTHONSAFEPATH"] = "1"os.environ["TESTS_DIR"] = str(tests_dir)os.environ["WORKSPACE_LAYER_TESTS_DIR"] = str(layer_tests)+ os.environ["PY_COV_SOURCE"] = py_cov_sourceos.environ["PY_COV_CONFIG"] = str(py_cov_config)+ os.environ["PYTEST_COVERAGE_ARGS"] = f"--cov={shlex.quote(py_cov_source)} --cov-config={shlex.quote(str(py_cov_config))} --cov-append"py_cov_config.write_text(_pycov_config(@@ -721,7 +789,9 @@ def run_python(ctx: CoverageContext) -> None:runtime_source_dir=py_cov_source_dir,repo_source_dir=py_source_dir,workspace=ctx.workspace,- installed_dirs=tuple(path for path in (installed_openvino_dir,) if path is not None),+ installed_dirs=tuple(path for path in (installed_python_package_dir,) if path is not None),+ path_alias=path_alias,+ omit_patterns=_env_patterns("COVERAGE_PYTHON_OMIT", DEFAULT_PYTHON_COVERAGE_OMIT),),encoding="utf-8",)@@ -789,12 +859,13 @@ def run_python(ctx: CoverageContext) -> None:f"see {xml_log} and {debug_log}")- installed_dirs = tuple(path for path in (installed_openvino_dir,) if path is not None)+ installed_dirs = tuple(path for path in (installed_python_package_dir,) if path is not None)_rewrite_python_coverage_xml(xml_path=xml_path,workspace=ctx.workspace,repo_source_dir=py_source_dir,installed_dirs=installed_dirs,+ path_alias=path_alias,)_finalize_suite(@@ -811,7 +882,7 @@ def run_js(ctx: CoverageContext) -> None:if shutil.which("node") is None or shutil.which("npm") is None:raise RuntimeError("Node.js/npm are not available in the coverage runtime environment.")- config = CONFIG_DIR / "tests_js.yml"+ config = get_config_dir() / "tests_js.yml"selected_names = _selected_test_names(JS_SUITE.selection_env)tests = _filter_selected_tests(load_js_tests(config, ctx.test_profile), selected_names, suite_label=JS_SUITE.label)diff --git a/.github/scripts/coverage/config/tests_cpp.yml b/.github/coverage/tests_cpp.ymlsimilarity index 92%rename from .github/scripts/coverage/config/tests_cpp.ymlrename to .github/coverage/tests_cpp.ymlindex a5a07067317..ba6ea85498c 100644--- a/.github/scripts/coverage/config/tests_cpp.yml+++ b/.github/coverage/tests_cpp.yml@@ -1,5 +1,20 @@schema_version: 1suite: cpp+reporting:+ label: C+++ artifact_group: cpp+ artifact_name_template: coverage-{suite}-{lane}+ selection_env: CXX_TEST_NAMES+ stats_file: cpp-coverage-stats.env+ duration_file: cpp-test-durations.csv+ coverage_file: coverage.info+ debug_dirs:+ - src: .tmp/cpp-coverage-parts+ dest: native-cpp-debug+ uploads:+ - name_template: C++ runtime, C++ suite, {lane}+ file: coverage.info+ flag_template: cpp-runtime-cpp-{lane}tests:- name: ov_api_conformance_testsbinary: ov_api_conformance_testsdiff --git a/.github/scripts/coverage/config/tests_js.yml b/.github/coverage/tests_js.ymlsimilarity index 87%rename from .github/scripts/coverage/config/tests_js.ymlrename to .github/coverage/tests_js.ymlindex 9f6c7fc9553..cfe0e5193f8 100644--- a/.github/scripts/coverage/config/tests_js.yml+++ b/.github/coverage/tests_js.yml@@ -1,5 +1,22 @@schema_version: 1suite: js+reporting:+ label: JS+ artifact_group: js+ artifact_name_template: coverage-{suite}-{lane}+ selection_env: JS_TEST_NAMES+ stats_file: js-coverage-stats.env+ duration_file: js-test-durations.csv+ coverage_file: js-lcov.info+ extra_files:+ - coverage.info+ uploads:+ - name_template: JS bindings, {lane}+ file: js-lcov.info+ flag_template: nodejs-bindings-unit-e2e-{lane}+ - name_template: C++ runtime, JS suite, {lane}+ file: coverage.info+ flag_template: cpp-runtime-js-{lane}tests:- name: node tests/setup.js (covered)kind: commanddiff --git a/.github/scripts/coverage/config/tests_python.yml b/.github/coverage/tests_python.ymlsimilarity index 89%rename from .github/scripts/coverage/config/tests_python.ymlrename to .github/coverage/tests_python.ymlindex 7a1d94e3f6d..f3158c50565 100644--- a/.github/scripts/coverage/config/tests_python.yml+++ b/.github/coverage/tests_python.yml@@ -1,5 +1,25 @@schema_version: 1suite: python+reporting:+ label: Python+ artifact_group: python+ artifact_name_template: coverage-{suite}-{lane}+ selection_env: PY_TEST_NAMES+ stats_file: python-coverage-stats.env+ duration_file: python-test-durations.csv+ coverage_file: python-coverage.xml+ extra_files:+ - coverage.info+ debug_dirs:+ - src: .tmp/python-coverage+ dest: python-coverage-debug+ uploads:+ - name_template: Python API, {lane}+ file: python-coverage.xml+ flag_template: python-api-frontend-layer-ovc-{lane}+ - name_template: C++ runtime, Python suite, {lane}+ file: coverage.info+ flag_template: cpp-runtime-python-{lane}tests:- name: pyopenvinokind: pytestdiff --git a/.github/scripts/coverage/ci_reports.py b/.github/scripts/coverage/ci_reports.pydeleted file mode 100644index 83c39a705e9..00000000000--- a/.github/scripts/coverage/ci_reports.py+++ /dev/null@@ -1,420 +0,0 @@-# Copyright (C) 2018-2026 Intel Corporation-# SPDX-License-Identifier: Apache-2.0--from __future__ import annotations--import argparse-import csv-import json-from pathlib import Path-import shutil-import sys---SCRIPT_DIR = Path(__file__).resolve().parent-CONFIG_DIR = SCRIPT_DIR / "config"-if str(SCRIPT_DIR) not in sys.path:- sys.path.insert(0, str(SCRIPT_DIR))--from coverage import load_cpp_tests, load_js_tests, load_python_tests---METADATA_FILE = "coverage-artifact-metadata.json"---UPLOAD_DEFS = {- "cpp_cpu": ("coverage-cpp-cpu", "coverage.info"),- "cpp_igpu_unit": ("coverage-cpp-igpu-unit", "coverage.info"),- "cpp_igpu_func": ("coverage-cpp-igpu-func", "coverage.info"),- "cpp_dgpu_unit": ("coverage-cpp-dgpu-unit", "coverage.info"),- "cpp_dgpu_func": ("coverage-cpp-dgpu-func", "coverage.info"),- "python_cpu_xml": ("coverage-python-cpu", "python-coverage.xml"),- "python_cpu_info": ("coverage-python-cpu", "coverage.info"),- "python_igpu_xml": ("coverage-python-igpu", "python-coverage.xml"),- "python_igpu_info": ("coverage-python-igpu", "coverage.info"),- "python_dgpu_xml": ("coverage-python-dgpu", "python-coverage.xml"),- "python_dgpu_info": ("coverage-python-dgpu", "coverage.info"),- "js_cpu_lcov": ("coverage-js-cpu", "js-lcov.info"),- "js_cpu_info": ("coverage-js-cpu", "coverage.info"),-}---SUITE_DEFS = {- "cpp": {- "label": "C++",- "artifacts_dir": "cpp",- "stats_file": "cpp-coverage-stats.env",- "duration_file": "cpp-test-durations.csv",- "coverage_file": "coverage.info",- "total_key": "CXX_TESTS_TOTAL",- "executed_key": "CXX_TESTS_EXECUTED",- "passed_key": "CXX_TESTS_PASSED",- "failed_key": "CXX_TESTS_FAILED",- "skipped_key": "CXX_TESTS_SKIPPED",- "not_run_key": "CXX_TESTS_NOT_RUN",- },- "python": {- "label": "Python",- "artifacts_dir": "python",- "stats_file": "python-coverage-stats.env",- "duration_file": "python-test-durations.csv",- "coverage_file": "python-coverage.xml",- "extra_files": ["coverage.info"],- "total_key": "PY_TESTS_TOTAL",- "executed_key": None,- "passed_key": "PY_TESTS_PASSED",- "failed_key": "PY_TESTS_FAILED",- "skipped_key": "PY_TESTS_SKIPPED",- "not_run_key": "PY_TESTS_NOT_RUN",- },- "js": {- "label": "JS",- "artifacts_dir": "js",- "stats_file": "js-coverage-stats.env",- "duration_file": "js-test-durations.csv",- "coverage_file": "js-lcov.info",- "extra_files": ["coverage.info"],- "total_key": "JS_TESTS_TOTAL",- "executed_key": None,- "passed_key": "JS_TESTS_PASSED",- "failed_key": "JS_TESTS_FAILED",- "skipped_key": "JS_TESTS_SKIPPED",- "not_run_key": "JS_TESTS_NOT_RUN",- },-}-def _read_json_file(path: Path) -> dict[str, object]:- if not path.is_file():- return {}- return json.loads(path.read_text(encoding="utf-8"))---def _read_env_file(path: Path) -> dict[str, str]:- values: dict[str, str] = {}- if not path.is_file():- return values- for raw_line in path.read_text(encoding="utf-8").splitlines():- if "=" not in raw_line:- continue- key, value = raw_line.split("=", 1)- values[key.strip()] = value.strip()- return values---def _to_int(values: dict[str, str], key: str | None) -> int:- if not key:- return 0- try:- return int(values.get(key, "0").strip())- except ValueError:- return 0---def _load_test_names(*, workspace: Path, suite: str, profile: str) -> list[str]:- if suite == "cpp":- return [test.name for test in load_cpp_tests(CONFIG_DIR / "tests_cpp.yml", profile)]- if suite == "python":- return [test.name for test in load_python_tests(CONFIG_DIR / "tests_python.yml", profile)]- if suite == "js":- return [test.name for test in load_js_tests(CONFIG_DIR / "tests_js.yml", profile)]- raise ValueError(f"Unsupported suite: {suite}")---def collect_suite_results(- *,- workspace: Path,- suite: str,- profile: str,- lane: str,- artifact_name: str,- artifact_dir: Path,-) -> None:- suite_def = SUITE_DEFS[suite]- artifact_dir.mkdir(parents=True, exist_ok=True)-- tests = _load_test_names(workspace=workspace, suite=suite, profile=profile)- total = len(tests)-- metadata = {"suite": suite, "lane": lane, "artifact_name": artifact_name}- (artifact_dir / METADATA_FILE).write_text(json.dumps(metadata, separators=(",", ":")) + "\n", encoding="utf-8")-- duration_path = artifact_dir / str(suite_def["duration_file"])- with duration_path.open("w", encoding="utf-8", newline="") as handle:- writer = csv.writer(handle)- writer.writerow(["test_name", "status", "duration_seconds", "duration_minutes"])- for test_name in tests:- writer.writerow([test_name, "not_run", "0.000", "0.000"])-- stats_lines = [f"{suite_def['total_key']}={total}"]- if suite_def["executed_key"]:- stats_lines.append(f"{suite_def['executed_key']}=0")- stats_lines.extend(- [- f"{suite_def['passed_key']}=0",- f"{suite_def['failed_key']}=0",- f"{suite_def['skipped_key']}=0",- f"{suite_def['not_run_key']}={total}",- ]- )- (artifact_dir / str(suite_def["stats_file"])).write_text("\n".join(stats_lines) + "\n", encoding="utf-8")-- files_to_copy = [- str(suite_def["duration_file"]),- str(suite_def["stats_file"]),- str(suite_def["coverage_file"]),- *[str(name) for name in suite_def.get("extra_files", [])],- ]- for filename in files_to_copy:- source = workspace / filename- if source.is_file():- shutil.copy2(source, artifact_dir / filename)-- debug_dir = workspace / ".tmp" / "cpp-coverage-parts"- if debug_dir.is_dir():- destination = artifact_dir / "native-cpp-debug"- shutil.rmtree(destination, ignore_errors=True)- shutil.copytree(debug_dir, destination)-- python_debug_dir = workspace / ".tmp" / "python-coverage"- if suite == "python" and python_debug_dir.is_dir():- destination = artifact_dir / "python-coverage-debug"- shutil.rmtree(destination, ignore_errors=True)- shutil.copytree(python_debug_dir, destination)---def _collect_artifacts(*, workspace: Path, suite_key: str) -> list[dict[str, object]]:- suite_def = SUITE_DEFS[suite_key]- root = workspace / "artifacts" / suite_def["artifacts_dir"]- if not root.exists():- return []-- artifacts: list[dict[str, object]] = []- for metadata_path in sorted(root.rglob(METADATA_FILE)):- metadata = _read_json_file(metadata_path)- if not metadata or str(metadata.get("suite", "")).strip() != suite_key:- continue- artifacts.append(- {- "artifact_dir": metadata_path.parent,- "artifact_name": str(metadata.get("artifact_name", metadata_path.parent.name)).strip(),- "lane": str(metadata.get("lane", "")).strip() or "-",- }- )- return artifacts---def _flag_patterns(suite: str, lane: str) -> str:- if suite == "cpp":- return f"`cpp-runtime-cpp-{lane}`"- if suite == "python":- return f"`python-api-frontend-layer-ovc-{lane}`, `cpp-runtime-python-{lane}`"- if suite == "js":- return f"`nodejs-bindings-unit-e2e-{lane}`, `cpp-runtime-js-{lane}`"- raise ValueError(f"Unsupported suite: {suite}")---def render_summary(*, workspace: Path, summary_file: Path, selection: str, selected_lanes: str) -> None:- rows: list[dict[str, object]] = []- overall = {"total": 0, "executed": 0, "passed": 0, "failed": 0, "skipped": 0, "not_run": 0}-- for suite_key, suite_def in SUITE_DEFS.items():- for artifact in _collect_artifacts(workspace=workspace, suite_key=suite_key):- artifact_dir = Path(artifact["artifact_dir"])- lane = str(artifact["lane"])- stats = _read_env_file(artifact_dir / str(suite_def["stats_file"]))- total = _to_int(stats, str(suite_def["total_key"]))- passed = _to_int(stats, str(suite_def["passed_key"]))- failed = _to_int(stats, str(suite_def["failed_key"]))- skipped = _to_int(stats, str(suite_def["skipped_key"]))- not_run = _to_int(stats, str(suite_def["not_run_key"]))- executed = _to_int(stats, suite_def["executed_key"]) if suite_def["executed_key"] else max(0, total - skipped - not_run)- coverage_file = artifact_dir / str(suite_def["coverage_file"])- report_size = coverage_file.stat().st_size if coverage_file.is_file() else 0-- rows.append(- {- "lane": lane,- "suite": suite_def["label"],- "total": total,- "executed": executed,- "passed": passed,- "failed": failed,- "skipped": skipped,- "not_run": not_run,- "report_size": report_size,- "flags": _flag_patterns(suite_key, lane),- }- )- overall["total"] += total- overall["executed"] += executed- overall["passed"] += passed- overall["failed"] += failed- overall["skipped"] += skipped- overall["not_run"] += not_run-- pass_rate = (overall["passed"] * 100.0) / overall["executed"] if overall["executed"] else 0.0-- lines = [- "## Coverage Summary",- "",- f"**Selection:** `{selection}`",- "",- f"**Active lanes:** `{selected_lanes}`",- "",- f"**Executed pass rate:** `{pass_rate:.1f}%`",- "",- "### Overall",- "| Metric | Value |",- "| --- | ---: |",- f"| Total test units | {overall['total']} |",- f"| Executed | {overall['executed']} |",- f"| Passed | {overall['passed']} |",- f"| Failed | {overall['failed']} |",- f"| Skipped | {overall['skipped']} |",- f"| Not run | {overall['not_run']} |",- "",- "### By Lane And Suite",- "| Lane | Suite | Total | Executed | Passed | Failed | Skipped | Not run | Report Size (bytes) | Codecov Flags |",- "| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- |",- ]-- if rows:- for row in sorted(rows, key=lambda item: (str(item["lane"]), str(item["suite"]))):- lines.append(- f"| {row['lane']} | {row['suite']} | {row['total']} | {row['executed']} | "- f"{row['passed']} | {row['failed']} | {row['skipped']} | {row['not_run']} | {row['report_size']} | {row['flags']} |"- )- else:- lines.append("| - | - | 0 | 0 | 0 | 0 | 0 | 0 | 0 | - |")-- lines.extend(["", "Merged duration artifact: `coverage-test-durations` (`coverage-test-durations-all.csv`)", ""])- summary_file.write_text("\n".join(lines), encoding="utf-8")---def merge_durations(*, workspace: Path, output: Path) -> None:- rows: list[dict[str, str]] = []- for suite_key, suite_def in SUITE_DEFS.items():- for artifact in _collect_artifacts(workspace=workspace, suite_key=suite_key):- artifact_dir = Path(artifact["artifact_dir"])- report = artifact_dir / str(suite_def["duration_file"])- if not report.is_file():- continue- artifact_name = str(artifact["artifact_name"])- lane = str(artifact["lane"])- with report.open(encoding="utf-8", newline="") as handle:- reader = csv.DictReader(handle)- for row in reader:- rows.append(- {- "suite": suite_key,- "lane": lane,- "artifact": artifact_name,- "test_name": row.get("test_name", ""),- "status": row.get("status", ""),- "duration_seconds": row.get("duration_seconds", "0"),- "duration_minutes": row.get("duration_minutes", "0"),- }- )-- rows.sort(key=lambda row: (-float(row["duration_seconds"] or 0), row["suite"], row["lane"], row["test_name"]))- with output.open("w", encoding="utf-8", newline="") as handle:- writer = csv.DictWriter(- handle,- fieldnames=["suite", "lane", "artifact", "test_name", "status", "duration_seconds", "duration_minutes"],- )- writer.writeheader()- writer.writerows(rows)-- print(f"Wrote {len(rows)} duration row(s) to {output}")---def _find_upload_file(*, workspace: Path, artifact_name: str, filename: str) -> Path | None:- root = workspace / "artifacts"- if not root.exists():- return None-- for metadata_path in sorted(root.rglob(METADATA_FILE)):- metadata = _read_json_file(metadata_path)- if str(metadata.get("artifact_name", "")).strip() != artifact_name:- continue- candidate = metadata_path.parent / filename- if candidate.is_file():- return candidate.resolve()-- for candidate in sorted(root.rglob(filename)):- if candidate.is_file() and artifact_name in candidate.parts:- return candidate.resolve()-- return None---def resolve_uploads(*, workspace: Path, output_file: Path) -> None:- output_lines = []- for output_name, (artifact_name, filename) in UPLOAD_DEFS.items():- path = _find_upload_file(workspace=workspace, artifact_name=artifact_name, filename=filename)- output_lines.append(f"{output_name}={path or ''}")- print(f"{output_name}: {path or '<missing>'}")-- with output_file.open("a", encoding="utf-8") as handle:- handle.write("\n".join(output_lines) + "\n")---def _parse_args() -> argparse.Namespace:- parser = argparse.ArgumentParser(description="Coverage CI report helpers")- subparsers = parser.add_subparsers(dest="command", required=True)-- collect = subparsers.add_parser("collect-suite-results", help="Prepare one suite artifact with fallback files and real outputs")- collect.add_argument("--workspace", type=Path, required=True)- collect.add_argument("--suite", choices=sorted(SUITE_DEFS), required=True)- collect.add_argument("--profile", required=True)- collect.add_argument("--lane", required=True)- collect.add_argument("--artifact-name", required=True)- collect.add_argument("--artifact-dir", type=Path, required=True)-- render = subparsers.add_parser("render-summary", help="Render the aggregated GitHub summary from downloaded artifacts")- render.add_argument("--workspace", type=Path, required=True)- render.add_argument("--summary-file", type=Path, required=True)- render.add_argument("--selection", required=True)- render.add_argument("--selected-lanes", required=True)-- merge = subparsers.add_parser("merge-durations", help="Merge suite duration CSV files from downloaded artifacts")- merge.add_argument("--workspace", type=Path, required=True)- merge.add_argument("--output", type=Path, required=True)-- uploads = subparsers.add_parser("resolve-uploads", help="Resolve Codecov upload files from downloaded artifacts")- uploads.add_argument("--workspace", type=Path, required=True)- uploads.add_argument("--output-file", type=Path, required=True)-- return parser.parse_args()---def main() -> int:- args = _parse_args()- if args.command == "collect-suite-results":- collect_suite_results(- workspace=args.workspace.resolve(),- suite=args.suite,- profile=args.profile,- lane=args.lane,- artifact_name=args.artifact_name,- artifact_dir=args.artifact_dir.resolve(),- )- return 0- if args.command == "render-summary":- render_summary(- workspace=args.workspace.resolve(),- summary_file=args.summary_file.resolve(),- selection=args.selection,- selected_lanes=args.selected_lanes,- )- return 0- if args.command == "merge-durations":- merge_durations(workspace=args.workspace.resolve(), output=args.output.resolve())- return 0- if args.command == "resolve-uploads":- resolve_uploads(workspace=args.workspace.resolve(), output_file=args.output_file.resolve())- return 0- raise ValueError(f"Unsupported command: {args.command}")---if __name__ == "__main__":- raise SystemExit(main())diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.ymlindex 116d3349b40..41a81da6608 100644--- a/.github/workflows/coverage.yml+++ b/.github/workflows/coverage.yml@@ -185,33 +185,39 @@ jobs:self-hosted-runner: 'true'- name: Install coverage Python dependencies- run: python3 -m pip install -r .github/scripts/coverage/requirements-ci.txt+ uses: ./.github/actions/coverage_toolkit+ with:+ command: install-requirements- name: Run CPU C++ coverage tests- run: python3 .github/scripts/coverage/coverage.py step run-cpp-tests+ uses: ./.github/actions/coverage_toolkit+ with:+ command: run-suite+ suite: cpp+ profile: cpu+ lane: cpu- name: Generate CPU native C/C++ coverage report- run: python3 .github/scripts/coverage/coverage.py step collect-cpp-coverage+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-native+ profile: cpu- name: Collect C++ CPU resultsid: cpu_artifactif: ${{ always() }}- run: |- dir="${RUNNER_TEMP}/coverage-cpp-cpu"- python3 .github/scripts/coverage/ci_reports.py collect-suite-results \- --workspace "${{ env.OV_WORKSPACE }}" \- --suite cpp \- --profile cpu \- --lane cpu \- --artifact-name coverage-cpp-cpu \- --artifact-dir "${dir}"- echo "dir=${dir}" >> "$GITHUB_OUTPUT"+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-results+ suite: cpp+ profile: cpu+ lane: cpu- name: Upload C++ CPU artifactif: ${{ always() }}uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 We are not using newest version v6.0.0 due to very frequent issues with 'Error: Unable to make request: ECONNRESET'with:- name: coverage-cpp-cpu+ name: ${{ steps.cpu_artifact.outputs['artifact-name'] }}path: ${{ steps.cpu_artifact.outputs.dir }}if-no-files-found: warnretention-days: 7@@ -237,8 +243,8 @@ jobs:gpu:- id: igpuname: iGPU- runs_on: '["self-hosted","igpu"]'- container_options: "--group-add 44 --group-add 993 --device /dev/dri/card1:/dev/dri/card1 --device /dev/dri/renderD128:/dev/dri/renderD128"+ runs_on: '["self-hosted","igpu","Linux"]'+ container_options: "--group-add 44 --group-add 993 --device /dev/dri/renderD128:/dev/dri/renderD128"- id: dgpuname: dGPU Arc A770runs_on: '["self-hosted","dgpu","Arc-A770","Linux"]'@@ -265,6 +271,7 @@ jobs:BUILD_DIR: ${{ github.workspace }}/openvino/openvino_buildBUILD_JS_DIR: ${{ github.workspace }}/openvino/openvino_build_jsCOVERAGE_WRITE_STEP_SUMMARY: 'false'+ PYTHONDONTWRITEBYTECODE: '1'steps:- name: Prepare ${{ matrix.gpu.name }} test containerrun: |@@ -349,30 +356,36 @@ jobs:fi- name: Run ${{ matrix.gpu.name }} ${{ matrix.lane.name }} C++ coverage tests- run: python3 .github/scripts/coverage/coverage.py step run-cpp-tests+ uses: ./.github/actions/coverage_toolkit+ with:+ command: run-suite+ suite: cpp+ profile: gpu+ lane: ${{ matrix.gpu.id }}-${{ matrix.lane.id }}+ test-names: ${{ matrix.lane.test_names }}- name: Generate ${{ matrix.gpu.name }} ${{ matrix.lane.name }} native C/C++ coverage report- run: python3 .github/scripts/coverage/coverage.py step collect-cpp-coverage+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-native+ profile: gpu- name: Collect C++ ${{ matrix.gpu.name }} ${{ matrix.lane.name }} resultsid: lane_artifactif: ${{ always() }}- run: |- dir="${RUNNER_TEMP}/coverage-cpp-${{ matrix.gpu.id }}-${{ matrix.lane.id }}"- python3 .github/scripts/coverage/ci_reports.py collect-suite-results \- --workspace "${{ env.OV_WORKSPACE }}" \- --suite cpp \- --profile gpu \- --lane "${{ matrix.gpu.id }}-${{ matrix.lane.id }}" \- --artifact-name "coverage-cpp-${{ matrix.gpu.id }}-${{ matrix.lane.id }}" \- --artifact-dir "${dir}"- echo "dir=${dir}" >> "$GITHUB_OUTPUT"+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-results+ suite: cpp+ profile: gpu+ lane: ${{ matrix.gpu.id }}-${{ matrix.lane.id }}+ test-names: ${{ matrix.lane.test_names }}- name: Upload C++ ${{ matrix.gpu.name }} ${{ matrix.lane.name }} artifactif: ${{ always() }}uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 We are not using newest version v6.0.0 due to very frequent issues with 'Error: Unable to make request: ECONNRESET'with:- name: coverage-cpp-${{ matrix.gpu.id }}-${{ matrix.lane.id }}+ name: ${{ steps.lane_artifact.outputs['artifact-name'] }}path: ${{ steps.lane_artifact.outputs.dir }}if-no-files-found: warnretention-days: 7@@ -463,7 +476,9 @@ jobs:self-hosted-runner: 'true'- name: Install coverage Python dependencies- run: python3 -m pip install -r .github/scripts/coverage/requirements-ci.txt+ uses: ./.github/actions/coverage_toolkit+ with:+ command: install-requirements- name: Install OpenVINO Python wheelsuses: ./.github/actions/install_ov_wheels@@ -482,30 +497,34 @@ jobs:python3 -m pip install -r "${INSTALL_DIR}/tests/requirements_tensorflow"- name: Run CPU Python coverage tests- run: python3 .github/scripts/coverage/coverage.py step run-python-tests+ uses: ./.github/actions/coverage_toolkit+ with:+ command: run-suite+ suite: python+ profile: cpu+ lane: cpu- name: Generate CPU native C/C++ coverage report- run: python3 .github/scripts/coverage/coverage.py step collect-cpp-coverage+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-native+ profile: cpu- name: Collect Python CPU resultsid: cpu_artifactif: ${{ always() }}- run: |- dir="${RUNNER_TEMP}/coverage-python-cpu"- python3 .github/scripts/coverage/ci_reports.py collect-suite-results \- --workspace "${{ env.OV_WORKSPACE }}" \- --suite python \- --profile cpu \- --lane cpu \- --artifact-name coverage-python-cpu \- --artifact-dir "${dir}"- echo "dir=${dir}" >> "$GITHUB_OUTPUT"+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-results+ suite: python+ profile: cpu+ lane: cpu- name: Upload Python CPU artifactif: ${{ always() }}uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 We are not using newest version v6.0.0 due to very frequent issues with 'Error: Unable to make request: ECONNRESET'with:- name: coverage-python-cpu+ name: ${{ steps.cpu_artifact.outputs['artifact-name'] }}path: ${{ steps.cpu_artifact.outputs.dir }}if-no-files-found: warnretention-days: 7@@ -530,8 +549,8 @@ jobs:gpu:- id: igpuname: iGPU- runs_on: '["self-hosted","igpu"]'- container_options: "--group-add 44 --group-add 993 --device /dev/dri/card1:/dev/dri/card1 --device /dev/dri/renderD128:/dev/dri/renderD128"+ runs_on: '["self-hosted","igpu","Linux"]'+ container_options: "--group-add 44 --group-add 993 --device /dev/dri/renderD128:/dev/dri/renderD128"- id: dgpuname: dGPU Arc A770runs_on: '["self-hosted","dgpu","Arc-A770","Linux"]'@@ -549,6 +568,7 @@ jobs:BUILD_DIR: ${{ github.workspace }}/openvino/openvino_buildBUILD_JS_DIR: ${{ github.workspace }}/openvino/openvino_build_jsCOVERAGE_WRITE_STEP_SUMMARY: 'false'+ PYTHONDONTWRITEBYTECODE: '1'REQUESTS_CA_BUNDLE: /usr/local/share/ca-certificates/IntelProxyRootCA-Base64.crtsteps:- name: Prepare ${{ matrix.gpu.name }} test container@@ -648,7 +668,9 @@ jobs:self-hosted-runner: 'true'- name: Install coverage Python dependencies- run: python3 -m pip install -r .github/scripts/coverage/requirements-ci.txt+ uses: ./.github/actions/coverage_toolkit+ with:+ command: install-requirements- name: Install OpenVINO Python wheelsuses: ./.github/actions/install_ov_wheels@@ -667,30 +689,34 @@ jobs:python3 -m pip install -r "${INSTALL_DIR}/tests/requirements_tensorflow"- name: Run ${{ matrix.gpu.name }} Python coverage tests- run: python3 .github/scripts/coverage/coverage.py step run-python-tests+ uses: ./.github/actions/coverage_toolkit+ with:+ command: run-suite+ suite: python+ profile: gpu+ lane: ${{ matrix.gpu.id }}- name: Generate ${{ matrix.gpu.name }} native C/C++ coverage report- run: python3 .github/scripts/coverage/coverage.py step collect-cpp-coverage+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-native+ profile: gpu- name: Collect Python ${{ matrix.gpu.name }} resultsid: gpu_artifactif: ${{ always() }}- run: |- dir="${RUNNER_TEMP}/coverage-python-${{ matrix.gpu.id }}"- python3 .github/scripts/coverage/ci_reports.py collect-suite-results \- --workspace "${{ env.OV_WORKSPACE }}" \- --suite python \- --profile gpu \- --lane "${{ matrix.gpu.id }}" \- --artifact-name "coverage-python-${{ matrix.gpu.id }}" \- --artifact-dir "${dir}"- echo "dir=${dir}" >> "$GITHUB_OUTPUT"+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-results+ suite: python+ profile: gpu+ lane: ${{ matrix.gpu.id }}- name: Upload Python ${{ matrix.gpu.name }} artifactif: ${{ always() }}uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1with:- name: coverage-python-${{ matrix.gpu.id }}+ name: ${{ steps.gpu_artifact.outputs['artifact-name'] }}path: ${{ steps.gpu_artifact.outputs.dir }}if-no-files-found: warnretention-days: 7@@ -780,7 +806,9 @@ jobs:self-hosted-runner: 'true'- name: Install coverage Python dependencies- run: python3 -m pip install -r .github/scripts/coverage/requirements-ci.txt+ uses: ./.github/actions/coverage_toolkit+ with:+ command: install-requirements- name: Restore coverage notesrun: |@@ -801,30 +829,35 @@ jobs:run: Xvfb "$DISPLAY" &- name: Run CPU JS coverage tests- run: python3 .github/scripts/coverage/coverage.py step run-js-tests+ uses: ./.github/actions/coverage_toolkit+ with:+ command: run-suite+ suite: js+ profile: cpu+ lane: cpu+ js-dir: ${{ env.OPENVINO_JS_DIR }}- name: Generate CPU native C/C++ coverage report- run: python3 .github/scripts/coverage/coverage.py step collect-cpp-coverage+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-native+ profile: cpu- name: Collect JS CPU resultsid: cpu_artifactif: ${{ always() }}- run: |- dir="${RUNNER_TEMP}/coverage-js-cpu"- python3 .github/scripts/coverage/ci_reports.py collect-suite-results \- --workspace "${{ env.OV_WORKSPACE }}" \- --suite js \- --profile cpu \- --lane cpu \- --artifact-name coverage-js-cpu \- --artifact-dir "${dir}"- echo "dir=${dir}" >> "$GITHUB_OUTPUT"+ uses: ./.github/actions/coverage_toolkit+ with:+ command: collect-results+ suite: js+ profile: cpu+ lane: cpu- name: Upload JS CPU artifactif: ${{ always() }}uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 We are not using newest version v6.0.0 due to very frequent issues with 'Error: Unable to make request: ECONNRESET'with:- name: coverage-js-cpu+ name: ${{ steps.cpu_artifact.outputs['artifact-name'] }}path: ${{ steps.cpu_artifact.outputs.dir }}if-no-files-found: warnretention-days: 7@@ -836,19 +869,7 @@ jobs:if: ${{ always() && needs.Build.result == 'success' }}needs: [Build, CoverageCpp, CoverageCppGpu, CoveragePython, CoveragePythonGpu, CoverageJS]outputs:- cpp_cpu: ${{ steps.coverage_files.outputs.cpp_cpu }}- cpp_igpu_unit: ${{ steps.coverage_files.outputs.cpp_igpu_unit }}- cpp_igpu_func: ${{ steps.coverage_files.outputs.cpp_igpu_func }}- cpp_dgpu_unit: ${{ steps.coverage_files.outputs.cpp_dgpu_unit }}- cpp_dgpu_func: ${{ steps.coverage_files.outputs.cpp_dgpu_func }}- python_cpu_xml: ${{ steps.coverage_files.outputs.python_cpu_xml }}- python_cpu_info: ${{ steps.coverage_files.outputs.python_cpu_info }}- python_igpu_xml: ${{ steps.coverage_files.outputs.python_igpu_xml }}- python_igpu_info: ${{ steps.coverage_files.outputs.python_igpu_info }}- python_dgpu_xml: ${{ steps.coverage_files.outputs.python_dgpu_xml }}- python_dgpu_info: ${{ steps.coverage_files.outputs.python_dgpu_info }}- js_cpu_lcov: ${{ steps.coverage_files.outputs.js_cpu_lcov }}- js_cpu_info: ${{ steps.coverage_files.outputs.js_cpu_info }}+ upload_matrix_json: ${{ steps.coverage_files.outputs['upload-matrix-json'] || '[]' }}runs-on: ubuntu-lateststeps:- name: Checkout sources@@ -875,6 +896,11 @@ jobs:pattern: coverage-js-*path: ${{ github.workspace }}/artifacts/js+ - name: Install coverage Python dependencies+ uses: ./.github/actions/coverage_toolkit+ with:+ command: install-requirements+- name: Resolve selected lanesid: lanesenv:@@ -896,19 +922,18 @@ jobs:- name: Generate final summaryif: ${{ always() }}- run: |- python3 .github/scripts/coverage/ci_reports.py render-summary \- --workspace "${{ github.workspace }}" \- --summary-file "${GITHUB_STEP_SUMMARY}" \- --selection "${{ steps.lanes.outputs.selected_lanes }}" \- --selected-lanes "${{ steps.lanes.outputs.selected_lanes }}"+ uses: ./.github/actions/coverage_toolkit+ with:+ command: render-summary+ selection: ${{ steps.lanes.outputs.selected_lanes }}+ selected-lanes: ${{ steps.lanes.outputs.selected_lanes }}- name: Merge duration reportsif: ${{ always() }}- run: |- python3 .github/scripts/coverage/ci_reports.py merge-durations \- --workspace "${{ github.workspace }}" \- --output "${{ github.workspace }}/coverage-test-durations-all.csv"+ uses: ./.github/actions/coverage_toolkit+ with:+ command: merge-durations+ duration-output: ${{ github.workspace }}/coverage-test-durations-all.csv- name: Upload merged duration artifactif: ${{ always() }}@@ -921,104 +946,56 @@ jobs:compression-level: 0overwrite: true- - name: Resolve Codecov upload files+ - name: Resolve Codecov upload matrixid: coverage_filesif: ${{ always() }}- run: |- python3 .github/scripts/coverage/ci_reports.py resolve-uploads \- --workspace "${{ github.workspace }}" \- --output-file "${GITHUB_OUTPUT}"+ uses: ./.github/actions/coverage_toolkit+ with:+ command: resolve-uploadsCoverageCodecovUploads:name: Coverage Codecov Upload (${{ matrix.upload.name }})- if: ${{ always() && needs.CoverageSummary.result != 'skipped' && needs.CoverageSummary.result != 'cancelled' }}+ if: ${{ always() && needs.CoverageSummary.result == 'success' && needs.CoverageSummary.outputs.upload_matrix_json != '[]' }}needs: CoverageSummaryruns-on: ubuntu-lateststrategy:fail-fast: falsematrix:- upload:- - name: C++ runtime, CPU- artifact_name: coverage-cpp-cpu- output_key: cpp_cpu- flag: cpp-runtime-cpp-cpu- - name: C++ runtime, iGPU Unit- artifact_name: coverage-cpp-igpu-unit- output_key: cpp_igpu_unit- flag: cpp-runtime-cpp-igpu-unit- - name: C++ runtime, iGPU Func- artifact_name: coverage-cpp-igpu-func- output_key: cpp_igpu_func- flag: cpp-runtime-cpp-igpu-func- - name: C++ runtime, dGPU Unit- artifact_name: coverage-cpp-dgpu-unit- output_key: cpp_dgpu_unit- flag: cpp-runtime-cpp-dgpu-unit- - name: C++ runtime, dGPU Func- artifact_name: coverage-cpp-dgpu-func- output_key: cpp_dgpu_func- flag: cpp-runtime-cpp-dgpu-func- - name: Python API, CPU- artifact_name: coverage-python-cpu- output_key: python_cpu_xml- flag: python-api-frontend-layer-ovc-cpu- - name: C++ runtime, Python suite, CPU- artifact_name: coverage-python-cpu- output_key: python_cpu_info- flag: cpp-runtime-python-cpu- - name: Python API, iGPU- artifact_name: coverage-python-igpu- output_key: python_igpu_xml- flag: python-api-frontend-layer-ovc-igpu- - name: C++ runtime, Python suite, iGPU- artifact_name: coverage-python-igpu- output_key: python_igpu_info- flag: cpp-runtime-python-igpu- - name: Python API, dGPU- artifact_name: coverage-python-dgpu- output_key: python_dgpu_xml- flag: python-api-frontend-layer-ovc-dgpu- - name: C++ runtime, Python suite, dGPU- artifact_name: coverage-python-dgpu- output_key: python_dgpu_info- flag: cpp-runtime-python-dgpu- - name: JS bindings, CPU- artifact_name: coverage-js-cpu- output_key: js_cpu_lcov- flag: nodejs-bindings-unit-e2e-cpu- - name: C++ runtime, JS suite, CPU- artifact_name: coverage-js-cpu- output_key: js_cpu_info- flag: cpp-runtime-js-cpu+ upload: ${{ fromJSON(needs.CoverageSummary.outputs.upload_matrix_json || '[]') }}steps:- name: Checkout sources- if: ${{ needs.CoverageSummary.outputs[matrix.upload.output_key] != '' }}uses: ababushk/checkout@dd591a6a2ac25618db4eda86e7e0d938f88cf01b # cherry_pick_retriestimeout-minutes: 15with:submodules: 'false'- - name: Download coverage artifact- if: ${{ needs.CoverageSummary.outputs[matrix.upload.output_key] != '' }}+ - name: Download coverage artifactsuses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0with:- name: ${{ matrix.upload.artifact_name }}- path: ${{ github.workspace }}/artifacts/${{ matrix.upload.artifact_name }}+ pattern: ${{ matrix.upload.artifact_pattern }}+ path: ${{ github.workspace }}/artifacts/${{ matrix.upload.artifact_group }}+ merge-multiple: false- - name: Resolve Codecov upload file- id: coverage_files- if: ${{ needs.CoverageSummary.outputs[matrix.upload.output_key] != '' }}- run: |- python3 .github/scripts/coverage/ci_reports.py resolve-uploads \- --workspace "${{ github.workspace }}" \- --output-file "${GITHUB_OUTPUT}"+ - name: Install coverage Python dependencies+ uses: ./.github/actions/coverage_toolkit+ with:+ command: install-requirements++ - name: Resolve Codecov upload files+ id: upload_files+ uses: ./.github/actions/coverage_toolkit+ with:+ command: resolve-upload-files+ artifact-group: ${{ matrix.upload.artifact_group }}+ artifact-names-json: ${{ toJSON(matrix.upload.artifact_names) }}+ upload-key: ${{ matrix.upload.key }}+ upload-file: ${{ matrix.upload.file }}- name: Upload Codecov (${{ matrix.upload.name }})- if: ${{ steps.coverage_files.outputs[matrix.upload.output_key] != '' }}uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2with:token: ${{ secrets.CODECOV_TOKEN }}- files: ${{ steps.coverage_files.outputs[matrix.upload.output_key] }}+ files: ${{ steps.upload_files.outputs.files }}disable_search: trueplugins: noopflags: ${{ matrix.upload.flag }}diff --git a/.gitignore b/.gitignoreindex 9a3ef7f9f84..970d64184d0 100644--- a/.gitignore+++ b/.gitignore@@ -58,8 +58,8 @@ __tests__/runner/*node_modules# Coverage directory used by tools like istanbulcoverage-!.github/scripts/coverage/-!.github/scripts/coverage/**+!.github/coverage/+!.github/coverage/***.lcov# Optional npm cache directory.npm