Skip to content

E2E CI polishing: add sharding and fix coverage accuracy#351

Merged
priethor merged 14 commits intotrunkfrom
tests/add-sharding-support
Jan 5, 2026
Merged

E2E CI polishing: add sharding and fix coverage accuracy#351
priethor merged 14 commits intotrunkfrom
tests/add-sharding-support

Conversation

@priethor
Copy link
Copy Markdown
Contributor

@priethor priethor commented Jan 5, 2026

What

Follow-up to #343. Improves E2E test CI with sharding and accurate coverage reporting.

Why

E2E tests were slow, and PHP coverage was incorrectly reporting ~99% due to PCOV only tracking files loaded during execution and not including those not loaded.

How

  • Adding test sharding to split the Playwright suite across 4 parallel runners.
  • Fixing PHP coverage accuracy by scanning all PHP files in includes/ to create a baseline with all executable lines marked as uncovered, then merging actual PCOV data on top. This corrects the e2e-php coverage from an incorrect ~99% introduced in Testing: Add PHP code coverage collection for e2e tests #343 to a more realistic ~36%.
  • Configuring Codecov with disable_search: true to prevent auto-discovery of raw coverage files, and adding carryforward flags to preserve coverage data across runs.

Testing instructions

  • E2E tests run in 4 parallel shards (faster than the previous single-runner approach)
  • e2e PHP coverage is now 36%, not the unrealistic 99%
  • The Codecov comment shows more hits but also many more misses, as we include the files not loaded in the baseline

@priethor priethor added this to the 6.9.0 milestone Jan 5, 2026
@priethor priethor self-assigned this Jan 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 5, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.51%. Comparing base (939c314) to head (ff30965).
⚠️ Report is 1 commits behind head on trunk.

❗ There is a different number of reports uploaded between BASE (939c314) and HEAD (ff30965). Click for more details.

HEAD has 11 uploads less than BASE
Flag BASE (939c314) HEAD (ff30965)
javascript 3 1
phpunit 6 2
e2e-js 6 3
e2e-php 6 4
Additional details and impacted files
@@              Coverage Diff              @@
##              trunk     #351       +/-   ##
=============================================
- Coverage     60.07%   49.51%   -10.56%     
  Complexity     4410     4410               
=============================================
  Files           296      298        +2     
  Lines         24586    39424    +14838     
=============================================
+ Hits          14769    19521     +4752     
- Misses         9817    19903    +10086     
Flag Coverage Δ
e2e-js 44.17% <ø> (-0.45%) ⬇️
e2e-php 35.72% <ø> (-64.10%) ⬇️
javascript 15.07% <ø> (ø)
phpunit 29.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Move wait_for_ci under codecov.notify section where it's valid,
and add require_ci_to_pass to ensure coverage status waits for
all shards to complete before computing final coverage.

This should fix the "indirect changes" showing reduced coverage
when comparing base to head in PRs with sharded E2E tests.
Instead of each shard uploading coverage separately (causing timing
issues with Codecov merging), now:

1. Each shard saves raw coverage data as GitHub artifacts
2. New 'coverage' job waits for all shards to complete
3. Downloads all artifacts and merges them locally using NYC
4. Uploads single combined report to Codecov

This ensures complete coverage is always uploaded, fixing the
"indirect changes" showing reduced coverage in PR comparisons.
Temporary debugging to diagnose why coverage files aren't being
generated in CI despite instrumented code being present.
Coverage files are being saved but upload-artifact can't find them.
Adding debug step to list directory contents and include-hidden-files
option since .nyc_output starts with a dot.
The include-hidden-files option fixed the artifact upload issue.
Coverage is now being collected and merged correctly.
PCOV only reports coverage for files that were loaded during test
execution. This caused e2e-php to show ~99% coverage because it only
counted files that were actually touched by tests, not all PHP files.

Fix by scanning all PHP files in includes/ to build a baseline before
merging PCOV data. Files not covered by PCOV are now included with 0%
coverage, giving accurate totals.

Before: 99.88% (only loaded files counted)
After: ~36% (all 210 PHP files in includes/ counted)
@priethor priethor force-pushed the tests/add-sharding-support branch from 1813224 to 934372c Compare January 5, 2026 20:13
Add disable_search: true to Codecov uploads to prevent auto-discovery
of raw .php-coverage/*.json files. This ensures only the merged LCOV
(which includes the PHP baseline) is uploaded.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Remove the separate merge job. Each shard now:
1. Generates LCOV reports (JS via NYC, PHP via baseline script)
2. Uploads directly to Codecov with disable_search: true

Codecov will merge the per-shard uploads automatically.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@priethor priethor changed the title Testing: Add sharding support for e2e tests E2E CI polishing: add sharding and fix coverage accuracy Jan 5, 2026
@priethor priethor merged commit f21ac02 into trunk Jan 5, 2026
11 of 12 checks passed
@priethor priethor deleted the tests/add-sharding-support branch January 5, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant