Skip to content

non-production: set up codecov in this repo - #14

Merged
dep merged 3 commits into
masterfrom
codeCovSetup
Jul 14, 2026
Merged

non-production: set up codecov in this repo#14
dep merged 3 commits into
masterfrom
codeCovSetup

Conversation

@dep

@dep dep commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Sets up Codecov coverage reporting for this repo.

  • Pass secrets: inherit to the shared ruby-test-matrix workflow so CODECOV_TOKEN reaches the Codecov upload step
  • Add simplecov and simplecov-lcov as development dependencies (Gemfile, per repo convention), with a test/simplecov_helper.rb required first in test/test_helper.rb; emits coverage/lcov.info under GITHUB_ACTIONS
  • Ignore coverage/ in .gitignore
  • Add repo-level codecov.yml with 1% thresholds because measured local line coverage is 78.57% (at or below 80%)

Local verification: bundle exec rake test passes (10 runs, 0 failures) on Ruby 3.4.5; GITHUB_ACTIONS=true run produced coverage/lcov.info.


CI fix (latent issue exposed by re-enabling the Pipeline workflow): The unlocked-gemfile matrix legs on Ruby 3.2–3.4 failed with NameError: uninitialized constant Minitest::Mock. Root cause: minitest 6 (resolved by gemfiles/unlocked.gemfile on Ruby >= 3.2) no longer autoloads minitest/mock from minitest/autorun — the Mock/Stub code was extracted into the separate minitest-mock gem. This reproduces identically on origin/master with the unlocked gemfile, so it is pre-existing, not caused by the codecov changes; it only surfaced now because this repo's CI had been disabled for inactivity. Fix: add minitest-mock to the Gemfile development group (regenerating gemfiles/unlocked.gemfile via appraisal) and require minitest/mock explicitly in test/test_helper.rb. Verified locally on Ruby 3.4.5 and 3.2.2 (unlocked gemfile) and 3.4.5 (locked Gemfile): 10 runs, 0 failures.

- Pass secrets: inherit to the shared ruby-test-matrix workflow so CODECOV_TOKEN reaches the Codecov upload step
- Add simplecov and simplecov-lcov, emitting coverage/lcov.info on CI
- Add repo-level codecov.yml (coverage at or below 80%)
dep added 2 commits July 13, 2026 16:36
Newest minitest (6.x) no longer autoloads minitest/mock from
minitest/autorun; the Mock/Stub code was extracted into the separate
minitest-mock gem. This was a latent issue on master, exposed once the
unlocked gemfile resolved minitest 6 under Ruby >= 3.2.
@dep
dep marked this pull request as ready for review July 14, 2026 13:58
Copilot AI review requested due to automatic review settings July 14, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Sets up Codecov coverage reporting for this Ruby gem repository by adding SimpleCov instrumentation, Codecov configuration, and CI secret propagation to enable uploads from the existing reusable CI workflow.

Changes:

  • Add simplecov + simplecov-lcov and a test/simplecov_helper.rb to generate HTML locally and LCOV in GitHub Actions.
  • Fix CI failures with newer Minitest by adding minitest-mock and explicitly requiring minitest/mock.
  • Add codecov.yml and ignore generated coverage/ output.

Reviewed changes

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

Show a summary per file
File Description
test/test_helper.rb Loads coverage helper first and explicitly requires minitest/mock for Minitest 6 compatibility.
test/simplecov_helper.rb Starts SimpleCov, configures LCOV output on GitHub Actions, and HTML output otherwise.
Gemfile Adds dev dependencies: minitest-mock, simplecov, simplecov-lcov.
Gemfile.lock Locks new dependencies (minitest-mock, simplecov, formatters).
gemfiles/unlocked.gemfile Mirrors new dev deps into the appraisal/unlocked gemfile.
codecov.yml Adds minimal Codecov status config with permissive thresholds.
.gitignore Ignores coverage/ artifacts.
.github/workflows/pipeline.yml Forwards secrets to reusable workflow to enable Codecov upload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 7 to 11
tests:
uses: Invoca/ruby-test-matrix-workflow/.github/workflows/ruby-test-matrix.yml@main
secrets: inherit
with:
test-command: "bundle exec rake test"
Comment thread test/simplecov_helper.rb
add_filter "/test/"
track_files "lib/**/*.rb"

if ENV["GITHUB_ACTIONS"]
@dep
dep merged commit 7a38cf8 into master Jul 14, 2026
16 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