Skip to content

Commit c3e5579

Browse files
committed
Merge remote-tracking branch 'upstream/main' into add-method-coverage-support-update
2 parents 72d4fe7 + b6c2d42 commit c3e5579

File tree

21 files changed

+143
-48
lines changed

21 files changed

+143
-48
lines changed

.github/workflows/push_gem.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Push Gem
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
push:
11+
if: github.repository == 'simplecov-ruby/simplecov'
12+
runs-on: ubuntu-latest
13+
14+
environment:
15+
name: rubygems.org
16+
url: https://rubygems.org/gems/simplecov
17+
18+
permissions:
19+
contents: write
20+
id-token: write
21+
22+
steps:
23+
# Set up
24+
- name: Harden Runner
25+
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
26+
with:
27+
egress-policy: audit
28+
29+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
30+
- name: Set up Ruby
31+
uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1.176.0
32+
with:
33+
bundler-cache: true
34+
ruby-version: ruby
35+
36+
# Release
37+
- uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31 # v1

.github/workflows/stable.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on: [push, pull_request]
55
jobs:
66
tests:
77
runs-on: ubuntu-latest
8+
89
env:
910
BUNDLE_WITHOUT: "benchmark"
1011
JRUBY_OPTS: "--debug"
@@ -14,20 +15,38 @@ jobs:
1415

1516
matrix:
1617
ruby-version:
18+
- '2.5'
19+
- '2.6'
1720
- '2.7'
1821
- '3.0'
1922
- '3.1'
2023
- '3.2'
2124
- '3.3'
2225
- jruby-9.4
26+
- truffleruby
2327

2428
steps:
2529
- uses: actions/checkout@v4
2630

31+
- run: rm Gemfile.lock && rm test_projects/rails/rspec_rails/Gemfile.lock
32+
2733
- uses: ruby/setup-ruby@v1
2834
with:
2935
ruby-version: ${{ matrix.ruby-version }}
36+
rubygems: ${{ (matrix.ruby_version < '2.6' && '3.3.26') || 'default' }}
3037
bundler-cache: true
3138

32-
- run: |
33-
bundle exec rake
39+
- name: Run Rubocop
40+
run: bundle exec rake rubocop
41+
# code style is enough to check once (and might even take some time on JRuby)
42+
if: matrix.ruby-version == '3.3'
43+
44+
- name: Run tests
45+
run: bundle exec rake test
46+
if: matrix.ruby-version != 'truffleruby'
47+
48+
# Run only `rake spec` on truffleruby, because just `rake` runs cucumber
49+
# which fails because it uses an old childprocess which depends on fork.
50+
- name: Run specs (truffleruby)
51+
run: bundle exec rake spec
52+
if: matrix.ruby-version == 'truffleruby'

.github/workflows/unstable.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
ruby-version:
1818
- ruby-head
1919
- jruby-head
20+
- truffleruby-head
2021

2122
steps:
2223
- uses: actions/checkout@v4
@@ -25,8 +26,13 @@ jobs:
2526
with:
2627
ruby-version: ${{ matrix.ruby-version }}
2728
bundler-cache: true
28-
continue-on-error: ${{ (matrix.ruby-version == 'ruby-head') || (matrix.ruby-version == 'jruby-head') }}
2929

30-
- run: |
31-
bundle exec rake
32-
continue-on-error: ${{ (matrix.ruby-version == 'ruby-head') || (matrix.ruby-version == 'jruby-head') }}
30+
- name: Run tests
31+
run: bundle exec rake test
32+
if: matrix.ruby-version != 'truffleruby-head'
33+
34+
# Run only `rake spec` on truffleruby, because just `rake` runs cucumber
35+
# which fails because it uses an old childprocess which depends on fork.
36+
- name: Run specs (truffleruby)
37+
run: bundle exec rake spec
38+
if: matrix.ruby-version == 'truffleruby-head'

.rubocop.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ AllCops:
1010
- "tmp/**/*"
1111
- "vendor/bundle/**/*"
1212
- "vendor/bundle/**/.*"
13-
TargetRubyVersion: 2.7
13+
TargetRubyVersion: 2.5
1414
NewCops: enable
1515
# we might wanna adopt rspec and rake but it's a bit annoying for now
1616
SuggestExtensions: false
@@ -239,6 +239,9 @@ Style/DocumentDynamicEvalDefinition:
239239
Style/EndlessMethod:
240240
Enabled: true
241241

242+
Style/EnvHome:
243+
Enabled: false
244+
242245
Style/ExplicitBlockArgument:
243246
# capturing as a proc has a performance hit, so is a case by case choice
244247
Enabled: false

Gemfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ end
1616
gem "matrix"
1717

1818
group :development do
19-
gem "apparition", github: "twalpole/apparition" # LOCKED: When this is released, use a released version https://github.com/twalpole/apparition/pull/79
19+
gem "apparition", github: "twalpole/apparition"
2020
gem "activesupport", "~> 6.1"
21-
gem "aruba", "~> 1.0"
21+
gem "aruba"
2222
gem "capybara"
23-
gem "rackup"
24-
gem "cucumber", "~> 6.0"
23+
if RUBY_VERSION < "2.7"
24+
gem "rack", "< 3"
25+
else
26+
gem "rackup"
27+
end
28+
gem "cucumber"
2529
gem "minitest"
2630
gem "rake"
2731
gem "rspec"

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ PLATFORMS
190190
DEPENDENCIES
191191
activesupport (~> 6.1)
192192
apparition!
193-
aruba (~> 1.0)
193+
aruba
194194
benchmark-ips
195195
capybara
196-
cucumber (~> 6.0)
196+
cucumber
197197
matrix
198198
minitest
199199
pry
@@ -206,4 +206,4 @@ DEPENDENCIES
206206
webrick
207207

208208
BUNDLED WITH
209-
2.4.20
209+
2.5.23

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ SimpleCov.start do
350350
end
351351
```
352352

353-
Primary coverage determines what will come in first all output, and the type of coverage to check if you don't specify the type of coverage when customizing exit behavior (`SimpleCov.minimum_coverage 90`).
353+
Primary coverage determines what will come first in all output, and the type of coverage to check if you don't specify the type of coverage when customizing exit behavior (`SimpleCov.minimum_coverage 90`).
354354
355355
Note that coverage must first be enabled for non-default coverage types.
356356
@@ -861,10 +861,10 @@ As of SimpleCov 0.9, you can specify multiple result formats. Formatters besides
861861
```ruby
862862
require "simplecov-html"
863863

864-
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
864+
SimpleCov.formatters = [
865865
SimpleCov::Formatter::HTMLFormatter,
866866
SimpleCov::Formatter::CSVFormatter,
867-
])
867+
]
868868
```
869869

870870
## JSON formatter
@@ -889,7 +889,7 @@ SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
889889

890890
## Ruby version compatibility
891891

892-
SimpleCov is built in [Continuous Integration] on Ruby 2.7+ as well as JRuby 9.3+.
892+
SimpleCov is built in [Continuous Integration] on Ruby 2.5+ as well as JRuby 9.2+.
893893

894894
Note for JRuby => You need to pass JRUBY_OPTS="--debug" or create .jrubyrc and add debug.fullTrace=true
895895

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ Cucumber::Rake::Task.new do |t|
2929
t.cucumber_opts = %w[--retry 3 --no-strict-flaky]
3030
end
3131

32+
task test: %i[spec cucumber]
3233
task default: %i[rubocop spec cucumber]

features/parallel_tests.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ Feature:
6666
end
6767
"""
6868
When I successfully run `bundle exec parallel_rspec spec`
69-
Then the output should not match /+cover.+below.+minimum/
69+
Then the output should not match /.*cover.+below.+minimum/

features/support/env.rb

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@
55

66
require "bundler"
77
Bundler.setup
8-
require "aruba/cucumber"
9-
require "aruba/config/jruby" if RUBY_ENGINE == "jruby"
108
require "capybara/cucumber"
119
require "capybara/apparition"
10+
require "aruba/cucumber"
11+
require "aruba/config/jruby" if RUBY_ENGINE == "jruby"
1212
require "simplecov"
1313

14+
# Monkey-patching Capybara::DSL if Capybara::DSLRSpecProxyInstaller has no `extended` hook
15+
unless Module.new.extend(RSpec::Matchers).extend(Capybara::DSL).singleton_class.ancestors.include?(Capybara::RSpecMatcherProxies)
16+
Capybara::DSL.extend(Module.new do
17+
def extended(base)
18+
base.extend(Capybara::RSpecMatcherProxies) if defined?(RSpec::Matchers) && base.is_a?(RSpec::Matchers)
19+
super
20+
end
21+
end)
22+
end
23+
1424
# Rack app for Capybara which returns the latest coverage report from Aruba temp project dir
1525
coverage_dir = File.expand_path("../../tmp/aruba/project/coverage/", __dir__)
1626
Capybara.app = Rack::Builder.new do
@@ -39,7 +49,15 @@
3949

4050
Before("@process_fork") do
4151
# Process.fork is NotImplementedError in jruby
42-
skip_this_scenario if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
52+
skip_this_scenario if jruby?
53+
end
54+
55+
Before("@no_jruby") do
56+
skip_this_scenario if jruby?
57+
end
58+
59+
def jruby?
60+
defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
4361
end
4462

4563
Aruba.configure do |config|

0 commit comments

Comments
 (0)