Skip to content

ci: add code coverage - #282

Open
Aryex wants to merge 11 commits into
mainfrom
alexl/coverage
Open

Aryex wants to merge 11 commits into
mainfrom
alexl/coverage

Conversation

@Aryex

@Aryex Aryex commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR add SimpleCov as the line coverage tooling.

Related

closes #288

Follow-up issue #307

@Aryex Aryex added this to the 1.1.0 milestone Aug 15, 2026
@Aryex Aryex self-assigned this Aug 15, 2026
@Aryex
Aryex force-pushed the alexl/coverage branch 2 times, most recently from 3861845 to f06e6a0 Compare August 21, 2026 22:19
@Aryex Aryex changed the title ci: add opt-in SimpleCov code coverage with nightly reporting and badges ci: add opt-in SimpleCov code coverage Aug 25, 2026
@Aryex Aryex changed the title ci: add opt-in SimpleCov code coverage ci: add code coverage Aug 25, 2026
@Aryex
Aryex marked this pull request as ready for review September 3, 2026 16:41
@Aryex
Aryex requested review from currantw and xShinnRyuu September 3, 2026 20:28
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>

@currantw currantw 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.

A few comments for suggestions. Looks good! ✅

Comment thread .simplecov Outdated
Comment on lines +15 to +16
# We aims for a minimum of 80% coverage. However, our coverage at this time is much lower than this.
# Improvement is tracked in https://github.com/valkey-io/valkey-glide-ruby/issues/307

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.

In C#, I implemented a "rachet" mechanism for code coverage (see #384).

Basically, when coverage runs as part of CI, it fails if the measured coverage is less than these thresholds – and it fails if the measured coverage is more than these thresholds. To fix this, the user needs to increase these minimum coverage thresholds (e.g. from 40% to 41%) to match the actual measured coverage. That ensures that the coverage should only ever go up (or, at the very least, that a developer would need to explicitly decrease it when merging a PR, and so would theoretically have to justify why the coverage was going down).

Would it be possible to do something similar here?

This obviously isn't a silver bullet, but it should lead to test coverage gradually ticking up over time, even without dedicated efforts to improve it. Since I merged that "rachet" mechanism back in June, line coverage has increased from 70.6% to 76.5% and branch coverage from 50.9% to 61.7%.

Comment thread .github/workflows/ci.yml Outdated
Comment on lines +254 to +262
- name: Upload coverage report
if: always()
continue-on-error: true
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-report-ruby-${{ matrix.version }}-${{ matrix.engine.type }}-${{ matrix.engine.version }}-${{ matrix.host.NAMED_OS }}-${{ matrix.host.ARCH }}
path: coverage/
retention-days: 14
if-no-files-found: ignore

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.

Are you planning to use this? If there isn't a clear rationale for uploading this now, I think I would avoid it?

Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
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.

Add code coverage to ci

3 participants