Skip to content
New issue

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

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

Already on GitHub? # to your account

Move MRI build to Github Actions #2404

Merged
merged 9 commits into from
Nov 23, 2020
93 changes: 93 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: RSpec CI
on:
push:
branches:
- 'main'
- '*-maintenance'
- '*-dev'
pull_request:
branches:
- '*'
jobs:
test:
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.env.RAILS_VERSION }}'
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
# Rails 6.0 builds >= 2.5.0
- ruby: 3.0.0-preview1
env:
RAILS_VERSION: '~> 6.0.0'
- ruby: 2.7
env:
RAILS_VERSION: '~> 6.0.0'
- ruby: 2.6
env:
RAILS_VERSION: '~> 6.0.0'
- ruby: 2.5
env:
RAILS_VERSION: '~> 6.0.0'
# Rails 5.2 builds >= 2.2.2
- ruby: 2.6.6
env:
RAILS_VERSION: '~> 5.2.0'
- ruby: 2.5.8
env:
RAILS_VERSION: '~> 5.2.0'
- ruby: 2.4.10
env:
RAILS_VERSION: '~> 5.2.0'
- ruby: 2.3.8
env:
RAILS_VERSION: '~> 5.2.0'
- ruby: 2.2.10
allow_failure: true
env:
RAILS_VERSION: '~> 5.2.0'
- ruby: 2.2.10
env:
RAILS_VERSION: '5-2-stable'
# Rails 5.1 Builds >= 2.2.2
- ruby: 2.6.6
env:
RAILS_VERSION: '~> 5.1.0'
- ruby: 2.5.8
env:
RAILS_VERSION: '~> 5.1.0'
- ruby: 2.4.10
env:
RAILS_VERSION: '~> 5.1.0'
- ruby: 2.3.8
env:
RAILS_VERSION: '~> 5.1.0'
- ruby: 2.2.10
env:
RAILS_VERSION: '~> 5.1.0'
# Rails 5.0 Builds >= 2.2.2
- ruby: 2.6.6
env:
RAILS_VERSION: '~> 5.0.0'
- ruby: 2.5.8
env:
RAILS_VERSION: '~> 5.0.0'
- ruby: 2.4.10
env:
RAILS_VERSION: '~> 5.0.0'
- ruby: 2.3.8
env:
RAILS_VERSION: '~> 5.0.0'
- ruby: 2.2.10
env:
RAILS_VERSION: '~> 5.0.0'
env: ${{ matrix.env }}
continue-on-error: ${{ matrix.allow_failure || false }}
Copy link
Member Author

@benoittgt benoittgt Nov 22, 2020

Choose a reason for hiding this comment

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

I doesn't seem to work. :/
https://github.com/rspec/rspec-rails/runs/1438441078?check_suite_focus=true

I am in favor of moving it to script/run_build step.

Copy link
Member

Choose a reason for hiding this comment

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

SyntaxError: /home/runner/work/rspec-rails/bundle/ruby/2.2.0/gems/actionpack-5.2.4.4/lib/action_dispatch/request/session.rb:96: syntax error, unexpected '.'
          id&.public_id

That build is failing genuinely.

Copy link
Member

Choose a reason for hiding this comment

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

I think they introduced a 2.2.x bug for 5.2... &. is 2.3 and above.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Oh, sorry, I've missed 2.2.2 is tested against 5-2-stable already.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think they introduced a 2.2.x bug for 5.2... &. is 2.3 and above.

Yes completely and I didn't see a patch to change that ATM.

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: script/clone_all_rspec_repos
- run: bundle install --binstubs
- run: script/run_build
54 changes: 6 additions & 48 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,66 +38,24 @@ script: "script/run_build 2>&1"

matrix:
include:
# Rails 6.0 builds >= 2.5.0
- rvm: jruby-head
jdk: oraclejdk11
env:
- RAILS_VERSION='~> 6.0.0'
- JRUBY_OPT=--dev
- JAVA_OPTS="--add-opens java.base/sun.nio.ch=org.jruby.dist --add-opens java.base/java.io=org.jruby.dist --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.security.cert=ALL-UNNAMED --add-opens=java.base/java.util.zip=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/javax.crypto=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED"
- rvm: ruby-3.0.0-preview1
env: RAILS_VERSION='~> 6.0.0'
allow_failure: true
- rvm: 2.7.1
env: RAILS_VERSION='~> 6.0.0'
- rvm: 2.6.6
env: RAILS_VERSION='~> 6.0.0'
- rvm: 2.5.8
env: RAILS_VERSION='~> 6.0.0'

# Rails 5.2 builds >= 2.2.2
- rvm: jruby-head
jdk: oraclejdk11
env:
- RAILS_VERSION='~> 5.2.0'
- JRUBY_OPT=--dev
- JAVA_OPTS="--add-opens java.base/sun.nio.ch=org.jruby.dist --add-opens java.base/java.io=org.jruby.dist --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.security.cert=ALL-UNNAMED --add-opens=java.base/java.util.zip=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/javax.crypto=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED"
- rvm: 2.6.6
env: RAILS_VERSION='~> 5.2.0'
- rvm: 2.5.8
env: RAILS_VERSION='~> 5.2.0'
- rvm: 2.4.10
env: RAILS_VERSION='~> 5.2.0'
- rvm: 2.3.8
env: RAILS_VERSION='~> 5.2.0'
- rvm: 2.2.10
env: RAILS_VERSION='~> 5.2.0'
allow_failure: true
- rvm: 2.2.10
env: RAILS_VERSION='5-2-stable'

# Rails 5.1 Builds >= 2.2.2
- rvm: 2.6.6
env: RAILS_VERSION='~> 5.1.0'
- rvm: 2.5.8
env: RAILS_VERSION='~> 5.1.0'
- rvm: 2.4.10
env: RAILS_VERSION='~> 5.1.0'
- rvm: 2.3.8
env: RAILS_VERSION='~> 5.1.0'
- rvm: 2.2.10
env: RAILS_VERSION='~> 5.1.0'

# Rails 5.0 Builds >= 2.2.2
- rvm: 2.6.6
env: RAILS_VERSION='~> 5.0.0'
- rvm: 2.5.8
env: RAILS_VERSION='~> 5.0.0'
- rvm: 2.4.10
env: RAILS_VERSION='~> 5.0.0'
- rvm: 2.3.8
env: RAILS_VERSION='~> 5.0.0'
- rvm: 2.2.10
env: RAILS_VERSION='~> 5.0.0'

fast_finish: true

branches:
only:
- master
- /^\d+-\d+-maintenance$/
benoittgt marked this conversation as resolved.
Show resolved Hide resolved
- /^\d+-\d+-dev$/
10 changes: 5 additions & 5 deletions features/matchers/have_broadcasted_matcher.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: have_broadcasted matcher
it "matches with stream name" do
expect {
ActionCable.server.broadcast(
"notifications", text: 'Hello!'
"notifications", { text: "Hello!" }
)
}.to have_broadcasted_to("notifications")
end
Expand All @@ -34,7 +34,7 @@ Feature: have_broadcasted matcher
it "matches with message" do
expect {
ActionCable.server.broadcast(
"notifications", text: 'Hello!'
"notifications", { text: "Hello!" }
)
}.to have_broadcasted_to("notifications").with(text: 'Hello!')
end
Expand All @@ -52,7 +52,7 @@ Feature: have_broadcasted matcher
it "matches with message" do
expect {
ActionCable.server.broadcast(
"notifications", text: 'Hello!', user_id: 12
"notifications", { text: 'Hello!', user_id: 12 }
)
}.to have_broadcasted_to("notifications").with(a_hash_including(text: 'Hello!'))
end
Expand All @@ -70,7 +70,7 @@ Feature: have_broadcasted matcher
it "matches with message" do
expect {
ActionCable.server.broadcast(
"notifications", text: 'Hello!', user_id: 12
"notifications", { text: 'Hello!', user_id: 12 }
)
}.to have_broadcasted_to("notifications").with { |data|
expect(data['user_id']).to eq 12
Expand All @@ -90,7 +90,7 @@ Feature: have_broadcasted matcher
it "matches with stream name" do
expect {
ActionCable.server.broadcast(
"notifications", text: 'Hello!'
"notifications", { text: 'Hello!' }
)
}.to broadcast_to("notifications")
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/rails/example/mailbox_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module MailboxExampleGroup
def self.create_inbound_email(arg)
case arg
when Hash
create_inbound_email_from_mail(arg)
create_inbound_email_from_mail(**arg)
else
create_inbound_email_from_source(arg.to_s)
end
Expand Down
13 changes: 8 additions & 5 deletions spec/generators/rspec/scaffold/scaffold_generator_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Generators are not automatically loaded by Rails
require 'generators/rspec/scaffold/scaffold_generator'
require 'support/generators'
require 'rspec/support/spec/in_sub_process'

RSpec.describe Rspec::Generators::ScaffoldGenerator, type: :generator do
include RSpec::Support::InSubProcess
setup_default_destination

describe 'standard request specs' do
Expand Down Expand Up @@ -41,12 +43,13 @@
end

describe 'in an engine' do
before do
allow_any_instance_of(::Rails::Generators::NamedBase).to receive(:mountable_engine?).and_return(true)
run_generator %w[posts --request_specs]
it 'generates files with Engine url_helpers' do
in_sub_process do
Copy link
Member

Choose a reason for hiding this comment

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

👏

Wondering why it was wiping out the original method along the way.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I suspect, and this is just a theory on my part, because when it stubs the method doesn't exist, it's then loaded, and the then stub blows it away as it was never there originally.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

🤯 😱
Reminds me of #2394 (comment)

allow_any_instance_of(::Rails::Generators::NamedBase).to receive(:mountable_engine?).and_return(true)
run_generator %w[posts --request_specs]
is_expected.to contain('Engine.routes.url_helpers')
end
end

it { is_expected.to contain('Engine.routes.url_helpers') }
end
end

Expand Down