Skip to content

Commit

Permalink
Merge pull request #637 from cucumber/fix-jruby-builds
Browse files Browse the repository at this point in the history
Fix JRuby builds
  • Loading branch information
mvz authored Jun 28, 2019
2 parents 7264597 + 1744407 commit 3109b9e
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 186 deletions.
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
--color
--format Fuubar
--order random
--warnings
35 changes: 14 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ jobs:
os: linux
- rvm: jruby
os: linux
- rvm: jruby-9.2.7.0
- rvm: jruby-9.2.6.0
os: linux
- rvm: jruby-9.2.7.0
- rvm: jruby-9.2.6.0
os: osx
env: JAVA_OPTS="--add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/java.security.cert=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --illegal-access=warn"
script: bundle exec rake test:rspec
- stage: lint
script: bundle exec rake lint
rvm: 2.6.3
os: linux
allow_failures:
- rvm: ruby-head
- rvm: jruby
- rvm: jruby-9.2.7.0
fast_finish: true

branches:
Expand All @@ -54,20 +54,13 @@ branches:
# slack: cucumberbdd:oQFVhzsx4R94KWmjlejAJYnM
env:
global:
- secure: l8uznA5K4K9mZ1krmP3lTMD8WcJ32qGxFOR3jubKHcOBSLB4xSzU2aIqjyJdO+rLzebkwamhJc8pGSIWOUDQYvFiX7splK+uEkbBJ5huAhXtLF4Qgl86bCWbEXYzN7rvn0DQfpJAovyFMNRMnfo70XhwqWzFsaYa7Z0YbqYsJE4=
# Travis by default also have "-Dcext.enabled=false" set in
# JRUBY_OPTS, but JRuby 9 does not support C extensions at all
# so it issues warning that will mess up the sterr checks.
- JRUBY_OPTS="--dev --debug"
# Somehow a "ASCII-8BIT to UTF-8 conversion error" appears for
# JRuby 9
- LC_ALL=en_US.UTF-8
- LANG=en_US.UTF-8
- LANGUAGE=en_US.UTF-8

cache: apt

addons:
apt:
packages:
- zsh
- secure: l8uznA5K4K9mZ1krmP3lTMD8WcJ32qGxFOR3jubKHcOBSLB4xSzU2aIqjyJdO+rLzebkwamhJc8pGSIWOUDQYvFiX7splK+uEkbBJ5huAhXtLF4Qgl86bCWbEXYzN7rvn0DQfpJAovyFMNRMnfo70XhwqWzFsaYa7Z0YbqYsJE4=
# Travis by default also have "-Dcext.enabled=false" set in
# JRUBY_OPTS, but JRuby 9 does not support C extensions at all
# so it issues warning that will mess up the stderr checks.
- JRUBY_OPTS="--dev --debug"
# Somehow a "ASCII-8BIT to UTF-8 conversion error" appears for
# JRuby 9
- LC_ALL=en_US.UTF-8
- LANG=en_US.UTF-8
- LANGUAGE=en_US.UTF-8
1 change: 0 additions & 1 deletion aruba.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'rspec-expectations', '~> 3.4'
spec.add_runtime_dependency 'thor', '~> 0.19'

spec.add_development_dependency 'fuubar', '~> 2.3'
spec.add_development_dependency 'json', '~> 2.1'
spec.add_development_dependency 'license_finder', '~> 5.3'
spec.add_development_dependency 'minitest', '~> 5.10'
Expand Down
19 changes: 4 additions & 15 deletions cucumber.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
<%
$LOAD_PATH << ::File.expand_path('../lib', __FILE__)
require 'aruba/version'
require 'ffi'
java_version = (RUBY_DESCRIPTION.match(/.*?on.*?(1\.[\d]\..*? )/))[1] if defined?(JRUBY_VERSION)
std_opts = "--format pretty --color --exclude features/fixtures --require features --tags ~@unsupported-on"
java_default_opts = "--tags ~@wip-jruby-java-1.6" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
java_wip_opts = "--tags @wip-jruby-java-1.6:3" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
ignore_opts = []
ignore_opts << '--tags ~@ignore'
ignore_opts = ignore_opts.join(' ')
std_opts = "--format pretty --color --exclude features/fixtures --require features --tags ~@unsupported-on"
ignore_opts = '--tags ~@ignore'
%>
default: <%= std_opts %> --tags ~@wip <%= java_default_opts %> <%= ignore_opts %>
wip: <%= std_opts %> --wip --tags @wip:3 <%= java_wip_opts %> <%= ignore_opts %>
default: <%= std_opts %> --tags ~@wip <%= ignore_opts %>
wip: <%= std_opts %> --wip --tags @wip:3 <%= ignore_opts %>
25 changes: 0 additions & 25 deletions features/03_testing_frameworks/cucumber/overview.feature

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ Feature: Run commands in ruby process
type some letters on keyboard - can only appear later, but this point is
never reached, because ruby is blocked.
Given the default aruba exit timeout is 3 seconds
And a file named "lib/cli/app/runner.rb" with:
Given a file named "lib/cli/app/runner.rb" with:
"""
module Cli
module App
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Feature: Running an interactive command
Background:
Given I use a fixture named "cli-app"

@wip-jruby-java-1.6
Scenario: Running ruby interactively
Given an executable named "bin/aruba-test-cli" with:
"""bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Feature: Running shell commands
- `When I run the following script:`

Or you can run shell commands with:
- `I run the following (commands|script)`
- `I run the following (commands|script) (in|with) \`interpreter\``
- `I run the following (commands|script) (in|with) \`/path/to/interpreter\``
- `I run the following (commands|script):`
- `I run the following (commands|script) (in|with) \`interpreter\`:`
- `I run the following (commands|script) (in|with) \`/path/to/interpreter\`:`

Background:
Given I use a fixture named "cli-app"
Expand Down Expand Up @@ -38,6 +38,7 @@ Feature: Running shell commands
When I run `cucumber`
Then the features should all pass

@requires-bash
Scenario: Running shell commands
Given a file named "features/shell.feature" with:
"""
Expand All @@ -52,106 +53,31 @@ Feature: Running shell commands
When I run `cucumber`
Then the features should all pass

@requires-bash
Scenario: Running bash commands
Given a file named "features/shell.feature" with:
"""
Feature: Running scripts
Scenario: Running bash commands
When I run the following commands with `bash`:
\"\"\"bash
echo "Hello `echo bash`"
\"\"\"
Then the output should contain exactly "Hello bash"
"""
When I run `cucumber`
Then the features should all pass

@requires-zsh
Scenario: Running zsh commands
Given a file named "features/shell.feature" with:
"""
Feature: Running zsh scripts
Scenario: Running zsh commands
When I run the following commands with `zsh`:
\"\"\"bash
echo "Hello, Aruba!"
\"\"\"
Then the output should contain exactly "Hello, Aruba!"
"""
When I run `cucumber`
Then the features should all pass

@requires-ruby
Scenario: Running ruby commands
Scenario: Running commands with a named interpreter
Given a file named "features/shell.feature" with:
"""
Feature: Running scripts
Scenario: Running ruby commands
When I run the following commands with `ruby`:
\"\"\"ruby
puts "Hello, Aruba!"
\"\"\"
Then the output should contain exactly "Hello, Aruba!"
"""
When I run `cucumber`
Then the features should all pass

@requires-python
Scenario: Running python commands
Given a file named "features/shell.feature" with:
"""
Feature: Running scripts
Scenario: Running python commands
When I run the following commands with `python`:
\"\"\"python
print("Hello, Aruba!")
puts "Hello, Aruba!"
\"\"\"
Then the output should contain exactly "Hello, Aruba!"
"""
When I run `cucumber`
Then the features should all pass

@requires-zsh
@requires-bash
Scenario: Running commands if full path to interpreter is given
Given a file named "features/shell.feature" with:
"""
Feature: Running full path zsh
Scenario: Running zsh commands #1
When I run the following commands with `/bin/zsh`:
Feature: Running full path
Scenario: Running full path bash
When I run the following commands with `/bin/bash`:
\"\"\"bash
echo "Hello, Aruba!"
echo "Hello Aruba!"
\"\"\"
Then the output should contain exactly "Hello, Aruba!"
Scenario: Running zsh commands #1
When I run the following commands in `/bin/zsh`:
\"\"\"bash
echo "Hello, Aruba!"
\"\"\"
Then the output should contain exactly "Hello, Aruba!"
"""
When I run `cucumber`
Then the features should all pass

@requires-zsh
Scenario: Running commands if only the name of interpreter is given
Given a file named "features/shell.feature" with:
"""
Feature: Running full path zsh
Scenario: Running zsh commands #1
When I run the following commands with `zsh`:
\"\"\"bash
echo "Hello, Aruba!"
\"\"\"
Then the output should contain exactly "Hello, Aruba!"
Scenario: Running zsh commands #2
When I run the following commands in `zsh`:
\"\"\"bash
echo "Hello, Aruba!"
\"\"\"
Then the output should contain exactly "Hello, Aruba!"
Then the output should contain "Hello Aruba!"
"""
When I run `cucumber`
Then the features should all pass
10 changes: 0 additions & 10 deletions features/step_definitions/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@
skip_this_scenario
end

Before '@requires-zsh' do |scenario|
next unless Aruba.platform.which('zsh').nil?

if Cucumber::VERSION < '2'
scenario.skip_invoke!
else
skip_this_scenario
end
end

Before '@requires-java' do |scenario|
next unless Aruba.platform.which('javac').nil?

Expand Down
3 changes: 2 additions & 1 deletion features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
$LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)

# Has to be the first file required so that all other files show coverage information
require 'simplecov'
require 'simplecov' unless RUBY_PLATFORM.include?('java')

# Standard Library
require 'fileutils'
require 'pathname'

# Gems
require 'aruba/cucumber'
require 'aruba/config/jruby'
require 'rspec/expectations'

Before do |scenario|
Expand Down
15 changes: 9 additions & 6 deletions features/support/simplecov_setup.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for child processes and @in-process
require 'simplecov'
# @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for
# child processes and @in-process
unless RUBY_PLATFORM.include?('java')
require 'simplecov'

root = File.expand_path('../../../', __FILE__)
root = File.expand_path('../../../', __FILE__)

SimpleCov.command_name(ENV['SIMPLECOV_COMMAND_NAME'])
SimpleCov.root(root)
load File.join(root, '.simplecov')
SimpleCov.command_name(ENV['SIMPLECOV_COMMAND_NAME'])
SimpleCov.root(root)
load File.join(root, '.simplecov')
end
20 changes: 20 additions & 0 deletions features/support/timing.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# From https://itshouldbeuseful.wordpress.com/2010/11/10/find-your-slowest-running-cucumber-features/

scenario_times = {}

Around do |scenario, block|
name = "#{scenario.feature.file}::#{scenario.name}"
start = Time.now
block.call
end_time = Time.now
scenario_times[name] = end_time - start
end

at_exit do
max_scenarios = scenario_times.size > 20 ? 20 : scenario_times.size
puts "------------- Top #{max_scenarios} slowest scenarios -------------"
sorted_times = scenario_times.sort { |a, b| b[1] <=> a[1] }
sorted_times[0..max_scenarios - 1].each do |key, value|
puts format("%.2f %s", value, key)
end
end
2 changes: 0 additions & 2 deletions lib/aruba/cucumber.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'aruba/version'

require 'aruba/api'
World(Aruba::Api)

require 'aruba/cucumber/hooks'
require 'aruba/cucumber/command'
require 'aruba/cucumber/environment'
Expand Down
Loading

0 comments on commit 3109b9e

Please sign in to comment.