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

Add Ruby 3.2 to test matrix #1434

Merged
merged 3 commits into from Apr 18, 2023
Merged

Add Ruby 3.2 to test matrix #1434

merged 3 commits into from Apr 18, 2023

Conversation

mataku
Copy link
Contributor

@mataku mataku commented Apr 10, 2023

Description

add Ruby 3.2 to GitHub Actions test matrix and fix failed specs to ensure that Danger works with Ruby 3.2 on CI

it seems #1411 has been reverted, this is a restore of it

Changes

On Ruby 3.2, some tests using WebMock fail like the one below.

Result of a test case using WebMock
$ bundle rspec spec/lib/danger/request_sources/gitlab_spec.rb:147
Run options: include {:locations=>{"./spec/lib/danger/request_sources/gitlab_spec.rb"=>[147]}}

Randomized with seed 60974

Danger::RequestSources::GitLab
  valid server response
    set its mr_json (FAILED - 1)

Failures:

  1) Danger::RequestSources::GitLab valid server response set its mr_json
     Failure/Error: WebMock.stub_request(:get, url).with(headers: expected_headers).to_return(raw_file)

     TypeError:
       no implicit conversion from nil to integer
     # ./vendor/bundle/ruby/3.2.0/gems/webmock-3.5.0/lib/webmock/response.rb:124:in `read_raw_response'
     # ./vendor/bundle/ruby/3.2.0/gems/webmock-3.5.0/lib/webmock/response.rb:18:in `initialize'
     # ./vendor/bundle/ruby/3.2.0/gems/webmock-3.5.0/lib/webmock/response.rb:10:in `new'
     # ./vendor/bundle/ruby/3.2.0/gems/webmock-3.5.0/lib/webmock/response.rb:10:in `response_for'
     # ./vendor/bundle/ruby/3.2.0/gems/webmock-3.5.0/lib/webmock/request_stub.rb:21:in `block in to_return'
     # ./vendor/bundle/ruby/3.2.0/gems/webmock-3.5.0/lib/webmock/request_stub.rb:21:in `map'
     # ./vendor/bundle/ruby/3.2.0/gems/webmock-3.5.0/lib/webmock/request_stub.rb:21:in `to_return'
     # ./spec/support/gitlab_helper.rb:50:in `stub_merge_request'
     # ./spec/lib/danger/request_sources/gitlab_spec.rb:109:in `block (3 levels) in <top (required)>'

Finished in 0.01012 seconds (files took 0.32573 seconds to load)
1 example, 1 failure

it seems net-protocol (v0.2.1) bundled gem in Ruby 3.2 and the version of WebMock currently used in Danger seem to be incompatible. Ruby 3.1.1 uses net-protocol 0.1.2, so you will see that tests pass if fix net-protocol to it.

However, changing the version of the bundled gem is a bit hard to manage, so update WebMock so that the test passes

@mataku
Copy link
Contributor Author

mataku commented Apr 10, 2023

I will fix that something is broken with Ruby 3.1 on Windows
https://github.com/danger/danger/actions/runs/4659124031/jobs/8245637996?pr=1434


Tests fail for some reason when version 3.18 or higher of WebMock is used, so just fixed it to 3.16.X

…uby 3.2

Use 3.16.2 because some tests fail with Ruby 3.0 or 3.1 on Windows if updates WebMock to 3.18.0 or over
@mataku mataku marked this pull request as ready for review April 12, 2023 11:53
@orta
Copy link
Member

orta commented Apr 18, 2023

Ace, thaniks 👍🏻

@orta orta merged commit 949dc67 into danger:master Apr 18, 2023
12 checks passed
@mataku mataku deleted the feature/ruby32 branch April 19, 2023 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants