Skip to content

CI: upload only failed image comparisons - #850

Merged
cvanelteren merged 16 commits into
mainfrom
ci/failure-only-image-artifacts-20261020
Oct 21, 2026
Merged

cvanelteren merged 16 commits into
mainfrom
ci/failure-only-image-artifacts-20261020

Conversation

@cvanelteren

Copy link
Copy Markdown
Collaborator

Problem

The comparison workflow currently requests --mpl-generate-summary=html, which implicitly enables pytest-mpl's --mpl-results-always and causes successful test images to be included in the uploaded results/* artifact.

Change

  • Switch both comparison test modes to --mpl-generate-summary=json, retaining diagnostic metadata without generating passing-test images.
  • Add tools/ci/collect_failed_comparisons.py to collect only failed tests' baseline, actual, and diff images.
  • Generate a compact self-contained HTML comparison report plus filtered JSON and JUnit XML.
  • Upload only the failed-comparisons/ directory; on a green test run, it is not created, so no artifact is uploaded.
  • Include non-image JUnit failures even if they have no comparison images.
  • Add tests for passing, failed-image, and JUnit-only cases.

Verification

Ran local synthetic checks for an all-passing run, a single failing comparison alongside a passing comparison, and a JUnit-only failure. The production CI workflow itself still needs a run to verify the change end-to-end.

The expected size reduction depends on the fraction of failing comparisons; for successful runs the image artifact is eliminated entirely.

@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cvanelteren
cvanelteren marked this pull request as draft October 19, 2026 23:53

Copy link
Copy Markdown
Collaborator Author

Temporary CI artifact smoke test — do not merge this mismatch.

Commit 7e629f7 intentionally changes test_inset_basic's rendered figure (ultraplot/tests/test_inset.py), so a baseline comparison against main should fail. This is deliberate: it exercises the new failure-only artifact collector with baseline/actual/diff images and the HTML/JSON/JUnit reports. Once the Matrix Test workflow finishes, inspect the failed-comparisons-... artifact in the Compare baseline job. Revert the test_inset.py changes before merging PR #850.

Triggered Matrix Test run

Copy link
Copy Markdown
Collaborator Author

HTML report refresh is now pushed. The failure artifact viewer now includes a responsive side-by-side baseline / actual / diff layout, searchable failed tests, inline RMS and tolerance metrics, expandable diagnostic output, and a click-to-enlarge image viewer. All CSS and JS are embedded in index.html so it can be opened directly from the extracted artifact without hosting. Added HTML safety and smoke tests, and CI now runs the report-generator unit tests.

The intentional test_inset_basic visual mismatch is still present, as requested, to let you inspect the new report in this PR's Actions artifacts. It is explicitly temporary and should be reverted before merge.

Copy link
Copy Markdown
Collaborator Author

Updated the HTML artifact to the agreed dark charcoal header + table design (latest commit ceee392). The header shows full-run Passed / Failed / Errors counts read from JUnit, along with Python/Matplotlib versions and report timestamp. The results table displays only failed comparisons with baseline / actual / diff previews, RMS, tolerance, and expandable diagnostics. Passing images remain excluded from the artifact, keeping it small.

The intentional test_inset_basic image mismatch remains for visual inspection; please remove it before merging. Matrix Test run for this update.

@cvanelteren
cvanelteren marked this pull request as ready for review October 21, 2026 11:41
@cvanelteren
cvanelteren merged commit 6b21381 into main Oct 21, 2026
35 of 36 checks passed
@cvanelteren
cvanelteren deleted the ci/failure-only-image-artifacts-20261020 branch October 21, 2026 11:41
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.

1 participant