From d782e2f2cdb927a3aee0db01906a5efc04dbd13f Mon Sep 17 00:00:00 2001 From: Matt Moretti Date: Sat, 19 Sep 2026 13:46:23 -0400 Subject: [PATCH 1/4] Run the koans in CI as well 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. --- .github/workflows/ci.yml | 43 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 523c7785..a897e5b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,53 @@ name: CI on: [push] jobs: + koans: + strategy: + fail-fast: false + matrix: + ruby: + - '2.0' + - '2.1' + - '2.2' + - '2.3' + - '2.4' + - '2.5' + - '2.6' + - '2.7' + - '3.0' + - '3.1' + - '3.2' + - '3.3' + - '3.4' + - '4.0' + - ruby-head + os: [ubuntu-latest] + include: + - ruby: '1.9' + os: ubuntu-22.04 + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v7 + + - name: Install Ruby! + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Run solved koans + run: rake run + test: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Install Ruby! uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2.2" + ruby-version: '4.0' - name: run tests - run: rake test \ No newline at end of file + run: rake test From e1ee0360f4f583065c69cd03236d39a4973f25c7 Mon Sep 17 00:00:00 2001 From: Matt Moretti Date: Sun, 20 Sep 2026 14:07:22 -0400 Subject: [PATCH 2/4] Cause non-zero exit status on incomplete path 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 --- src/Rakefile | 4 +++- src/neo.rb | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Rakefile b/src/Rakefile index 1a2c7f26..69212630 100644 --- a/src/Rakefile +++ b/src/Rakefile @@ -7,6 +7,8 @@ require 'rake/testtask' task :default => :test task :test do - ruby 'path_to_enlightenment.rb' + ruby 'path_to_enlightenment.rb' do |ok, res| + exit res.exitstatus unless ok + end end diff --git a/src/neo.rb b/src/neo.rb index 0985362a..6683c738 100644 --- a/src/neo.rb +++ b/src/neo.rb @@ -519,6 +519,7 @@ def walk sensei.observe(step.meditate) end sensei.instruct + !sensei.failed? end def each_step @@ -536,6 +537,8 @@ def each_step end END { + exception = $! + Neo::Koan.command_line(ARGV) - Neo::ThePath.new.walk + exit exception.nil? && Neo::ThePath.new.walk } From 628eeed34996ac223fd5c21dd740434b36190050 Mon Sep 17 00:00:00 2001 From: Matt Moretti Date: Sun, 20 Sep 2026 17:06:49 -0400 Subject: [PATCH 3/4] Fix various failures and warnings * 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 --- rakelib/checks.rake | 4 ++-- src/about_keyword_arguments.rb | 2 +- src/neo.rb | 2 +- src/path_to_enlightenment.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rakelib/checks.rake b/rakelib/checks.rake index c1b20d7d..c5cd2e6a 100644 --- a/rakelib/checks.rake +++ b/rakelib/checks.rake @@ -19,10 +19,10 @@ namespace "check" do task :asserts do puts "Checking for asserts missing the replacement text:" begin - sh "egrep -n 'assert( |_)' src/about_*.rb | egrep -v '__|_n_|project|about_assert' | egrep -v ' *#'" + sh "grep -En 'assert( |_)' src/about_*.rb | grep -Ev '__|_n_|project|about_assert' | grep -Ev ' *#'" puts puts "Examine the above lines for missing __ replacements" - rescue RuntimeError => ex + rescue RuntimeError puts "OK" end puts diff --git a/src/about_keyword_arguments.rb b/src/about_keyword_arguments.rb index 3c9856b9..2ee443da 100644 --- a/src/about_keyword_arguments.rb +++ b/src/about_keyword_arguments.rb @@ -37,7 +37,7 @@ def test_mandatory_keyword_arguments_without_mandatory_argument exception = assert_raise(___(ArgumentError)) do method_with_mandatory_keyword_arguments end - assert_match(/#{__("missing keyword: :one")}/, exception.message) + assert_match(/#{__("missing keyword: :?one")}/, exception.message) end end diff --git a/src/neo.rb b/src/neo.rb index 6683c738..a9a4224f 100644 --- a/src/neo.rb +++ b/src/neo.rb @@ -26,7 +26,7 @@ def in_ruby_version(*versions) end def before_ruby_version(version) - Gem::Version.new(RUBY_VERSION) < Gem::Version.new(version) + Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new(version) end in_ruby_version("1.8") do diff --git a/src/path_to_enlightenment.rb b/src/path_to_enlightenment.rb index aacf7cfb..210b3550 100644 --- a/src/path_to_enlightenment.rb +++ b/src/path_to_enlightenment.rb @@ -12,7 +12,7 @@ require 'about_nil' require 'about_hashes' require 'about_methods' -in_ruby_version("2", "3", "4") do +in_ruby_version("2.[1-7]", "3", "4") do require 'about_keyword_arguments' end require 'about_constants' From 84dcb9c9c8df5900fa4550210522c82248b2ae86 Mon Sep 17 00:00:00 2001 From: Matt Moretti Date: Sun, 20 Sep 2026 17:48:48 -0400 Subject: [PATCH 4/4] Change when CI is run to: - Every PR - Pushes to main/master (keeping in mind #49) - Monthly --- .github/workflows/ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a897e5b3..4e88c7f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,13 @@ name: CI -on: [push] +on: + pull_request: + push: + branches: + - master + - main + schedule: + - cron: '0 9 1 * *' + jobs: koans: strategy: