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

Split the test matrix. #118

Merged
merged 1 commit into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/head.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests (HEAD)
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
entry:
- { ruby: "3.2", grape-swagger: "HEAD" }
- { ruby: "ruby-head", grape-swagger: "HEAD" }
- { ruby: "jruby-head", grape-swagger: "HEAD" }
env:
GRAPE_SWAGGER_VERSION: ${{ matrix.entry.grape-swagger }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.entry.ruby }}
bundler-cache: true
- name: Setup Firefox
uses: browser-actions/setup-firefox@v1
with:
firefox-version: "111.0.1"
- uses: browser-actions/setup-geckodriver@latest
with:
geckodriver-version: "0.32.2"
- uses: coactions/setup-xvfb@v1
with:
run: bundle exec rake spec
30 changes: 11 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
name: Tests
on:
push:
branches:
- master
pull_request:
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
continue-on-error: ${{ (matrix.grape-swagger.experimental) || (matrix.ruby.experimental) }}
strategy:
fail-fast: false
matrix:
grape-swagger:
- { version: "1.6.0", experimental: false }
- { version: "HEAD", experimental: true }
ruby:
- { version: "2.7", experimental: false }
- { version: "3.0", experimental: false }
- { version: "3.1", experimental: false }
- { version: "3.2", experimental: false }
- { version: "ruby-head", experimental: true }
- { version: "jruby-9.4.2", experimental: false }
- { version: "jruby-head", experimental: true }
entry:
- { ruby: "2.7", grape-swagger: "1.6.1" }
- { ruby: "3.0", grape-swagger: "1.6.1" }
- { ruby: "3.1", grape-swagger: "1.6.1" }
- { ruby: "3.2", grape-swagger: "1.6.1" }
- { ruby: "3.2", grape-swagger: "2.0.2" }
- { ruby: "jruby-9.4.6", grape-swagger: "1.6.1" }
- { ruby: "jruby-9.4.6", grape-swagger: "2.0.2" }
env:
GRAPE_SWAGGER_VERSION: ${{ matrix.grape-swagger.version }}
GRAPE_SWAGGER_VERSION: ${{ matrix.entry.grape-swagger }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby.version }}
ruby-version: ${{ matrix.entry.ruby }}
bundler-cache: true
- name: Setup Firefox
uses: browser-actions/setup-firefox@v1
Expand Down
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
AllCops:
TargetRubyVersion: 2.7
NewCops: enable

inherit_from: .rubocop_todo.yml

require:
- rubocop-capybara
- rubocop-rake
- rubocop-rspec
84 changes: 79 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-02-22 14:55:40 UTC using RuboCop version 1.60.2.
# on 2024-04-06 14:14:58 UTC using RuboCop version 1.62.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 6
# Configuration parameters: EnforcedStyle.
# SupportedStyles: link_or_button, strict
Capybara/ClickLinkOrButtonStyle:
Exclude:
- 'spec/features/swagger_spec.rb'

# Offense count: 1
Capybara/SpecificMatcher:
Exclude:
- 'spec/features/welcome_spec.rb'

# Offense count: 1
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Expand All @@ -25,11 +37,11 @@ Lint/MixedRegexpCaptureTypes:
Exclude:
- 'lib/tasks/swagger_ui.rake'

# Offense count: 9
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# Offense count: 4
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 291
Max: 89

# Offense count: 2
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
Expand All @@ -40,6 +52,63 @@ Naming/FileName:
- 'lib/grape-swagger-rails.rb'
- 'spec/features/grape-swagger-rails_spec.rb'

# Offense count: 13
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/features/swagger_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SkipBlocks, EnforcedStyle.
# SupportedStyles: described_class, explicit
RSpec/DescribedClass:
Exclude:
- 'spec/features/grape-swagger-rails_spec.rb'

# Offense count: 6
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 8

# Offense count: 1
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/features/grape-swagger-rails_spec.rb'

# Offense count: 2
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
- 'spec/features/swagger_spec.rb'

# Offense count: 12
RSpec/MultipleExpectations:
Max: 4

# Offense count: 2
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/features/grape-swagger-rails_spec.rb'

# Offense count: 12
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 4

# Offense count: 1
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Exclude:
- '**/spec/routing/**/*'
- 'spec/features/grape-swagger-rails_spec.rb'

# Offense count: 4
# Configuration parameters: AllowedConstants.
Style/Documentation:
Expand All @@ -51,8 +120,13 @@ Style/Documentation:
- 'lib/grape-swagger-rails/engine.rb'

# Offense count: 1
Style/OpenStructUse:
Exclude:
- 'lib/grape-swagger-rails.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 124
Max: 143
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [#114](https://github.com/ruby-grape/grape-swagger-rails/pull/114): Add `api_key_placeholder` option - [@SofiaSousa](https://github.com/SofiaSousa).
* [#116](https://github.com/ruby-grape/grape-swagger-rails/pull/116): Ensure that `ostruct` is loaded - [@jrmhaig](https://github.com/jrmhaig).
* [#117](https://github.com/ruby-grape/grape-swagger-rails/pull/117): Fix rubygems source code location metadata - [@dblock](https://github.com/dblock).
* [#118](https://github.com/ruby-grape/grape-swagger-rails/pull/118): Split the test matrix, fix JRuby tests - [@dblock](https://github.com/dblock).

### 0.4.0 (2023/03/28)

Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ group :development, :test do
gem 'rake'
gem 'rspec-rails'
gem 'rubocop'
gem 'rubocop-capybara'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'ruby-grape-danger', '~> 0.2.0', require: false
gem 'selenium-webdriver'
gem 'sprockets-rails', require: 'sprockets/railtie'
Expand Down
1 change: 0 additions & 1 deletion grape-swagger-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Gem::Specification.new do |spec|
spec.homepage = 'https://github.com/ruby-grape/grape-swagger-rails'
spec.license = 'MIT'
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
spec.test_files = `git ls-files spec`.split($INPUT_RECORD_SEPARATOR)
spec.require_paths = %w[lib]
spec.add_dependency 'railties', '>= 6.0.6.1'
spec.metadata = {
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
config.active_support.report_deprecations = false

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
config.log_formatter = Logger::Formatter.new

# Use a different logger for distributed setups.
# require "syslog/logger"
Expand Down
4 changes: 3 additions & 1 deletion spec/features/grape-swagger-rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
require 'spec_helper'

describe GrapeSwaggerRails do
context '#options' do
describe '#options' do
subject do
GrapeSwaggerRails.options
end

it 'is an instance of Options' do
expect(subject).to be_a GrapeSwaggerRails::Options
end

it 'defaults headers to an empty hash' do
expect(subject.headers).to eq({})
end
Expand Down
Loading
Loading