Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 0290c7d

Browse files
committed
only perform coverage checks on ruby 3.3
This allows us to check coverage on lines that only run on modern rubies, rather than needing to :nocov: them so older rubies can pass the test suite. It also makes it easy to keep track of and change which ruby's coverage is being _used_ in CI, since it's just being specified in an environment variable on the matrix. (Also mark the legacy builds as NO_COVERAGE: true, for clarity)
1 parent faab8b8 commit 0290c7d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/ci.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ jobs:
7171
DIFF_LCS_VERSION: "1.4.3"
7272
fail-fast: false
7373
continue-on-error: ${{ matrix.allow_failure || endsWith(matrix.ruby, 'head') }}
74-
env: ${{ matrix.env }}
74+
env:
75+
COVERAGE_ONLY_ON: "3.3"
76+
${{ matrix.env }}
7577
steps:
7678
- uses: actions/checkout@v4
7779
- uses: ruby/setup-ruby@v1
@@ -129,6 +131,7 @@ jobs:
129131
options: "--add-host rubygems.org:151.101.129.227 --add-host api.rubygems.org:151.101.129.227"
130132
env:
131133
LEGACY_CI: true
134+
NO_COVERAGE: true
132135
JRUBY_OPTS: ${{ matrix.container.jruby_opts || '--dev' }}
133136
steps:
134137
- uses: actions/checkout@v3

script/rspec_with_simplecov

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ begin
2424
# Simplecov emits some ruby warnings when loaded, so silence them.
2525
old_verbose, $VERBOSE = $VERBOSE, false
2626

27-
unless ENV['NO_COVERAGE'] || RUBY_VERSION.to_f < 2.1
27+
skip_because_no_coverage = ENV['NO_COVERAGE']
28+
skip_because_ruby_too_low = RUBY_VERSION.to_f < 2.1
29+
skip_because_wrong_version = ENV['COVERAGE_ONLY_ON'] && ENV['COVERAGE_ONLY_ON'].to_f != RUBY_VERSION.to_f
30+
31+
unless skip_because_no_coverage || skip_because_ruby_too_low || skip_because_wrong_version
2832
require 'simplecov'
2933

3034
SimpleCov.start do

0 commit comments

Comments
 (0)