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

Commit caceb39

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 caceb39

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ env:
2020
RSPEC_CI: true
2121
# This tells rspec-rails what branch to run in ci
2222
RSPEC_VERSION: '= 3.14.0.pre'
23+
COVERAGE_ONLY_ON: "3.3"
2324
jobs:
2425
rubocop:
2526
name: Rubocop
@@ -129,6 +130,7 @@ jobs:
129130
options: "--add-host rubygems.org:151.101.129.227 --add-host api.rubygems.org:151.101.129.227"
130131
env:
131132
LEGACY_CI: true
133+
NO_COVERAGE: true
132134
JRUBY_OPTS: ${{ matrix.container.jruby_opts || '--dev' }}
133135
steps:
134136
- 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)