Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix coverage collection due to SimpleCov load timing #122

Merged
merged 5 commits into from
Jun 28, 2023
Merged

Conversation

exoego
Copy link
Owner

@exoego exoego commented Jun 28, 2023

To collect coverage, it turned out that SimpleCov must be loaded before RSpec.
This PR borrows the workaround in rspec-core: https://github.com/rspec/rspec-core/blob/81589709e88db1ec2537faee3a7f4a43c7d9aac1/script/rspec_with_simplecov

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Rubocop found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #122 (dcdc4e1) into master (2a1579b) will increase coverage by 30.32%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           master     #122       +/-   ##
===========================================
+ Coverage   66.08%   96.41%   +30.32%     
===========================================
  Files          31       15       -16     
  Lines         684      418      -266     
===========================================
- Hits          452      403       -49     
+ Misses        232       15      -217     
Impacted Files Coverage Δ
scripts/rspec 100.00% <100.00%> (ø)

... and 26 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

.simplecov_spawn.rb Fixed Show fixed Hide fixed
.simplecov_spawn.rb Fixed Show fixed Hide fixed
.simplecov_spawn.rb Fixed Show fixed Hide fixed
.simplecov_spawn.rb Fixed Show fixed Hide fixed
$0 = 'rspec'

# This is necessary for when `--standalone` is being used.
$:.unshift File.expand_path '../bundle', __dir__

Check notice

Code scanning / Rubocop

Avoid Perl-style global variables.

Style/SpecialGlobalVars: Prefer `$LOAD_PATH` over `$:`.

# For the travis build we put the bundle directory up a directory
# so it can be shared among the repos for faster bundle installs.
$:.unshift File.expand_path '../../bundle', __dir__

Check notice

Code scanning / Rubocop

Avoid Perl-style global variables.

Style/SpecialGlobalVars: Prefer `$LOAD_PATH` over `$:`.
scripts/rspec_with_simplecov Fixed Show fixed Hide fixed
minimum_coverage(RUBY_PLATFORM == 'java' ? 94 : 97)
end
end
rescue LoadError

Check warning

Code scanning / Rubocop

Don't suppress exceptions.

Lint/SuppressedException: Do not suppress exceptions.
old_verbose = $VERBOSE
$VERBOSE = false

unless ENV['COVERAGE'] && ENV['COVERAGE'].empty? || RUBY_VERSION < '1.9.3'

Check warning

Code scanning / Rubocop

Checks for expressions containing multiple binary operations with ambiguous precedence.

Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity.
old_verbose = $VERBOSE
$VERBOSE = false

unless ENV['COVERAGE'] && ENV['COVERAGE'].empty? || RUBY_VERSION < '1.9.3'

Check notice

Code scanning / Rubocop

Suggests `ENV.fetch` for the replacement of `ENV[]`.

Style/FetchEnvVar: Use `ENV.fetch('COVERAGE')` or `ENV.fetch('COVERAGE', nil)` instead of `ENV['COVERAGE']`.
@exoego exoego marked this pull request as ready for review June 28, 2023 07:35
@exoego exoego changed the title ci: coverage fix ci: Fix coverage collection due to SimpleCov load timing Jun 28, 2023
@exoego exoego merged commit d83c10f into master Jun 28, 2023
@exoego exoego deleted the coverage-fix branch June 28, 2023 07:36
@exoego exoego added the chore label Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant