Skip to content

Commit

Permalink
Fix/workflow ci permutations (#570)
Browse files Browse the repository at this point in the history
* Try use differing versions of compatible gems to get selenium scenarios running

* Remove running config from matrix

* Re-order some rubocop stuff

* Fix rubocop

* Tweak workflow to avoid double running
  • Loading branch information
luke-hill authored Sep 27, 2023
1 parent 81b974f commit fb2c6e9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
---
name: build
on: [ push, pull_request, workflow_call ]
on:
push:
branches:
- main
- renovate/**
pull_request:
branches:
- main
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -26,8 +35,11 @@ jobs:
- { ruby: '2.6', gemfile: 'rails_6_1' }
- { ruby: '2.6', gemfile: 'rails_7_0' }
- { ruby: '2.7', gemfile: 'rails_7_0' }
- { ruby: '3.0', gemfile: 'rails_5_2' } # Rails 5.2 won't work with Ruby 3+: https://github.com/rails/rails/issues/40938
# Ruby 3+ won't work with Rails 5.2: https://github.com/rails/rails/issues/40938
- { ruby: '3.0', gemfile: 'rails_5_2' }
- { ruby: '3.1', gemfile: 'rails_5_2' }
# Ruby 3.1+ has a conflicting Psych version with Rails 6.0 (And maybe 6.1...): https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias
- { ruby: '3.1', gemfile: 'rails_6_0' }
- { ruby: '3.2', gemfile: 'rails_5_2' }
- { ruby: '3.2', gemfile: 'rails_6_0' }
env:
Expand Down
36 changes: 17 additions & 19 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ AllCops:
- 'gemfiles/*.gemfile'
- 'vendor/**/*'

# These two areas will frequently break this limit, so we ignore the limit
Metrics/BlockLength:
Exclude:
- './spec/**/*_spec.rb'
- 'cucumber-rails.gemspec'
# Disabled on our repo's to enable polyglot-release
Gemspec/RequireMFA:
Enabled: false

# This allows us to read the chmod action in a more reproducible way
Style/NumericLiteralPrefix:
EnforcedOctalStyle: zero_only
Layout/LineLength:
Max: 200
AllowedPatterns:
- '^Given'
- '^When'
- '^Then'

# This needs fixing as it's inheriting a lot more than what we originally need.
# The inheritance chain goes all the way down to a single test case which the world
Expand All @@ -30,14 +31,15 @@ Lint/MissingSuper:
Exclude:
- lib/cucumber/rails/world.rb

## Cucumber Repo styles (Across implementations) ##
# These can both be removed once we upgrade rubocop and rubocop-rspec to more up to date versions
Metrics/BlockLength:
Exclude:
- './spec/**/*_spec.rb'
- 'cucumber-rails.gemspec'

Layout/LineLength:
Max: 200
AllowedPatterns:
- '^Given'
- '^When'
- '^Then'
# This allows us to read the chmod action in a more reproducible way
Style/NumericLiteralPrefix:
EnforcedOctalStyle: zero_only

Style/Documentation:
Enabled: false
Expand All @@ -48,7 +50,3 @@ Style/RegexpLiteral:

RSpec/MessageSpies:
EnforcedStyle: receive

# TODO: investigate changes to release process and then enable MFA (https://guides.rubygems.org/mfa-requirement-opt-in/)
Gemspec/RequireMFA:
Enabled: false
11 changes: 5 additions & 6 deletions features/support/cucumber_rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def rails_new(options = {})
# This expectation allows us to wait until the command line monitor has output a README file (i.e. the command has completed)
expect(run_rails_new_command(options)).to have_output(/README/)

cd options[:name]
cd 'test_app'
configure_rails_gems
configure_rails_requires
configure_rails_layout
Expand All @@ -27,11 +27,10 @@ def install_cucumber_rails(*options)
private

def run_rails_new_command(options)
options[:name] ||= 'test_app'
flags = %w[--skip-action-cable --skip-action-mailer --skip-active-job --skip-bootsnap --skip-bundle --skip-javascript
--skip-jbuilder --skip-listen --skip-spring --skip-sprockets --skip-test-unit --skip-turbolinks --skip-active-storage]
flags += %w[--skip-action-mailbox --skip-action-text] if rails_equal_or_higher_than?('6.0')
run_command "bundle exec rails new #{options[:name]} #{flags.join(' ')} #{options[:args]}"
run_command "bundle exec rails new test_app #{flags.join(' ')} #{options[:args]}"
end

def configure_rails_gems
Expand Down Expand Up @@ -101,13 +100,13 @@ def add_rails_conditional_gems
if rails_equal_or_higher_than?('6.0')
add_gem 'sqlite3', '~> 1.4'
add_gem 'selenium-webdriver', '~> 4.0', group: :test
add_gem 'webdrivers', '~> 5.0', group: :test
else
add_gem 'sqlite3', '~> 1.3.13'
add_gem 'selenium-webdriver', '< 4', group: :test
add_gem 'webdrivers', '~> 4.0', group: :test
remove_gem 'chromedriver-helper'
end

add_gem 'webdrivers', '~> 5.0' unless rails_equal_or_higher_than?('7.0')
remove_gem 'chromedriver-helper' unless rails_equal_or_higher_than?('6.0')
end

def add_remaining_gems(options)
Expand Down

0 comments on commit fb2c6e9

Please sign in to comment.