Skip to content

Re add coverage to main repo - #50486

Open
pnv1 wants to merge 3 commits into
ydb-platform:mainfrom
pnv1:re-add-coverage-to-main-repo
Open

Re add coverage to main repo#50486
pnv1 wants to merge 3 commits into
ydb-platform:mainfrom
pnv1:re-add-coverage-to-main-repo

Conversation

@pnv1

@pnv1 pnv1 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Changelog entry

Description for reviewers

Adds Clang coverage CI for three independently reported suites / Codecov flags:

  • cpp_sdkydb/public/sdk/cpp/**;
  • cliydb/apps/ydb/** and ydb/public/lib/ydb_cli/**;
  • cli_workloadydb/library/workload/**.

Workflow behavior

  • PRs from forks and same-repository branches are handled only when they target ydb-platform/ydb:main and touch relevant paths.
  • Repository writers are covered automatically. An external contributor's current PR revision can be approved by a repository writer applying ok-to-test.
  • Other labels are ignored before allocating a runner and cannot cancel an active coverage run.
  • A push to main publishes an updated baseline for the affected suites. Codecov carryforward preserves unaffected flags.
  • Coverage infrastructure changes select all three suites; changes limited to helper tests do not start the expensive coverage workflow.

Trust model for PRs

  • The privileged workflow is pull_request_target, so its definition comes from the default branch.
  • The permission gate uses GH_PERSONAL_ACCESS_TOKEN only to check repository write/admin access for the PR author/event sender or the writer applying ok-to-test.
  • Product code is checked out from the exact pinned PR head SHA only after authorization.
  • Coverage actions and scripts are replaced with copies from the PR base SHA before the build receives repository secrets.
  • Persisted Git credentials are disabled on both measured and trusted checkouts.

Reports

  • Suite-filtered LCOV is uploaded to Codecov with the upstream repository slug, exact commit SHA, branch, PR number, and suite flag.
  • HTML reports contain only source files owned by the selected component; transitive dependencies and disposable .ya/build/build_root sources do not affect component totals.
  • HTML is published best-effort to Yandex Object Storage under ydb/pr-<number>/coverage for PRs and ydb/coverage for main.

Validation

  • Codecov C++ helper checks runs 29 unit/contract tests for routing, LCOV filtering, trusted overlay, metadata, and workflow contracts.
  • All-suite dogfood run: SDK, CLI, workload, Codecov uploads, S3 reports, and landing page completed successfully.
  • Final CLI filtering dogfood run: LCOV, HTML, and Codecov all contained the same 256 CLI-owned source files; all published HTML links were checked successfully.

The existing .github/workflows/cpp_sdk_coverage.yml remains unchanged and can be removed separately after the new workflow has been validated post-merge. Since pull_request_target loads its workflow from the default branch, this PR itself can run the unprivileged helper checks but the exact production PR path becomes available only after merge.

@pnv1
pnv1 requested a review from a team as a code owner August 19, 2026 10:48
Copilot AI lite review requested due to automatic review settings August 19, 2026 10:48
@ydbot

ydbot commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Run Extra Tests

Run additional tests for this PR. You can customize:

  • Test Size: small, medium, large (default: small, medium)
  • Test Targets: any directory path (default: ydb/)
  • Sanitizers: ASAN, MSAN, TSAN
  • Coredumps: enable for debugging (default: off)
  • Additional args: custom ya make arguments

▶  Run tests

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

2026-08-19 10:52:13 UTC Pre-commit check linux-x86_64-release-asan for df806d3 has started.
2026-08-19 10:53:06 UTC Artifacts will be uploaded here
2026-08-19 10:55:22 UTC ya make is running...
🟢 2026-08-19 10:55:28 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

🟢 2026-08-19 10:55:31 UTC Build successful.

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

2026-08-19 10:52:53 UTC Pre-commit check linux-x86_64-relwithdebinfo for df806d3 has started.
2026-08-19 10:53:12 UTC Artifacts will be uploaded here
2026-08-19 10:54:41 UTC ya make is running...
🟢 2026-08-19 10:54:47 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

🟢 2026-08-19 10:54:50 UTC Build successful.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reintroduces Codecov coverage reporting for C++ areas (SDK / CLI / workload) in the main ydb-platform/ydb repository by adding a dedicated GitHub Actions workflow, suite detection helpers, Codecov configuration, and validation tests for the CI helper scripts.

Changes:

  • Added pull_request_target + push workflows to run suite-scoped clang coverage, upload LCOV to Codecov, and optionally publish filtered HTML coverage to Object Storage.
  • Added Python helpers to (a) map changed paths to coverage suites, (b) export suite-filtered LCOV, and (c) generate an HTML landing page.
  • Added helper checks workflow plus unit tests to validate the coverage helper contract and guard against regressions.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/workflows/cpp_codecov.yml Main Codecov workflow: auth gate, suite matrix detection, coverage execution on self-hosted runners, and landing-page publishing.
.github/workflows/cpp_codecov_checks.yml CI checks for the Codecov helper scripts (tests, shell syntax, YAML parsing).
.github/scripts/codecov/tests/test_helpers.py Unit/contract tests covering suite selection, LCOV filtering, HTML generation behavior, and workflow/action invariants.
.github/scripts/codecov/overlay_trusted_codecov_ci.sh Overlays trusted (base SHA) CI helpers into the PR workspace for pull_request_target safety.
.github/scripts/codecov/generate_coverage_landing.py Generates a simple landing HTML linking per-suite reports (with optional embedded metadata).
.github/scripts/codecov/export_coverage_lcov.py Parses ya’s llvm-cov invocation, exports LCOV, filters to suite-owned sources, and can generate matching HTML from filtered sources.
.github/scripts/codecov/detect_codecov_matrix.py Emits the suite matrix and a should-run flag based on changed paths for CI orchestration.
.github/scripts/codecov/codecov_suites.py Central suite registry (targets/paths/flags) and path-to-suite selection logic shared by workflows and actions.
.github/codecov.yml Codecov configuration (flag + component management and status thresholds) for the C++ suites in this repo.
.github/actions/run_clang_codecov/action.yaml Composite action to build/test with clang coverage, export filtered LCOV/HTML, upload to Codecov, and optionally publish HTML to Object Storage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/cpp_codecov_checks.yml Outdated
Comment thread .github/scripts/codecov/tests/test_helpers.py Outdated
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

2026-08-19 11:36:32 UTC Pre-commit check linux-x86_64-relwithdebinfo for e76a0ef has started.
2026-08-19 11:36:51 UTC Artifacts will be uploaded here
2026-08-19 11:38:24 UTC ya make is running...
🟢 2026-08-19 11:38:30 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

🟢 2026-08-19 11:38:33 UTC Build successful.

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

2026-08-19 11:37:31 UTC Pre-commit check linux-x86_64-release-asan for e76a0ef has started.
2026-08-19 11:37:50 UTC Artifacts will be uploaded here
2026-08-19 11:39:20 UTC ya make is running...
🟢 2026-08-19 11:39:25 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

🟢 2026-08-19 11:39:28 UTC Build successful.

@pnv1
pnv1 requested a balanced review from Copilot August 19, 2026 11:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants