Skip to content

Add GitHub Actions workflow for running the Koans on multiple Ruby versions - #60

Open
werebus wants to merge 4 commits into
edgecase:masterfrom
werebus:test-ruby-versions
Open

werebus wants to merge 4 commits into
edgecase:masterfrom
werebus:test-ruby-versions

Conversation

@werebus

@werebus werebus commented Sep 20, 2026

Copy link
Copy Markdown

I opted for a very long list of Rubies given that (pending #47) there's support in the Koans for some pretty old versions. The ruby/setup-ruby action supports everything since 1.9.3, so I just did that.

In order for the runs to be meaningful, I modified the Koans to exit with a non-zero exit code when the path isn't completed.

In the process, I actually did find a few small failures on old versions of Ruby (one on 1.9, one on 2.0, one on 2.1-2.6) and fixed those.

Closes #33

Run the koans on all rubies supported by the setup-ruby GitHub action.
Also bump the version used for "checks" to 4.0 and update the version of
the checkout action.
However, don't dump a stacktrace as a result in the src/koan Rakefile.
Finally, make sure syntax errors that occur during parsing still get
surfaced even if the sensei doesn't report "failed".

Non-zero exit status on incomplete path

Slight change to exitcode

Change sensei reporting location
* The version of Gubygems that ships with 1.9 tries to mutate the
  version string passed into its constructor
* Ruby 2.0 didn't have manditory keyword arguments (which half the Koan
  is about)
* Ruby 2.1-2.6 didn't have a colon in the "missing keyword"
  ArgumentError
* egrep is deprecated
* Remove unused exception capture to silence warning
- Every PR
- Pushes to main/master (keeping in mind edgecase#49)
- Monthly
Comment thread src/neo.rb

def before_ruby_version(version)
Gem::Version.new(RUBY_VERSION) < Gem::Version.new(version)
Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new(version)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version of Rubygems that ships with Ruby 1.9.3 tries to mutate the string passed into Gem::Version.new, and RUBY_VERSION is frozen.

require 'about_hashes'
require 'about_methods'
in_ruby_version("2", "3", "4") do
in_ruby_version("2.[1-7]", "3", "4") do

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby 2.0 has keyword arguments, but not required keyword arguments (which is about half the tests in this file).

method_with_mandatory_keyword_arguments
end
assert_match(/#{__("missing keyword: :one")}/, exception.message)
assert_match(/#{__("missing keyword: :?one")}/, exception.message)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby 2.1-2.6 don't have the : in the message.

Comment thread .github/workflows/ci.yml
- master
- main
schedule:
- cron: '0 9 1 * *'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Monthly seems OK for a scheduled run. Let me know if something else makes more sense.

Comment thread .github/workflows/ci.yml
Comment on lines +6 to +7
- master
- main

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case #49 happens

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.

Continuous Integration

1 participant