Skip to content

Commit

Permalink
remove extra cuke modeler complexity (#878)
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Aug 30, 2022
1 parent 03c4d5f commit d51c6d1
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 81 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,11 @@ jobs:
matrix:
ruby: ['2.5', '2.6', '2.7', '3.0', '3.1', head, jruby-head]
os: [ubuntu-latest, windows-latest]
gemfile: [cucumber_4, cuke_modeler_3_minimum, cuke_modeler_3]
task: [spec]
include:
- ruby: '2.5' # lowest supported version
os: ubuntu-latest
gemfile: cuke_modeler_3 # Any one of the gemfiles should be fine
task: rubocop
exclude:
# CukeModeler 3.x does not support Ruby 3 until CM 3.6
- gemfile: cuke_modeler_3_minimum
ruby: jruby-head
- gemfile: cuke_modeler_3_minimum
ruby: head
- gemfile: cuke_modeler_3_minimum
ruby: '3.1'
- gemfile: cuke_modeler_3_minimum
ruby: '3.0'
env: # $BUNDLE_GEMFILE must be set at the job level, so that it is set for all steps
BUNDLE_GEMFILE: ci_gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@master
- uses: ruby/setup-ruby@v1
Expand Down
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,7 @@ Style/CaseEquality:

Lint/EmptyClass:
Enabled: false

# ENV.fetch('FOO', nil) is the same as ENV['FOO']
Style/FetchEnvVar:
Enabled: false
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ gemspec
gem 'bump'
gem 'test-unit'
gem 'minitest', '~> 5.5.0'
gem 'rspec', '~> 3.3'
gem 'cucumber', "~> 4.0"
gem 'cuke_modeler', '~> 3.6'
gem 'spinach', git: "https://github.com/grosser/spinach.git", branch: "grosser/json" # https://github.com/codegram/spinach/pull/229
gem 'rake'
gem 'rubocop', '~> 1.28.0' # lock minor so we do not get accidental violations, also need to drop ruby 2.5 support to upgrade further
gem 'rubocop-ast', '~> 1.17.0' # also need to drop ruby 2.5 support to remove this line
19 changes: 9 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ GEM
gherkin-ruby (0.3.2)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
json (2.6.2)
middleware (0.1.0)
minitest (5.5.1)
multi_test (0.1.2)
Expand Down Expand Up @@ -96,17 +95,16 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (1.35.1)
json (~> 2.3)
rubocop (1.28.2)
parallel (~> 1.10)
parser (>= 3.1.2.1)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.20.1, < 2.0)
rexml
rubocop-ast (>= 1.17.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.21.0)
rubocop-ast (1.17.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
sys-uname (1.2.2)
Expand All @@ -127,14 +125,15 @@ PLATFORMS
DEPENDENCIES
bump
cucumber (~> 4.0)
cuke_modeler (~> 3.0)
cuke_modeler (~> 3.6)
minitest (~> 5.5.0)
parallel_tests!
rake
rspec (~> 3.3)
rubocop
rubocop (~> 1.28.0)
rubocop-ast (~> 1.17.0)
spinach!
test-unit

BUNDLED WITH
2.3.6
2.3.7
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end

desc "bundle all gemfiles [EXTRA=]"
task :bundle_all do
extra = ENV.fetch("EXTRA", nil) || "install"
extra = ENV["EXTRA"] || "install"

gemfiles = (["Gemfile"] + Dir["spec/fixtures/rails*/Gemfile"])
raise if gemfiles.size < 3
Expand Down
11 changes: 0 additions & 11 deletions ci_gemfiles/cucumber_4.gemfile

This file was deleted.

11 changes: 0 additions & 11 deletions ci_gemfiles/cuke_modeler_3.gemfile

This file was deleted.

11 changes: 0 additions & 11 deletions ci_gemfiles/cuke_modeler_3_minimum.gemfile

This file was deleted.

6 changes: 3 additions & 3 deletions lib/parallel_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class << self
def determine_number_of_processes(count)
[
count,
ENV.fetch("PARALLEL_TEST_PROCESSORS", nil),
ENV["PARALLEL_TEST_PROCESSORS"],
Parallel.processor_count
].detect { |c| !c.to_s.strip.empty? }.to_i
end
Expand Down Expand Up @@ -68,8 +68,8 @@ def first_process?
end

def last_process?
current_process_number = ENV.fetch('TEST_ENV_NUMBER', nil)
total_processes = ENV.fetch('PARALLEL_TEST_GROUPS', nil)
current_process_number = ENV['TEST_ENV_NUMBER']
total_processes = ENV['PARALLEL_TEST_GROUPS']
return true if current_process_number.nil? && total_processes.nil?
current_process_number = '1' if current_process_number.nil?
current_process_number == total_processes
Expand Down
4 changes: 2 additions & 2 deletions lib/parallel_tests/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,15 @@ def use_colors?
end

def first_is_1?
val = ENV.fetch("PARALLEL_TEST_FIRST_IS_1", nil)
val = ENV["PARALLEL_TEST_FIRST_IS_1"]
['1', 'true'].include?(val)
end

# CI systems often fail when there is no output for a long time, so simulate some output
def simulate_output_for_ci(simulate)
if simulate
progress_indicator = Thread.new do
interval = Float(ENV.fetch('PARALLEL_TEST_HEARTBEAT_INTERVAL', 60))
interval = Float(ENV['PARALLEL_TEST_HEARTBEAT_INTERVAL'] || 60)
loop do
sleep interval
print '.'
Expand Down
2 changes: 1 addition & 1 deletion lib/parallel_tests/cucumber/scenarios.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def split_into_scenarios(files, tags = '')

# We loop on each children of the feature
test_models = feature.tests
test_models += feature.rules.map(&:tests).flatten if feature.respond_to?(:rules)
test_models += feature.rules.flat_map(&:tests) if feature.respond_to?(:rules) # cuke_modeler >= 3.2 supports rules
test_models.each do |test|
# It's a scenario, we add it to the scenario_line_logger
scenario_line_logger.visit_feature_element(document.path, test, feature_tags, line_numbers: test_lines)
Expand Down
4 changes: 2 additions & 2 deletions lib/parallel_tests/test/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ def command_with_seed(cmd, seed)
protected

def executable
if ENV.include?('PARALLEL_TESTS_EXECUTABLE')
[ENV.fetch('PARALLEL_TESTS_EXECUTABLE')]
if (executable = ENV['PARALLEL_TESTS_EXECUTABLE'])
[executable]
else
determine_executable
end
Expand Down
7 changes: 0 additions & 7 deletions parallel_tests.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,5 @@ Gem::Specification.new name, ParallelTests::VERSION do |s|
s.license = "MIT"
s.executables = ["parallel_spinach", "parallel_cucumber", "parallel_rspec", "parallel_test"]
s.add_runtime_dependency "parallel"

s.add_development_dependency 'cucumber', '~> 4.0'
s.add_development_dependency 'cuke_modeler', '~> 3.0'
s.add_development_dependency "rake"
s.add_development_dependency 'rspec', '~> 3.3'
s.add_development_dependency "rubocop"

s.required_ruby_version = '>= 2.5.0'
end
4 changes: 2 additions & 2 deletions spec/fixtures/rails70/bin/bundle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ m = Module.new do
end

def env_var_version
ENV.fetch("BUNDLER_VERSION", nil)
ENV["BUNDLER_VERSION"]
end

def cli_arg_version
Expand All @@ -38,7 +38,7 @@ m = Module.new do
end

def gemfile
gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
gemfile = ENV["BUNDLE_GEMFILE"]
return gemfile if gemfile && !gemfile.empty?

File.expand_path('../Gemfile', __dir__)
Expand Down
7 changes: 1 addition & 6 deletions spec/parallel_tests/cucumber/scenarios_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,7 @@
end
end

cuke_modeler_version = Gem.loaded_specs['cuke_modeler'].version.version
major = cuke_modeler_version.match(/^(\d+)\./)[1].to_i
minor = cuke_modeler_version.match(/^\d+\.(\d+)\./)[1].to_i

# CukeModeler doesn't support Rule models until 3.2.0
context 'with Rules', if: (major > 3) || (minor >= 2) do
context 'with Rules' do # cuke_modeler >=3.2
let(:feature_file) do
Tempfile.new('grouper.feature').tap do |feature|
feature.write <<-EOS
Expand Down

0 comments on commit d51c6d1

Please sign in to comment.