Skip to content

ci: nothing measured how much of the code the tests run - #61

Merged
jamesconwaydev merged 1 commit into
parsec-html:mainfrom
foothillsdigital:ci/coverage
Nov 5, 2026
Merged

jamesconwaydev merged 1 commit into
parsec-html:mainfrom
foothillsdigital:ci/coverage

Conversation

@foothillsdigital

Copy link
Copy Markdown
Collaborator

Problem

The Best Practices badge asks for measured coverage, 80% of statements for silver and 90% of statements plus 80% of branches for gold, and nothing measured it.

Refs #51. The wiki's Conformance page is the other half of that issue; I'll add the numbers there from this workflow's first run on main.

Change

.github/workflows/coverage.yml, adapted from Netweir's, without the Python half:

  • runs cargo llvm-cov --workspace --branch on nightly, since branch coverage needs it, with the html5lib-tests submodule checked out,
  • writes the summary table to the job summary, and uploads coverage.txt and coverage.lcov as the coverage artifact,
  • fails under the gold thresholds: --fail-under-lines 90, and 80% of branches, read from the summary's TOTAL row since cargo-llvm-cov has no --fail-under-branches.

The issue suggested adding the thresholds once Parsec is above them, and it already is (below), so they're in from the start. It runs on pushes to main, on pull requests that change the workflow, and by hand, like Netweir's, so it isn't a required check on every pull request.

Tests

The workflow's commands run locally on nightly (cargo 1.101.0-nightly, cargo-llvm-cov 0.9.1). All the workspace's tests passed under instrumentation, and the totals were:

Covered Total
Lines 4,774 5,062 94.31%
Regions 5,793 6,177 93.78%
Functions 502 532 94.36%
Branches 1,259 1,476 85.30%

The lowest are branches in edit.rs (65.6%), css.rs (74.4%) and serialize.rs (76.1%).

The threshold step passes at these numbers. --fail-under-lines 99 exits 1, and the branch check passes on 85.30 and fails on 79.9. actionlint passes.

Checklist

  • cargo fmt, cargo clippy -- -D warnings and cargo test pass locally (no Rust changed)
  • Tests cover the change, and a bug fix has the test that would have caught it (the workflow runs on this pull request)
  • Changes to crates/parsec/src, its tests, examples, scripts or fuzz targets were made in Netweir first (none here)
  • The wiki is updated if the change is visible to people using Parsec (the Conformance page follows the first run on main)
  • It's my own work, and not copied from another project in breach of its licence (adapted from Netweir's workflow)

The OpenSSF Best Practices badge asks for measured statement coverage
at silver, and statement and branch coverage at gold, but no workflow
measured either.

A coverage workflow, adapted from Netweir's, runs the workspace tests
on an instrumented nightly build with branch coverage, writes the
summary to the job summary, and uploads the text and lcov reports. It
fails under the gold thresholds, 90% of lines and 80% of branches,
which Parsec is already above: locally, 94.3% of lines, 93.8% of
regions, 94.4% of functions and 85.3% of branches.

Refs parsec-html#51

Signed-off-by: Foothills Digital <[email protected]>
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Everyone on this pull request has agreed to the CLA. Thank you.

@jamesconwaydev jamesconwaydev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is good work, thank you. I approved the workflow runs, and the first numbers are already past gold:

Covered
Lines 94.31%
Regions 93.78%
Functions 94.36%
Branches 85.30%

So I'm happy for the thresholds to fail the run from the start, which I'd said to hold off on. With these numbers there's nothing to wait for, and it stops a slide from day one.

The one thing left is the CLA check. Comment the line the bot asked for, and I'll merge once it passes. When it's in, add the numbers to the wiki's Conformance page as you planned, or tell me and I'll add them, credited to you.

@foothillsdigital

Copy link
Copy Markdown
Collaborator Author

I have read the CLA and I agree to it.

1 similar comment
@foothillsdigital

Copy link
Copy Markdown
Collaborator Author

I have read the CLA and I agree to it.

@jamesconwaydev
jamesconwaydev merged commit adc2dcc into parsec-html:main Nov 5, 2026
8 of 10 checks passed
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.

2 participants